diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java index 1e168543f..f3146c52f 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java @@ -68,10 +68,10 @@ public class BaseController { public TenantEntity getTenantInfo(){ TenantEntity tenantEntity = new TenantEntity(); Session session = SecurityUtils.getSubject().getSession(); - String isParent = (String)session.getAttribute(UserSession.isParent); + Boolean isParent = (Boolean)session.getAttribute(UserSession.isParent); String tenantId = (String)session.getAttribute(UserSession.tenantId); String parentTenantId = (String)session.getAttribute(UserSession.parentTenantId); - if(StringUtils.isNotBlank(isParent) && isParent.equalsIgnoreCase(EnumGroupSupport.SUPPORT.getCode().toString())){ + if(isParent!= null && isParent){ tenantEntity.setTenantId(null); tenantEntity.setParentTenantId(tenantId); }else{ diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java b/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java index 701a3d2bb..d9d6edb23 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java @@ -163,7 +163,7 @@ public class HomeController extends BaseController { StringUtils.isBlank(info.getParentTenantId())) { Session session = SecurityUtils.getSubject().getSession(); - session.setAttribute(UserSession.isParent, EnumGroupSupport.SUPPORT.getCode()); + session.setAttribute(UserSession.isParent, true); // 集团用户获取子商场 List mallList = mallService.getSubByParentTenantId(info.getTenantId()); diff --git a/mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml b/mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml index bfc369d36..46a5e28a7 100644 --- a/mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml @@ -23,12 +23,11 @@ and `id` = #{id} - - + + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/KwBoxMapper.xml b/mallinkService/src/main/resources/mapper/KwBoxMapper.xml index 175449423..bcdeb9c2a 100644 --- a/mallinkService/src/main/resources/mapper/KwBoxMapper.xml +++ b/mallinkService/src/main/resources/mapper/KwBoxMapper.xml @@ -34,12 +34,11 @@ and `id` = #{id} - - + + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml b/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml index 59e615f9c..0eb19710c 100644 --- a/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml +++ b/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml @@ -24,11 +24,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -94,12 +93,12 @@ from ( select merchant_id from kw_merchant_meter where `status` = 0 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `merchant_id` = #{merchantId} @@ -293,8 +292,13 @@ where m.status=1 and m.id not in ( select merchant_id from wx_merchant_power_bill_config - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) diff --git a/mallinkService/src/main/resources/mapper/KwMeterMapper.xml b/mallinkService/src/main/resources/mapper/KwMeterMapper.xml index 3031b114e..250a06e21 100644 --- a/mallinkService/src/main/resources/mapper/KwMeterMapper.xml +++ b/mallinkService/src/main/resources/mapper/KwMeterMapper.xml @@ -35,11 +35,11 @@ and `kw_meter`.`id` = #{id} - - + + and `kw_meter`.`tenant_id` = #{tenantId} - + and `kw_meter`.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/MallResourceMapper.xml b/mallinkService/src/main/resources/mapper/MallResourceMapper.xml index d6d58e04a..b1f91311a 100644 --- a/mallinkService/src/main/resources/mapper/MallResourceMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallResourceMapper.xml @@ -18,11 +18,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/MallRoleMapper.xml b/mallinkService/src/main/resources/mapper/MallRoleMapper.xml index c4016db3e..dc5ddb38f 100644 --- a/mallinkService/src/main/resources/mapper/MallRoleMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallRoleMapper.xml @@ -20,14 +20,13 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml b/mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml index f6d682bac..3a4669828 100644 --- a/mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml @@ -20,11 +20,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/MallUserActionMapper.xml b/mallinkService/src/main/resources/mapper/MallUserActionMapper.xml index fc0f9ec14..ff447d85f 100644 --- a/mallinkService/src/main/resources/mapper/MallUserActionMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallUserActionMapper.xml @@ -21,10 +21,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml b/mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml index 86856a29b..e23c88ac3 100644 --- a/mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml @@ -35,11 +35,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml b/mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml index 414365736..4974100d3 100644 --- a/mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml +++ b/mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml @@ -20,11 +20,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml b/mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml index 278d9e5ef..01bc453c5 100644 --- a/mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml @@ -20,11 +20,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} @@ -67,8 +67,13 @@ select from pos_mall_config - where 1=1 and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/PosOrderMapper.xml b/mallinkService/src/main/resources/mapper/PosOrderMapper.xml index f56467086..fafb0a642 100644 --- a/mallinkService/src/main/resources/mapper/PosOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/PosOrderMapper.xml @@ -22,11 +22,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml b/mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml index 184b8fe91..dc14c42b9 100644 --- a/mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml @@ -36,11 +36,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/PushLimitMapper.xml b/mallinkService/src/main/resources/mapper/PushLimitMapper.xml index 30e9a1574..59babb1c8 100644 --- a/mallinkService/src/main/resources/mapper/PushLimitMapper.xml +++ b/mallinkService/src/main/resources/mapper/PushLimitMapper.xml @@ -27,11 +27,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml b/mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml index deac3da2a..352aaa387 100644 --- a/mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml @@ -34,10 +34,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxActivityMapper.xml b/mallinkService/src/main/resources/mapper/WxActivityMapper.xml index 81d985971..af6e248f2 100644 --- a/mallinkService/src/main/resources/mapper/WxActivityMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxActivityMapper.xml @@ -43,11 +43,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml b/mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml index 8052c08ca..447b433f2 100644 --- a/mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml @@ -21,14 +21,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - + + + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `url` like concat('%', #{url},'%') diff --git a/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml index 784e0cfba..2a7a273fe 100644 --- a/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml @@ -28,11 +28,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index 7493315b4..74677ba3d 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -64,67 +64,100 @@ endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay from wx_bill_rent - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and is_preview = 0 + where is_preview = 0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay from wx_bill_rent_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay from wx_bill_property - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and is_preview = 0 + where is_preview = 0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay from wx_bill_property_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay - from wx_bill_daily where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_daily where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay from wx_bill_other - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay from wx_bill_other_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) bill left join wx_merchant m on bill.merchant_id=m.id left join wx_shop s on bill.shop_id=s.id where 1=1 - - and bill.tenant_id=#{tenantId} + + and bill.`tenant_id` = #{tenantId} + + + and bill.`parent_tenant_id` = #{parentTenantId} - - and bill.parent_tenant_id=#{parentTenantId} - and date_format(bill.receive_date,'%Y-%m')=#{month} @@ -196,9 +229,13 @@ select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit ) bill - where (bill.tenant_id=#{tenantId} or bill.parent_tenant_id=#{tenantId}) - - and bill.status=#{status} + where bill.status=#{status} + + and bill.`tenant_id` = #{tenantId} + + + and bill.`parent_tenant_id` = #{parentTenantId} + and bill.receive_date between #{starttime} and #{endtime} @@ -253,9 +290,13 @@ select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit ) bill - where (bill.tenant_id=#{tenantId} or bill.parent_tenant_id=#{tenantId}) - - and bill.status=#{status} + where bill.status=#{status} + + and bill.`tenant_id` = #{tenantId} + + + and bill.`parent_tenant_id` = #{parentTenantId} + and bill.receive_date between #{starttime} and #{endtime} @@ -281,8 +322,12 @@ price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay from wx_bill_rent where is_preview = 0 - and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) union all select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' @@ -290,8 +335,13 @@ owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' price_detail,freeze,0 late_pay_price,0 service_charge_pay from wx_bill_rent_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) union all @@ -301,8 +351,12 @@ price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay from wx_bill_property where is_preview = 0 - and tenant_id=#{tenantId} - and parent_tenant_id=#{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and property_contract_id in (select id from wx_property_contract where status in(2,3,4)) @@ -312,8 +366,13 @@ owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,'' price_detail,freeze,0 late_pay_price,0 service_charge_pay from wx_bill_property_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and property_contract_id in (select id from wx_property_contract where status in (2,3,4)) @@ -323,23 +382,37 @@ case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay, pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,starttime,endtime, rent_shop_type,price_detail,freeze,0 late_pay_price,service_charge_pay - from wx_bill_daily where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_daily where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,'' price_detail,freeze,0 late_pay_price,service_charge_pay - from wx_bill_other where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_other where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,'' price_detail,freeze,0 late_pay_price,service_charge_pay - from wx_bill_other_deposit where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - + from wx_bill_other_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,parent_tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay, ((select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join @@ -441,9 +514,13 @@ ,0 pay,0 owe,s.createtime receive_date,'' pay_date,0 expired_day, status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze, 0 late_pay_price,0 service_charge_pay - from wx_bill_settle s where s.tenant_id=#{tenantId} - and s.`parent_tenant_id` = #{parentTenantId} - and s.status >0 + from wx_bill_settle s where s.status >0 + + and s.`tenant_id` = #{tenantId} + + + and s.`parent_tenant_id` = #{parentTenantId} + ) bill left join wx_merchant m on bill.merchant_id=m.id @@ -454,12 +531,12 @@ and bill.id=#{id} - - and bill.tenant_id=#{tenantId} + + and bill.`tenant_id` = #{tenantId} + + + and bill.`parent_tenant_id` = #{parentTenantId} - - and bill.parent_tenant_id=#{parentTenantId} - and bill.merchant_id=#{merchantId} @@ -777,16 +854,25 @@ select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and is_preview = 0 + endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent + where is_preview = 0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and is_preview = 0 + endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where is_preview = 0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.parent_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, @@ -795,21 +881,36 @@ late_pay_price,0 service_charge_pay from( select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date, pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay - from wx_bill_other_deposit where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_other_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) res union all @@ -820,16 +921,25 @@ select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date, expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay - from wx_bill_daily where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and type in(1,2,3) + from wx_bill_daily where type in(1,2,3) + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date, expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay - from wx_bill_other where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_other where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) res @@ -841,8 +951,13 @@ ) bill left join wx_merchant m on bill.merchant_id=m.id - where m.tenant_id = #{tenantId} - and m.`parent_tenant_id` = #{parentTenantId} + where 1=1 + + and m.`tenant_id` = #{tenantId} + + + and m.`parent_tenant_id` = #{parentTenantId} + and m.name like concat('%', #{merchantName},'%') order by ${sortColumns} order by totalOwe desc @@ -950,8 +1065,12 @@ where m.status=1 ) tt where 1=1 - and tt.tenant_id = #{tenantId} - and tt.`parent_tenant_id` = #{parentTenantId} + + and tt.`tenant_id` = #{tenantId} + + + and tt.`parent_tenant_id` = #{parentTenantId} + and tt.id = #{merchantId} and tt.name like concat('%', #{merchantName},'%') and tt.rent_shop_type = #{rentShopType} @@ -971,22 +1090,37 @@ billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0 late_pay_price,0 service_charge_pay - from wx_bill_rent_deposit where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_rent_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 billTypeValue,'物业押金' billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0 late_pay_price,0 service_charge_pay - from wx_bill_property_deposit where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_property_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + union all select id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 billTypeValue,concat('其他押金-',comments) as billType,0 as need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0 late_pay_price,service_charge_pay - from wx_bill_other_deposit where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + from wx_bill_other_deposit where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) bill where 1=1 and bill.freeze = #{freeze} diff --git a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml index 82da7884e..29d4e5ce2 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml @@ -46,9 +46,13 @@ and `receive_date` = #{receiveDate} and `pay_date` = #{payDate} and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + and `expired_day` = #{expiredDay} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `owe` = #{owe} and `status` = #{status} and `is_del` = #{isDel} diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml index b8562bfac..355b5c385 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml @@ -39,8 +39,12 @@ where 1 = 1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `rent_contract_id` = #{rentContractId} and `receive_pay` = #{receivePay} and `pay` = #{pay} @@ -83,8 +87,12 @@ and br.`id` = #{id} and br.`merchant_id` = #{merchantId} and m.`name` like concat('%',#{merchantName},'%') - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + and br.`status` = #{status} and br.`is_del` = #{isDel} and br.`rent_shop_type` = #{rentShopType} @@ -96,8 +104,13 @@ @@ -106,18 +119,33 @@ select round(sum(res.receivepay)/100,2) receivepay,round(sum(res.pay)/100,2) pay,res.tenant_id from ( select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} union all select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} union all select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other_deposit - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} ) res @@ -126,36 +154,61 @@ select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from ( select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent_deposit - where status = 1 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status = 1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} union all select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property_deposit - where status = 1 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status = 1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} union all select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_other_deposit - where status = 1 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status = 1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} ) res update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 + where status!=#{paid} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and status!=5 and DATEDIFF(now(),receive_date)>0 update wx_bill_rent_deposit set status=#{waitPay} where id in( select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br left join wx_rent_contract rc on br.rent_contract_id=rc.id - where br.tenant_id=#{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.status!=#{paid} and br.status!=5 and now() < br.receive_date + where br.status!=#{paid} + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + + and br.status!=5 and now() < br.receive_date and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) diff --git a/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml index 1d27f788e..928bcd575 100644 --- a/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml @@ -41,8 +41,12 @@ where 1 = 1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `receive_pay` = #{receivePay} and `pay` = #{pay} and `receive_date` = #{receiveDate} @@ -103,15 +107,25 @@ update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 + where status!=#{paid} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and status!=5 and DATEDIFF(now(),receive_date)>0 update wx_bill_other_deposit set status=#{waitPay} - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and status!=5 and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 diff --git a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml b/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml index 0b9be3f3d..ebc942c04 100644 --- a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml @@ -40,8 +40,12 @@ where 1 = 1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `receive_pay` = #{receivePay} and `pay` = #{pay} and `receive_date` = #{receiveDate} @@ -102,14 +106,24 @@ update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and status!=#{paid} and DATEDIFF(now(),receive_date)>0 - update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + update wx_bill_other set status=#{waitPay} where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 @@ -118,13 +132,23 @@ select round(sum(t.receivepay)/100,2) receivepay,round(sum(t.pay)/100,2) pay from ( select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} union select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_daily - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and receive_date between #{startdate} and #{enddate} ) t @@ -134,14 +158,24 @@ select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from ( select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and receive_date between #{startdate} and #{enddate} and status = 1 + where status = 1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and receive_date between #{startdate} and #{enddate} union all select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and receive_date between #{startdate} and #{enddate} and status = 1 + where status = 1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and receive_date between #{startdate} and #{enddate} ) res diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml index 58a3fb2f0..109ac079d 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml @@ -39,8 +39,12 @@ where 1 = 1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `property_contract_id` = #{propertyContractId} and `receive_pay` = #{receivePay} and `pay` = #{pay} @@ -84,8 +88,12 @@ left join wx_shop s on br.shop_id=s.id and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + and br.`merchant_id` = #{merchantId} and m.`name` like concat('%',#{merchantName},'%') and br.`status` = #{status} @@ -100,26 +108,40 @@ update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 + where status!=#{paid} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and status!=5 and DATEDIFF(now(),receive_date)>0 update wx_bill_property_deposit set status=#{waitPay} where id in( select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property_deposit br left join wx_property_contract rc on br.property_contract_id=rc.id - where br.tenant_id=#{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.status!=#{paid} and br.status!=5 and now() < br.receive_date + where br.status!=#{paid} + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + + and br.status!=5 and now() < br.receive_date and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 4c4500473..76199d90f 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -56,8 +56,12 @@ where 1=1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `property_contract_id` = #{propertyContractId} and `receive_pay` = #{receivePay} and `pay` = #{pay} @@ -128,27 +132,40 @@ @@ -156,10 +173,14 @@ update wx_bill_property b set b.status=#{notPaid},b.expired_day= DATEDIFF(now(), b.receive_date) - where b.tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and b.status!=#{paid} and b.status!=6 + where b.status!=#{paid} and b.status!=6 and DATEDIFF(now(), b.receive_date) >0 + + and b.`tenant_id` = #{tenantId} + + + and b.`parent_tenant_id` = #{parentTenantId} + @@ -168,8 +189,13 @@ select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property br left join wx_property_contract rc on br.property_contract_id=rc.id - where br.tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + and br.status!=#{paid} and br.status != 6 and now() < br.receive_date and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) @@ -294,9 +320,13 @@ update wx_bill_property set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000),owe=receive_pay + service_charge_pay + ifnull(late_pay_price,0) - pay - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and service_charge_pay=0 and status in(1,2,4) + where service_charge_pay=0 and status in(1,2,4) + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index 5d2766ca8..a0f6b5d44 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -62,8 +62,12 @@ where 1=1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `rent_contract_id` = #{rentContractId} and `receive_pay` = #{receivePay} and `pay` = #{pay} @@ -139,45 +143,68 @@ update wx_bill_rent b set b.status=#{notPaid},b.expired_day= DATEDIFF(now(), b.receive_date) - where b.tenant_id=#{tenantId} - and b.`parent_tenant_id` = #{parentTenantId} - and b.status!=#{paid} and b.status!=6 and + where b.status!=#{paid} and b.status!=6 and DATEDIFF(now(), b.receive_date) >0 + + and b.`tenant_id` = #{tenantId} + + + and b.`parent_tenant_id` = #{parentTenantId} + update wx_bill_rent set status=#{waitPay} where id in( select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent br left join wx_rent_contract rc on br.rent_contract_id=rc.id - where br.tenant_id=#{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.status!=#{paid} and br.status!=6 and now() < br.receive_date + where br.status!=#{paid} + + and br.`tenant_id` = #{tenantId} + + + and br.`parent_tenant_id` = #{parentTenantId} + + and br.status!=6 and now() < br.receive_date and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) diff --git a/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml b/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml index 1328a5597..6c4740fcd 100644 --- a/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml @@ -110,8 +110,12 @@ on(bl.bill_id = bill.id) where 1=1 and bill.`id` = #{billId} - and bl.`tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and bl.`tenant_id` = #{tenantId} + + + and bl.`parent_tenant_id` = #{parentTenantId} + and bl.`settle_id` = #{settleId} and bl.`type` = #{type} diff --git a/mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml b/mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml index 6fa093e82..363b12379 100644 --- a/mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml @@ -26,8 +26,12 @@ where 1=1 and tt.`id` = #{id} - and tt.`tenant_id` = #{tenantId} - and tt.`parent_tenant_id` = #{parentTenantId} + + and tt.`tenant_id` = #{tenantId} + + + and tt.`parent_tenant_id` = #{parentTenantId} + and tt.merchantName like concat('%', #{merchantName},'%') and tt.createtime >= #{starttime} diff --git a/mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml index d120be646..01606f360 100644 --- a/mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml @@ -27,8 +27,12 @@ where 1=1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `settle_id` = #{settleId} diff --git a/mallinkService/src/main/resources/mapper/WxBrandMapper.xml b/mallinkService/src/main/resources/mapper/WxBrandMapper.xml index 5f676aba6..09697bebb 100644 --- a/mallinkService/src/main/resources/mapper/WxBrandMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBrandMapper.xml @@ -24,8 +24,12 @@ and `name` like concat('%',#{name},'%') and `createtime` = #{createtime} and `updatetime` = #{updatetime} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and id in @@ -43,8 +47,12 @@ @@ -52,8 +60,12 @@ select count(*) from wx_brand and `name` = #{name} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and id != #{id} diff --git a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml index 61c11f24c..0eec6cebc 100644 --- a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml @@ -64,10 +64,13 @@ from wx_business b where (select count(*) from wx_merchant m - where - m.tenant_id = #{tenantId} - and m.`parent_tenant_id` = #{parentTenantId} - and b.id = m.business_id + where b.id = m.business_id + + and m.`tenant_id` = #{tenantId} + + + and m.`parent_tenant_id` = #{parentTenantId} + and m.status = 1 and m.is_public = 1) > 0 order by create_date asc @@ -79,10 +82,13 @@ from wx_business b where (select count(*) from wx_coupon_channel cc - where - cc.tenant_id = #{tenantId} - and cc.`parent_tenant_id` = #{parentTenantId} - and b.id = cc.business + where b.id = cc.business + + and cc.`tenant_id` = #{tenantId} + + + and cc.`parent_tenant_id` = #{parentTenantId} + and cc.status = 0 and cc.target_ad = 1) > 0 order by create_date asc diff --git a/mallinkService/src/main/resources/mapper/WxCampaignMapper.xml b/mallinkService/src/main/resources/mapper/WxCampaignMapper.xml index 8deb0cf05..52bf72e2a 100644 --- a/mallinkService/src/main/resources/mapper/WxCampaignMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCampaignMapper.xml @@ -52,11 +52,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml index 6abc8b1ee..2752346b4 100644 --- a/mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml @@ -22,12 +22,11 @@ and `id` = #{id} - - + + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -69,9 +68,13 @@ select count(c.id) carcount,c.create_time from ( select id,DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time - from wx_car_cmd_log where tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and cmd_type=#{cmdType} + from wx_car_cmd_log where cmd_type=#{cmdType} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and create_date BETWEEN #{startdate} and #{enddate} ) c group by c.create_time order by c.create_time @@ -108,12 +123,16 @@ select * from wx_car_cmd_log - where - - and tenant_id = #{tenantId} + where 1=1 + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -169,10 +188,10 @@ select * from wx_car_cmd_log where 1=1 - - and tenant_id = #{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml index a89ad4727..332f58ef6 100644 --- a/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml @@ -51,10 +51,10 @@ and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) <= 15 - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml index ba24f7cef..6eb23e019 100644 --- a/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml @@ -32,10 +32,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -138,10 +138,10 @@ and ci.`id` = #{id} - + and ci.`tenant_id` = #{tenantId} - + and ci.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml b/mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml index eed6fcade..d2c7e28b4 100644 --- a/mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml @@ -35,10 +35,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -113,10 +113,10 @@ update wx_card_spend set `pay_status` = #{payStatus}, `update_date` = #{updateDate} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -151,10 +151,10 @@ and cs.`owner_id` = #{ownerId} - + and cs.`tenant_id` = #{tenantId} - + and cs.`parent_tenant_id` = #{parentTenantId} @@ -197,10 +197,10 @@ and cs.`owner_id` = #{ownerId} - + and cs.`tenant_id` = #{tenantId} - + and cs.`parent_tenant_id` = #{parentTenantId} @@ -246,10 +246,10 @@ and cs.`owner_id` = #{ownerId} - + and cs.`tenant_id` = #{tenantId} - + and cs.`parent_tenant_id` = #{parentTenantId} @@ -332,10 +332,10 @@ and cs.`id` = #{id} - + and cs.`tenant_id` = #{tenantId} - + and cs.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index 3d8866716..7255131ac 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -24,11 +24,10 @@ - - and `tenant_id` = #{tenantId} - - - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} @@ -83,14 +82,22 @@ (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(create_time,'%m/%d')=xTime and c.channel_type=2 - and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) as parkSendCount, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(create_time,'%m/%d')=xTime and c.channel_type=3 - and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) as verifySendCount, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(create_time,'%m/%d')=xTime @@ -99,13 +106,21 @@ (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(create_time,'%m/%d')=xTime and c.channel_type=5 - and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) as orderSendCount from wx_coupon_action_log - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and channel_type in (2,3,4,5) + where channel_type in (2,3,4,5) + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and create_time >= #{startTime} and create_time <= #{endTime} group by xTime @@ -115,9 +130,13 @@ @@ -136,9 +160,13 @@ COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id - where wx_coupon_action_log.tenant_id=#{tenantId} - and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId} - ----- and wx_coupon_order.coupon_order_status = 1 ---- + where 1=1 + + and wx_coupon_action_log.`tenant_id` = #{tenantId} + + + and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId} + and wx_coupon_action_log.create_time >= #{startTime} and wx_coupon_action_log.create_time <= #{endTime} and wx_coupon_action_log.channel_type = #{channelType} @@ -150,9 +178,13 @@ select DATE_FORMAT(create_time,'%Y-%m-%d') as xtime, Count(*) as sendCount from wx_coupon_action_log - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and channel_type=#{channelType} + where channel_type=#{channelType} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and create_time >= #{startTime} @@ -170,9 +202,13 @@ COUNT(co.id) as tempCount from wx_coupon_action_log cal left join wx_coupon_order co on cal.coupon_order_id=co.id - where cal.tenant_id=#{tenantId} - and cal.`parent_tenant_id` = #{parentTenantId} - and co.coupon_order_status = 1 + where co.coupon_order_status = 1 + + and cal.`tenant_id` = #{tenantId} + + + and cal.`parent_tenant_id` = #{parentTenantId} + and cal.create_time >= #{startTime} @@ -187,28 +223,40 @@ @@ -217,8 +265,12 @@ select COUNT(*) FROM wx_coupon_action_log a, wx_coupon_order o WHERE a.coupon_order_id = o.id - AND a.tenant_id = #{tenantId} - and a.`parent_tenant_id` = #{parentTenantId} + + and a.`tenant_id` = #{tenantId} + + + and a.`parent_tenant_id` = #{parentTenantId} + AND o.c_user_id = #{cUserId} AND a.coupon_id = #{couponId} AND date(a.create_time) between date_sub(curdate(),interval #{dayNum} day) and curdate() @@ -228,8 +280,12 @@ select COUNT(*) FROM wx_coupon_action_log a, wx_coupon_order o WHERE a.coupon_order_id = o.id - AND a.tenant_id = #{tenantId} - and a.`parent_tenant_id` = #{parentTenantId} + + and a.`tenant_id` = #{tenantId} + + + and a.`parent_tenant_id` = #{parentTenantId} + AND o.c_user_id = #{cUserId} AND a.coupon_id = #{couponId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml index c48ba2674..39292f331 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml @@ -22,15 +22,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `park_id` = #{parkId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 365e60e2f..5a9b9a9e0 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -40,13 +40,12 @@ and cc.`id` = #{id} - - and (cc.`tenant_id` = #{tenantId} or cc.`parent_tenant_id` = #{tenantId}) + + and cc.`tenant_id` = #{tenantId} - - + and cc.`coupon_id` = #{couponId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml index 5f915fce1..1282716c0 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml @@ -31,15 +31,14 @@ and `id` = #{id} - - - - and `tenant_id`= #{tenantId} - + - - and `parent_tenant_id`= #{parentTenantId} - + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `name` like concat('%', #{name},'%') diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index fc9e43ab7..ba9b30755 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -114,11 +114,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -284,8 +283,12 @@ `remain_inventory` = #{remainInventory}, `inventory` = #{inventory}, `valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays} WHERE 1=1 - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory} @@ -303,11 +306,10 @@ and c.`id` = #{id} - + and c.`tenant_id` = #{tenantId} - - + and c.`parent_tenant_id` = #{parentTenantId} @@ -440,29 +442,49 @@ and if(type=8,put_apply_status =2 or c.id in ( select coupon_id from wx_coupon_channel - where status=0 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status=0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ) ,1=1) and if(type=9,put_apply_status =2 or c.id in ( select coupon_id from wx_coupon_channel - where status=0 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status=0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ),1=1) and if(type=100,put_apply_status =2 or c.id in ( select coupon_id from wx_coupon_channel - where status=0 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status=0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ),1=1) and if(type !=8 and type !=9 and type!=100,put_apply_status =2 or c.id in ( select coupon_id from wx_coupon_channel - where status=0 and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where status=0 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + ),1=1) @@ -917,7 +939,12 @@ max(case type when 11 then model_id else 0 end) groupModelId, max(case type when 12 then model_id else 0 end) pressModelId from wx_flow_config - where type in(9,10,11,12) and tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where type in(9,10,11,12) + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml index ca1b61ff0..ce7d24072 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml @@ -24,11 +24,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 178065ce9..aa9dd403c 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -31,10 +31,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -106,9 +106,13 @@ `b_user_id` = #{bUserId}, `update_date` = #{updateDate}, `verify_type` = #{verifyType} - where `tenant_id`=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and id=#{id} and `b_user_id` is null + where id=#{id} and `b_user_id` is null + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + @@ -117,10 +121,13 @@ `b_user_id` = #{bUserId}, `update_date` = #{updateDate}, `verify_type` = #{verifyType} - where 1=1 - and `tenant_id`=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and id=#{id} + where id=#{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `b_user_id` is null @@ -146,9 +153,13 @@ `b_user_id` = null, `update_date` = #{updateDate}, `verify_type` = null - where `tenant_id`=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and id=#{id} + where id=#{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount from wx_coupon_order c - where c.tenant_id = #{tenantId} - and c.`parent_tenant_id` = #{parentTenantId} - and c.coupon_order_status = 1 + where c.coupon_order_status = 1 + + and c.`tenant_id` = #{tenantId} + + + and c.`parent_tenant_id` = #{parentTenantId} + and c.update_date BETWEEN #{startTime} and #{endTime} @@ -229,8 +257,13 @@ SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order where 1=1 - and tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and coupon_order_status = #{couponOrderStatus} @@ -290,12 +329,12 @@ where 1=1 - - and (co.tenant_id = #{tenantId} or co.parent_tenant_id = #{tenantId}) + + and co.`tenant_id` = #{tenantId} - + and co.coupon_order_status = #{couponOrderStatus} @@ -381,10 +420,10 @@ FROM wx_coupon_order co inner join wx_coupon c on c.id = co.coupon_id where 1=1 - - and co.tenant_id = #{tenantId} + + and co.`tenant_id` = #{tenantId} - + and co.`parent_tenant_id` = #{parentTenantId} @@ -475,10 +514,10 @@ inner join wx_coupon c on c.id = co.coupon_id and c.business = #{businessId} where 1=1 - - and co.tenant_id = #{tenantId} + + and co.`tenant_id` = #{tenantId} - + and co.`parent_tenant_id` = #{parentTenantId} @@ -564,8 +603,13 @@ @@ -749,11 +793,11 @@ and co.coupon_type < 100 - - and co.tenant_id = #{tenantId} + + and co.`tenant_id` = #{tenantId} - - and co.parent_tenant_id = #{parentTenantId} + + and co.`parent_tenant_id` = #{parentTenantId} @@ -1100,10 +1144,14 @@ from wx_coupon_order co inner join wx_coupon c on c.id = co.coupon_id inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id - where co.tenant_id = #{tenantId} - and co.`parent_tenant_id` = #{parentTenantId} - and co.c_user_id = #{cUserId} + where co.c_user_id = #{cUserId} and co.coupon_order_status = 0 + + and co.`tenant_id` = #{tenantId} + + + and co.`parent_tenant_id` = #{parentTenantId} + and cm.merchant_id = #{merchantId} and co.expired_time > now() and c.type in (1, 2, 6) @@ -1113,10 +1161,14 @@ inner join wx_coupon c on c.id = co.coupon_id inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id inner join pos_coupon_order_verify pco on pco.coupon_order_id = co.id - where co.tenant_id = #{tenantId} - and co.`parent_tenant_id` = #{parentTenantId} - and co.c_user_id = #{cUserId} + where co.c_user_id = #{cUserId} and co.coupon_order_status = 100 + + and co.`tenant_id` = #{tenantId} + + + and co.`parent_tenant_id` = #{parentTenantId} + and cm.merchant_id = #{merchantId} and co.expired_time > now() and c.type in (1, 2, 6) @@ -1179,10 +1231,10 @@ and co.c_user_id = #{cUserId} - - and co.tenant_id = #{tenantId} + + and co.`tenant_id` = #{tenantId} - + and co.`parent_tenant_id` = #{parentTenantId} @@ -1254,10 +1306,10 @@ coupon_order_status,create_date,update_date,'' cover_img,title,'' sub_title,'' detail,0 unit, '' remark,amount,remain_amount as remaining_amount,0 support_transfer from wx_card_transfer_info where 1=1 - - and tenant_id = #{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml index 23467c99d..2d03d6d2f 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml @@ -26,11 +26,11 @@ where 1 = 1 and `id` = #{id} - - - and `tenant_id` = #{tenantId} - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} @@ -89,10 +89,10 @@ select from wx_coupon_password - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -130,8 +130,13 @@ @@ -149,9 +154,13 @@ (select count(*) as coupon_count,coupon_id from wx_coupon_password where tenant_id=#{tenantId} and status=0 group by coupon_id) cp inner join wx_coupon c on cp.coupon_id = c.id - where c.tenant_id=#{tenantId} - and c.`parent_tenant_id` = #{parentTenantId} - and c.status=0 and c.put_apply_status in(0,2) + where c.status=0 and c.put_apply_status in(0,2) + + and c.`tenant_id` = #{tenantId} + + + and c.`parent_tenant_id` = #{parentTenantId} + and cp.`coupon_id` = #{couponId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml index 1e14e2cef..d78f46dfb 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml @@ -22,10 +22,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml index b52826c44..aba5a5751 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml @@ -22,15 +22,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `send_type` = #{sendType} diff --git a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml index a2ff42ae4..7c8b56165 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml @@ -46,12 +46,11 @@ and cs.id = #{id} - - and cs.tenant_id = #{tenantId} + + and cs.`tenant_id` = #{tenantId} - - - and cs.parent_tenant_id = #{parentTenantId} + + and cs.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml index ca69cac1a..74e595501 100644 --- a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml @@ -31,10 +31,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -104,11 +104,11 @@ and credit.create_date < #{endTime} - - and credit.tenant_id = #{tenantId} + + and credit.`tenant_id` = #{tenantId} - - and credit.parent_tenant_id = #{parentTenantId} + + and credit.`parent_tenant_id` = #{parentTenantId} and credit.operator_type = #{operatorType} @@ -179,10 +179,10 @@ and `tenant_id` = #{tenantId} - - - and `parent` = #{parent} - - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml index a4b56274c..9122d3137 100644 --- a/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml @@ -27,11 +27,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -96,9 +95,13 @@ update wx_date_amount_record set pay_price=pay_price+#{payPrice} - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and merchant_id=#{merchantId} + where merchant_id=#{merchantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and type=#{type} and date = #{date} diff --git a/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml b/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml index d0f366db8..83ef37792 100644 --- a/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml @@ -31,11 +31,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml index a4ef26636..1918745b8 100644 --- a/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml @@ -21,8 +21,12 @@ where 1=1 and `parent_id` = #{parentId} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `id` = #{id} and `model_id` = #{modelId} and `name` like concat('%', #{name},'%') diff --git a/mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml b/mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml index 96e446b96..9b0eb9a40 100644 --- a/mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml @@ -17,10 +17,10 @@ where 1 = 1 - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} and `id` = #{id} @@ -38,12 +38,12 @@ diff --git a/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml index 996c46662..5305e0662 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml @@ -28,13 +28,12 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - + + and `parent_tenant_id` = #{parentTenantId} + and `phone` = #{phone} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml index dea75008f..b5d78b55c 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml @@ -24,9 +24,13 @@ where 1 = 1 - and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `merchant_id` = #{merchantId} and `corp_papers_type` = #{corpPapersType} and `corp_papers_number` = #{corpPapersNumber} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml index 623b89685..60cf2e203 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml @@ -57,10 +57,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -198,14 +198,13 @@ and m.`id` = #{id} - - - and (m.`tenant_id` = #{tenantId} or m.`parent_tenant_id` = #{tenantId}) - - + and m.`img_url` like concat('%', #{imgUrl},'%') diff --git a/mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml index 05f1e8cb6..f5cc67da4 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml @@ -26,12 +26,11 @@ and `id` = #{id} - - + + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml index 38c5e2529..57c278ca6 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml @@ -23,13 +23,12 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml index d3205ac40..9f213fa8f 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml @@ -33,10 +33,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -113,10 +113,10 @@ update wx_merchant_subsidy set `status` = #{status} where 1=1 - - and `tenant_id`=#{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -179,10 +179,10 @@ and t.`id` = #{id} - + and t.`tenant_id` = #{tenantId} - + and t.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml index 4cf83869a..7d6354051 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml @@ -27,9 +27,13 @@ where 1 = 1 - and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `merchant_id` = #{merchantId} and `taxpayer_type` = #{taxpayerType} and `tax_papers_type` = #{taxPapersType} diff --git a/mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml index 93b0a913b..a58a31de5 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml @@ -24,15 +24,14 @@ and `id` = #{id} - - - - and (`tenant_id` = #{tenantId} or `tenant_id` = #{parentTenantId}) - + - + and `merchant_id` = #{merchantId} @@ -90,11 +89,10 @@ and `report_date` != #{reportDate} - + and `tenant_id` = #{tenantId} - - - + + and `parent_tenant_id` = #{parentTenantId} @@ -143,17 +141,17 @@ left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id where 1 = 1 - - and mtd.tenant_id = #{tenantId} + + and mtd.`tenant_id` = #{tenantId} + + + and mtd.`parent_tenant_id` = #{parentTenantId} and mtd.merchant_id = #{merchantId} - - and mtd.`parent_tenant_id` = #{parentTenantId} - and m.name like concat('%', #{merchantName},'%') @@ -168,9 +166,13 @@ select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms inner join wx_merchant m on ms.merchant_id = m.id inner join wx_shop s on s.id=ms.shop_id - where m.tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and s.is_del=0 + where s.is_del=0 + + and m.`tenant_id` = #{tenantId} + + + and m.`parent_tenant_id` = #{parentTenantId} + and m.business_id in (${businessForRule}) @@ -190,12 +192,11 @@ left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id where 1 = 1 - - and mtd.tenant_id = #{tenantId} - - - - and mtd.`parent_tenant_id` = #{parentTenantId} + + and mtd`tenant_id` = #{tenantId} + + + and mtd`parent_tenant_id` = #{parentTenantId} @@ -220,10 +221,10 @@ from wx_merchant_trade_daily mtd where 1 = 1 - - and mtd.tenant_id = #{tenantId} - - + + and mtd.`tenant_id` = #{tenantId} + + and mtd.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml index 28a27465a..eedf4ddc9 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml @@ -33,12 +33,14 @@ and `id` = #{id} - - - - and (`tenant_id` = #{tenantId} or `parent_tenant_id` = #{tenantId}) - - + + + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `secret` like concat('%', #{secret},'%') @@ -118,8 +120,13 @@ update wx_msg_config set remains = if(remains - #{remains} < 0,0,remains - #{remains}) - where `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxMsgMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgMapper.xml index 3d89b637e..3ff95d12c 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgMapper.xml @@ -36,15 +36,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `model_id` = #{modelId} diff --git a/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml index 6b822dea9..01d3b845f 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml @@ -25,11 +25,11 @@ and `id` = #{id} - - and `tenant_id`=#{tenantId} + + and `tenant_id` = #{tenantId} - - and `parent_tenant_id`=#{parentTenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml index 37111579b..a84a7f254 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml @@ -39,10 +39,10 @@ and `id` = #{id} - - and `tenant_id` = #{tenantId} - - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml index d04ead813..fc05e7cf0 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml @@ -19,15 +19,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `name` like concat('%', #{name},'%') diff --git a/mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml index a90bf73d7..02a0c5462 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml @@ -22,8 +22,12 @@ where 1 = 1 and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `phone` = #{phone} and `expiretime` = #{expiretime} and `createtime` = #{createtime} diff --git a/mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml index d3851cc83..c00709927 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml @@ -35,8 +35,12 @@ and `minutes` = #{minutes} and `model_id` = #{modelId} and `type` = #{type} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `open` = #{open} and `msg_type` = #{msgType} and `role_type` = #{roleType} diff --git a/mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml index 1905dc1a8..0af68a2a8 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml @@ -25,10 +25,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -58,9 +58,13 @@ c.avatar_url avatarUrl,o.id orderId,o.product_id couponId from wx_order o left join wx_c_user c on o.c_user_id=c.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and o.id=#{orderId} + where o.id=#{orderId} + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + @@ -75,9 +79,13 @@ left join wx_coupon c on o.product_id=c.id left join wx_order_group g on o.order_group_id=g.id left join wx_c_user u on o.c_user_id=u.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and c.type=9 + where c.type=9 + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + and o.c_user_id=#{cUserId} @@ -116,12 +124,12 @@ left join (SELECT count(*) verify_count, coupon_id FROM wx_coupon_order WHERE coupon_type = 9 AND coupon_order_status = 1 group by coupon_id ) co on co.coupon_id = c.id left join (SELECT count(*) total_people, product_id FROM wx_order WHERE order_group_id != 0 group by product_id ) o2 on o2.product_id = c.id WHERE type = 9 - - and c.tenant_id=#{tenantId} - - - and c.`parent_tenant_id` = #{parentTenantId} - + + and c.`tenant_id` = #{tenantId} + + + and c.`parent_tenant_id` = #{parentTenantId} + and c.coupon_id=#{couponId} @@ -135,10 +143,10 @@ select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order where coupon_type=9 and coupon_order_status=1 - - and tenant_id=#{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -171,10 +179,10 @@ select count(*) total from wx_order_group where status=11 - - and tenant_id=#{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -215,10 +223,10 @@ select count(*) total from wx_coupon_order where coupon_type=9 and coupon_order_status=1 - - and tenant_id=#{tenantId} + + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -245,10 +253,10 @@ select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount from wx_order o - where o.`tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and o.`type` = #{type} + where o.`type` = #{type} + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + and o.`create_date` BETWEEN #{startTime} and #{endTime} @@ -539,12 +541,12 @@ count(o.id) count, IFNULL (SUM(o.payment),0) amount from wx_order o - where o.`tenant_id` = #{tenantId} - + where 1=1 + and o.`tenant_id` = #{tenantId} - - and `parent_tenant_id` = #{parentTenantId} + + and o.`parent_tenant_id` = #{parentTenantId} and o.`type` = #{type} @@ -652,17 +654,25 @@ c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,1 attribute from wx_order o left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id left join wx_coupon c on o.product_id=c.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and c.type=100 + where c.type=100 + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + union all select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status, c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,2 attribute from wx_order o left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id left join wx_coupon c on o.product_id=c.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and c.type!=100 and o.order_status in(0,1,2,3,4,5) + where c.type!=100 and o.order_status in(0,1,2,3,4,5) + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + and ifnull(press_current_num,0)=0 and ifnull(order_group_id,0)=0 union all select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment, @@ -671,9 +681,13 @@ c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,3 attribute from wx_order o left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id left join wx_coupon c on o.product_id=c.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and c.type=8 and o.press_current_num>0 + where c.type=8 and o.press_current_num>0 + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + union all select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment, case o.order_status when 10 then 1 when 11 then 1 @@ -682,15 +696,19 @@ c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,4 attribute from wx_order o left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id left join wx_coupon c on o.product_id=c.id - where o.tenant_id=#{tenantId} - and o.`parent_tenant_id` = #{parentTenantId} - and c.type=9 and o.order_group_id>0 + where c.type=9 and o.order_group_id>0 + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + ) o - - and o.tenant_id =#{tenantId} + + and o.`tenant_id` = #{tenantId} - + and o.`parent_tenant_id` = #{parentTenantId} @@ -739,10 +757,10 @@ left join wx_merchant m on o.merchant_id=m.id ) o - - and o.tenant_id =#{tenantId} + + and o.`tenant_id` = #{tenantId} - + and o.`parent_tenant_id` = #{parentTenantId} @@ -758,10 +776,10 @@ where o.type in (0,1,2) and o.order_status = #{order_status} ) o - - and o.tenant_id =#{tenantId} + + and o.`tenant_id` = #{tenantId} - + and o.`parent_tenant_id` = #{parentTenantId} @@ -776,12 +794,12 @@ where o.type in (0,1,2) and o.order_status = #{order_status} ) o - - and o.tenant_id =#{tenantId} - - - and o.`parent_tenant_id` = #{parentTenantId} - + + and o.`tenant_id` = #{tenantId} + + + and o.`parent_tenant_id` = #{parentTenantId} + and o.create_date between #{startdate} and #{enddate} @@ -888,10 +906,10 @@ and o.c_user_id = #{cUserId} - - and o.tenant_id = #{tenantId} + + and o.`tenant_id` = #{tenantId} - + and o.`parent_tenant_id` = #{parentTenantId} @@ -910,10 +928,10 @@ and o.c_user_id = #{cUserId} - - and o.tenant_id = #{tenantId} + + and o.`tenant_id` = #{tenantId} - + and o.`parent_tenant_id` = #{parentTenantId} @@ -924,9 +942,13 @@ update wx_order set order_status=#{orderStatus} - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and order_group_id=#{orderGroupId} and order_status=10 + where order_group_id=#{orderGroupId} and order_status=10 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxParkMapper.xml b/mallinkService/src/main/resources/mapper/WxParkMapper.xml index 062bf6608..fd897295b 100644 --- a/mallinkService/src/main/resources/mapper/WxParkMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxParkMapper.xml @@ -29,11 +29,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPayAccountBillMapper.xml b/mallinkService/src/main/resources/mapper/WxPayAccountBillMapper.xml index b2297fc83..164561bf7 100644 --- a/mallinkService/src/main/resources/mapper/WxPayAccountBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPayAccountBillMapper.xml @@ -30,11 +30,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPayBillMapper.xml b/mallinkService/src/main/resources/mapper/WxPayBillMapper.xml index f5521d1de..768cf018f 100644 --- a/mallinkService/src/main/resources/mapper/WxPayBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPayBillMapper.xml @@ -35,10 +35,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPayOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxPayOrderMapper.xml index 25246172c..a0879bc64 100644 --- a/mallinkService/src/main/resources/mapper/WxPayOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPayOrderMapper.xml @@ -46,10 +46,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -154,8 +154,12 @@ from wx_pay_order where 1=1 - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and id not in ( select order_id from wx_profit_sharing_order where create_time>'2019-10-15' ) diff --git a/mallinkService/src/main/resources/mapper/WxPowerBillAutoConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxPowerBillAutoConfigMapper.xml index 4af5be105..6e3832a9e 100644 --- a/mallinkService/src/main/resources/mapper/WxPowerBillAutoConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPowerBillAutoConfigMapper.xml @@ -22,12 +22,11 @@ and `id` = #{id} - - + + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPrepaymentHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxPrepaymentHistoryMapper.xml index e63badce0..bc5d55c77 100644 --- a/mallinkService/src/main/resources/mapper/WxPrepaymentHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPrepaymentHistoryMapper.xml @@ -23,11 +23,11 @@ where 1 = 1 - - and p.`tenant_id` = #{tenantId} + + and `tenant_id` = #{tenantId} - - and p.`parent_tenant_id` = #{parentTenantId} + + and `parent_tenant_id` = #{parentTenantId} and p.`id` = #{id} diff --git a/mallinkService/src/main/resources/mapper/WxPrepaymentMapper.xml b/mallinkService/src/main/resources/mapper/WxPrepaymentMapper.xml index c780ceb06..96be420cd 100644 --- a/mallinkService/src/main/resources/mapper/WxPrepaymentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPrepaymentMapper.xml @@ -26,10 +26,10 @@ where 1 = 1 - + and p.`tenant_id` = #{tenantId} - + and p.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml index ba8ba037f..d960b60b9 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml @@ -30,13 +30,12 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - - + + + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml index b66cf3ef4..2b4ea015b 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml @@ -31,11 +31,10 @@ - + and `tenant_id` = #{tenantId} - - - + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml index 7a2297a38..77e471566 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml @@ -29,11 +29,10 @@ - + and `tenant_id` = #{tenantId} - - - + + and `parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index e03c6500c..ed624e9b9 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -68,8 +68,12 @@ and `rental_end_date` = #{rentalEndDate} and `sign_date` = #{signDate} and `receive_period` = #{receivePeriod} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `filepath` = #{filepath} and `status` = #{status} and `contract_number` = #{contractNumber} diff --git a/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml index 112b7fb7b..088e69081 100644 --- a/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml @@ -31,15 +31,14 @@ and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - - + + + + and `tenant_id` = #{tenantId} + + and `parent_tenant_id` = #{parentTenantId} - + and `create_time` = #{createTime} diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index cb86c4cba..40641b337 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -100,8 +100,12 @@ and `rental_end_date` = #{rentalEndDate} and `sign_date` = #{signDate} and `receive_period` = #{receivePeriod} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and `filepath` = #{filepath} and `status` = #{status} and `contract_number` = #{contractNumber} @@ -196,24 +200,48 @@ @@ -309,16 +337,26 @@ update wx_rent_contract set status=#{status} - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} + where 1=1 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + and id in(select r.id from ( select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and rent_shop_type=1 and status in(0,1) and status!=7)r) @@ -448,9 +486,13 @@ SELECT count(*) FROM wx_rent_contract - WHERE tenant_id = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - AND `status` = #{status} AND status!=7 + WHERE `status` = #{status} AND status!=7 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + AND ( `rent_shop_type` = 1 AND json_contains(json_extract(rent_info, '$[*].shopId'), concat('"', #{shopId}, '"')) diff --git a/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml index bfc051893..2e123583b 100644 --- a/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml @@ -27,11 +27,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -92,10 +91,10 @@ select count(*) from wx_score_history where 1=1 - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -111,10 +110,10 @@ select count(*) from wx_score_history where 1=1 - + and `tenant_id` = #{tenantId} - + and `parent_tenant_id` = #{parentTenantId} @@ -128,9 +127,13 @@ update wx_score_history set c_user_id=#{newUserId} - where tenant_id=#{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and c_user_id = #{cUserId} + where c_user_id = #{cUserId} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxScreenAdMapper.xml b/mallinkService/src/main/resources/mapper/WxScreenAdMapper.xml index eb6a2b7e4..0d44a21bb 100644 --- a/mallinkService/src/main/resources/mapper/WxScreenAdMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxScreenAdMapper.xml @@ -27,11 +27,10 @@ and `id` = #{id} - + and `tenant_id` = #{tenantId} - - + and `parent_tenant_id` = #{parentTenantId} @@ -88,10 +87,10 @@ update wx_screen_ad sa set sa.status = #{status}, sa.update_date = #{updateDate} where sa.target_id = #{targetId} - - and sa.tenant_id = #{tenantId} + + and sa.`tenant_id` = #{tenantId} - + and sa.`parent_tenant_id` = #{parentTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index 6beeca896..fab151fcc 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -46,13 +46,12 @@ and `id` = #{id} - - and (`tenant_id` = #{tenantId} or `parent_tenant_id` = #{tenantId}) + + and `tenant_id` = #{tenantId} - - + and `shop_number` like concat('%', #{shopNumber},'%') @@ -158,12 +157,11 @@ and s.`type` = #{type} - - and s.`tenant_id`= #{tenantId} + + and s.`tenant_id` = #{tenantId} - - - and s.`parent_tenant_id`= #{parentTenantId} + + and s.`parent_tenant_id` = #{parentTenantId} @@ -261,12 +259,11 @@ and s.`id` = #{id} - - and s.`tenant_id`= #{tenantId} + + and s.`tenant_id` = #{tenantId} - - - and s.`parent_tenant_id`= #{parentTenantId} + + and s.`parent_tenant_id` = #{parentTenantId} @@ -350,12 +347,11 @@ and s.`id` = #{id} - - and s.`tenant_id`= #{tenantId} + + and s.`tenant_id` = #{tenantId} - - - and s.`sub_enant_id`= #{parentTenantId} + + and s.`parent_tenant_id` = #{parentTenantId} @@ -445,8 +441,13 @@