| @@ -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{ | |||
| @@ -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<WxMall> mallList = mallService.getSubByParentTenantId(info.getTenantId()); | |||
| @@ -23,12 +23,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -34,12 +34,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -24,11 +24,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -94,12 +93,12 @@ | |||
| from ( | |||
| select merchant_id from kw_merchant_meter | |||
| where `status` = 0 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) | |||
| </select> | |||
| @@ -35,11 +35,11 @@ | |||
| <if test=" null != id "> | |||
| and `kw_meter`.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `kw_meter`.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `kw_meter`.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -18,11 +18,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != bucket "> | |||
| @@ -20,14 +20,13 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != name and '' != name "> | |||
| @@ -20,11 +20,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -21,10 +21,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != userId "> | |||
| @@ -35,11 +35,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -20,11 +20,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponOrderId "> | |||
| @@ -20,11 +20,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != discount "> | |||
| @@ -67,8 +67,13 @@ | |||
| select | |||
| <include refid="allColumns"/> | |||
| from pos_mall_config | |||
| where 1=1 and `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| @@ -22,11 +22,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != posOrderNo "> | |||
| @@ -36,11 +36,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| @@ -27,11 +27,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -34,10 +34,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != name and ''!=name"> | |||
| @@ -43,11 +43,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -21,14 +21,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != url "> | |||
| and `url` like concat('%', #{url},'%') | |||
| @@ -28,11 +28,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and is_preview = 0 | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and is_preview = 0 | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_daily where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) 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 | |||
| <if test=" null != tenantId "> | |||
| and bill.tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and bill.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and bill.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and bill.parent_tenant_id=#{parentTenantId} | |||
| </if> | |||
| <if test=" null != month and ''!=month"> | |||
| and date_format(bill.receive_date,'%Y-%m')=#{month} | |||
| </if> | |||
| @@ -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}) | |||
| <!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>--> | |||
| and bill.status=#{status} | |||
| where bill.status=#{status} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and bill.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and bill.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != starttime and null!= endtime "> | |||
| and bill.receive_date between #{starttime} and #{endtime} | |||
| </if> | |||
| @@ -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}) | |||
| <!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>--> | |||
| and bill.status=#{status} | |||
| where bill.status=#{status} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and bill.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and bill.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != starttime and null!= endtime "> | |||
| and bill.receive_date between #{starttime} and #{endtime} | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and parent_tenant_id=#{parentTenantId}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_daily where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_other where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_other_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and s.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and s.status >0 | |||
| from wx_bill_settle s where s.status >0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) bill | |||
| left join wx_merchant m on bill.merchant_id=m.id | |||
| @@ -454,12 +531,12 @@ | |||
| <if test=" null != id "> | |||
| and bill.id=#{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and bill.tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and bill.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and bill.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and bill.parent_tenant_id=#{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and bill.merchant_id=#{merchantId} | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and is_preview = 0 | |||
| endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and is_preview = 0 | |||
| endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_other_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| ) 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and type in(1,2,3) | |||
| from wx_bill_daily where type in(1,2,3) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_other where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| ) res | |||
| @@ -841,8 +951,13 @@ | |||
| ) bill | |||
| left join wx_merchant m on bill.merchant_id=m.id | |||
| where m.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and m.`parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantName and '' != merchantName">and m.name like concat('%', #{merchantName},'%')</if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by totalOwe desc </if> | |||
| @@ -950,8 +1065,12 @@ | |||
| where m.status=1 | |||
| ) tt where 1=1 | |||
| <if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and tt.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and tt.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and tt.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId"> and tt.id = #{merchantId} </if> | |||
| <if test=" null != merchantName and ''!=merchantName">and tt.name like concat('%', #{merchantName},'%')</if> | |||
| <if test=" null != rentShopType"> and tt.rent_shop_type = #{rentShopType} </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_rent_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_property_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| from wx_bill_other_deposit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) bill | |||
| where 1=1 | |||
| <if test=" null != freeze"> and bill.freeze = #{freeze} </if> | |||
| @@ -46,9 +46,13 @@ | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||
| @@ -39,8 +39,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentContractId "> and `rent_contract_id` = #{rentContractId} </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| @@ -83,8 +87,12 @@ | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if> | |||
| <if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| @@ -96,8 +104,13 @@ | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id,parent_tenant_id from wx_bill_rent_deposit | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| group by tenant_id,parent_tenant_id | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and br.status!=#{paid} and br.status!=5 and now() < br.receive_date | |||
| where br.status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=5 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| @@ -41,8 +41,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||
| @@ -103,15 +107,25 @@ | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| update wx_bill_other_deposit set status=#{waitPay} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| @@ -40,8 +40,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| @@ -102,14 +106,24 @@ | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| update wx_bill_other set status=#{waitPay} where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) t | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and receive_date between #{startdate} and #{enddate} and status = 1 | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and receive_date between #{startdate} and #{enddate} and status = 1 | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| @@ -39,8 +39,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| @@ -84,8 +88,12 @@ | |||
| left join wx_shop s on br.shop_id=s.id | |||
| <where> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| @@ -100,26 +108,40 @@ | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL((sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| where date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| group by tenant_id | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and br.status!=#{paid} and br.status!=5 and now() < br.receive_date | |||
| where br.status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=5 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| @@ -56,8 +56,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| @@ -128,27 +132,40 @@ | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| where is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| group by tenant_id, parent_tenant_id | |||
| </select> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| where receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property | |||
| where status = 1 and tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 | |||
| </select> | |||
| @@ -156,10 +173,14 @@ | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_property b set b.status=#{notPaid},b.expired_day= | |||
| DATEDIFF(now(), b.receive_date) | |||
| where b.tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| and b.status!=#{paid} and b.status!=6 | |||
| where b.status!=#{paid} and b.status!=6 | |||
| and DATEDIFF(now(), b.receive_date) >0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and b.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and b.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=#{paid} and br.status != 6 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| @@ -294,9 +320,13 @@ | |||
| <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill"> | |||
| 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} | |||
| <if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if> | |||
| and service_charge_pay=0 and status in(1,2,4) | |||
| where service_charge_pay=0 and status in(1,2,4) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateOwe"> | |||
| @@ -62,8 +62,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| @@ -139,45 +143,68 @@ | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | |||
| where (tenant_id=#{tenantId} or tenant_id = #{parentTenantId}) | |||
| <!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>--> | |||
| where is_preview = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| and status!=6 | |||
| group by tenant_id | |||
| </select> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| where receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent | |||
| where status = 1 and tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_rent b set b.status=#{notPaid},b.expired_day= | |||
| DATEDIFF(now(), b.receive_date) | |||
| where b.tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and b.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and b.status!=#{paid} and b.status!=6 and | |||
| where b.status!=#{paid} and b.status!=6 and | |||
| DATEDIFF(now(), b.receive_date) >0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and b.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and b.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and br.status!=#{paid} and br.status!=6 and now() < br.receive_date | |||
| where br.status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=6 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| @@ -110,8 +110,12 @@ | |||
| on(bl.bill_id = bill.id) | |||
| where 1=1 | |||
| <if test=" null != billId ">and bill.`id` = #{billId}</if> | |||
| <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and bl.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and bl.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if> | |||
| <if test=" null != type ">and bl.`type` = #{type}</if> | |||
| </select> | |||
| @@ -26,8 +26,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and tt.`id` = #{id}</if> | |||
| <if test=" null != tenantId ">and tt.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and tt.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and tt.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and tt.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantName and merchantName !='' ">and tt.merchantName like concat('%', #{merchantName},'%')</if> | |||
| <if test="starttime != null"> | |||
| and tt.createtime >= #{starttime} | |||
| @@ -27,8 +27,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != settleId ">and `settle_id` = #{settleId}</if> | |||
| <if test=" null != ids "> | |||
| @@ -24,8 +24,12 @@ | |||
| <if test=" null != name "> and `name` like concat('%',#{name},'%') </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -43,8 +47,12 @@ | |||
| <select id="queryBrandByTenant" parameterType="com.iformall.domain.po.WxBrand" resultType="hashmap"> | |||
| select id,`name` value from wx_brand | |||
| <where> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </where> | |||
| </select> | |||
| @@ -52,8 +60,12 @@ | |||
| select count(*) from wx_brand | |||
| <where> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != id"> | |||
| and id != #{id} | |||
| </if> | |||
| @@ -64,10 +64,13 @@ | |||
| from wx_business b | |||
| where | |||
| (select count(*) from wx_merchant m | |||
| where | |||
| m.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId ">and m.`parent_tenant_id` = #{parentTenantId}</if> | |||
| and b.id = m.business_id | |||
| where b.id = m.business_id | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId ">and cc.`parent_tenant_id` = #{parentTenantId}</if> | |||
| and b.id = cc.business | |||
| where b.id = cc.business | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cc.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cc.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and cc.status = 0 | |||
| and cc.target_ad = 1) > 0 | |||
| order by create_date asc | |||
| @@ -52,11 +52,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -22,12 +22,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -69,9 +68,13 @@ | |||
| <select id="queryHistory" resultType="hashmap" parameterType="hashmap"> | |||
| select count(c.id) carcount,c.create_date from ( | |||
| select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date | |||
| from wx_car_cmd_log where (tenant_id = #{tenantId} or parent_tenant_id = #{tenantId}) | |||
| <!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>--> | |||
| and cmd_type=#{cmdType} | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and create_date BETWEEN #{startdate} and #{enddate} | |||
| ) c | |||
| group by c.create_date | |||
| @@ -80,27 +83,39 @@ | |||
| <select id="queryTodayCar" resultType="hashmap" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and cmd_type=#{cmdType} | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and create_date BETWEEN #{startdate} and #{enddate} | |||
| ) c group by c.create_time order by c.create_time | |||
| </select> | |||
| <select id="queryWeekCarPayCount" resultType="Long" parameterType="hashmap"> | |||
| select count(id) | |||
| from wx_car_cmd_log where tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and cmd_type=#{cmdType} | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and create_date BETWEEN #{startdate} and #{enddate} | |||
| </select> | |||
| <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap"> | |||
| select sum(fee) fee,c.create_time from ( | |||
| select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee | |||
| from wx_car_cmd_log where tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and cmd_type=#{cmdType} | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate} | |||
| ) c group by c.create_time order by c.create_time | |||
| </select> | |||
| @@ -108,12 +123,16 @@ | |||
| <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(ccl.create_date,'%Y-%m-%d') xTime, count(ccl.id) triggerCount | |||
| from wx_c_user_car cuc, wx_car_cmd_log ccl | |||
| where cuc.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and cuc`parent_tenant_id` = #{parentTenantId} </if> | |||
| and ccl.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and ccl`parent_tenant_id` = #{parentTenantId} </if> | |||
| and ccl.plateNumber = cuc.car_number | |||
| and cmd_type=#{cmdType} | |||
| where ccl.plateNumber = cuc.car_number and cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cuc.`tenant_id` = #{tenantId} | |||
| and ccl.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cuc.`parent_tenant_id` = #{parentTenantId} | |||
| and ccl.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime and null != endTime"> | |||
| and create_date BETWEEN #{startTime} and #{endTime} | |||
| </if> | |||
| @@ -141,11 +160,11 @@ | |||
| <select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog"> | |||
| select * | |||
| from wx_car_cmd_log | |||
| where | |||
| <if test=" null != tenantId"> | |||
| and tenant_id = #{tenantId} | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cmdType"> | |||
| @@ -169,10 +188,10 @@ | |||
| select * | |||
| from wx_car_cmd_log | |||
| where 1=1 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != plateNumber"> | |||
| @@ -51,10 +51,10 @@ | |||
| <if test=" null != feeTime "> | |||
| and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) <= 15 | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -32,10 +32,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -138,10 +138,10 @@ | |||
| <if test=" null != id "> | |||
| and ci.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and ci.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and ci.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -35,10 +35,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cardId "> | |||
| @@ -113,10 +113,10 @@ | |||
| update wx_card_spend | |||
| set `pay_status` = #{payStatus}, `update_date` = #{updateDate} | |||
| <where> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate"> | |||
| @@ -151,10 +151,10 @@ | |||
| <if test=" null != ownerId "> | |||
| and cs.`owner_id` = #{ownerId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cs.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate"> | |||
| @@ -197,10 +197,10 @@ | |||
| <if test=" null != ownerId "> | |||
| and cs.`owner_id` = #{ownerId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cs.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate"> | |||
| @@ -246,10 +246,10 @@ | |||
| <if test=" null != ownerId "> | |||
| and cs.`owner_id` = #{ownerId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cs.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate"> | |||
| @@ -332,10 +332,10 @@ | |||
| <if test=" null != id "> | |||
| and cs.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cs.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cardId "> | |||
| @@ -24,11 +24,10 @@ | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) as orderSendCount | |||
| from wx_coupon_action_log | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and channel_type in (2,3,4,5) | |||
| where channel_type in (2,3,4,5) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and create_time >= #{startTime} | |||
| and create_time <= #{endTime} | |||
| group by xTime | |||
| @@ -115,9 +130,13 @@ | |||
| <select id="getSceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportTVo" parameterType="hashmap"> | |||
| select create_time_md as xTime, channel_type, count(create_time_md + '' + channel_type) as count | |||
| from wx_coupon_action_log | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and channel_type in (2,3,4,5) | |||
| where channel_type in (2,3,4,5) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and create_time >= #{startTime} | |||
| and create_time <= #{endTime} | |||
| group by create_time_md, channel_type | |||
| @@ -127,8 +146,13 @@ | |||
| <update id="updateCreateTimeMd" parameterType="hashmap"> | |||
| update wx_coupon_action_log | |||
| set create_time_md = DATE_FORMAT(create_time,'%m/%d') | |||
| where tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId} </if> | |||
| ----- and wx_coupon_order.coupon_order_status = 1 ---- | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wx_coupon_action_log.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and channel_type=#{channelType} | |||
| where channel_type=#{channelType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_time >= #{startTime} | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and cal.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and co.coupon_order_status = 1 | |||
| where co.coupon_order_status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cal.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cal.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and cal.create_time >= #{startTime} | |||
| </if> | |||
| @@ -187,28 +223,40 @@ | |||
| <select id="getCountByDateLimit" resultType="java.lang.Integer"> | |||
| select COUNT(*) FROM wx_coupon_action_log | |||
| where tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and `channel_type` != 0 | |||
| where `channel_type` != 0 | |||
| and `channel_type` != 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and `create_time` >= #{startTime} | |||
| and `create_time` <= #{endTime} | |||
| </select> | |||
| <select id="getCountByChannelId" resultType="java.lang.Integer"> | |||
| select COUNT(*) FROM wx_coupon_action_log | |||
| where tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and channel_type = #{channelType} | |||
| where channel_type = #{channelType} | |||
| and channel_id = #{channelId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="getCountByUser" resultType="java.lang.Integer" parameterType="hashmap"> | |||
| select COUNT(*) | |||
| FROM wx_coupon_action_log a, wx_coupon_order o | |||
| WHERE a.coupon_order_id = o.id | |||
| AND a.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and a.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and a.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND o.c_user_id = #{cUserId} | |||
| AND date(a.create_time) = curdate() | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and a.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and a.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and a.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and a.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND o.c_user_id = #{cUserId} | |||
| <if test=" null != couponId "> | |||
| AND a.coupon_id = #{couponId} | |||
| @@ -22,15 +22,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parkId "> | |||
| and `park_id` = #{parkId} | |||
| @@ -40,13 +40,12 @@ | |||
| and cc.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and (cc.`tenant_id` = #{tenantId} or cc.`parent_tenant_id` = #{tenantId}) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cc.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <!--<if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cc.`parent_tenant_id` = #{parentTenantId} | |||
| </if>--> | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and cc.`coupon_id` = #{couponId} | |||
| @@ -31,15 +31,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id`= #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id`= #{parentTenantId} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| @@ -114,11 +114,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -284,8 +283,12 @@ | |||
| `remain_inventory` = #{remainInventory}, `inventory` = #{inventory}, | |||
| `valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays} | |||
| WHERE 1=1 | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory} | |||
| </update> | |||
| @@ -303,11 +306,10 @@ | |||
| and c.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -440,29 +442,49 @@ | |||
| <if test=" null != pressModelId and 0l != pressModelId"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) ,1=1) | |||
| </if> | |||
| <if test=" null != groupModelId and 0l != groupModelId"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ),1=1) | |||
| </if> | |||
| <if test=" null != cardModelId and 0l != cardModelId"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ),1=1) | |||
| </if> | |||
| <if test=" null != couponModelId and 0l != couponModelId"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ),1=1) | |||
| </if> | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where type in(9,10,11,12) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -24,11 +24,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != productId "> | |||
| @@ -31,10 +31,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -106,9 +106,13 @@ | |||
| `b_user_id` = #{bUserId}, | |||
| `update_date` = #{updateDate}, | |||
| `verify_type` = #{verifyType} | |||
| where `tenant_id`=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and id=#{id} and `b_user_id` is null | |||
| where id=#{id} and `b_user_id` is null | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateVerifyCouponOrderStatus" parameterType="com.iformall.domain.po.WxCouponOrder"> | |||
| @@ -117,10 +121,13 @@ | |||
| `b_user_id` = #{bUserId}, | |||
| `update_date` = #{updateDate}, | |||
| `verify_type` = #{verifyType} | |||
| where 1=1 | |||
| and `tenant_id`=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and id=#{id} | |||
| where id=#{id} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null == #{bUserId} "> | |||
| and `b_user_id` is null | |||
| </if> | |||
| @@ -146,9 +153,13 @@ | |||
| `b_user_id` = null, | |||
| `update_date` = #{updateDate}, | |||
| `verify_type` = null | |||
| where `tenant_id`=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and id=#{id} | |||
| where id=#{id} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | |||
| @@ -159,21 +170,34 @@ | |||
| from wx_coupon_order c | |||
| where coupon_order_status=1 | |||
| AND DATE_FORMAT(create_date,'%m/%d')=createTime | |||
| AND tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND c.update_date >= #{startTime} | |||
| AND c.update_date <= #{endTime}) as verifyCount, | |||
| (select Count(DISTINCT c_user_id) | |||
| from wx_coupon_order d | |||
| where coupon_order_status=1 | |||
| AND DATE_FORMAT(create_date,'%m/%d')=createTime | |||
| AND tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND d.update_date >= #{startTime} | |||
| AND d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND create_date >= #{startTime} | |||
| AND create_date <= #{endTime} | |||
| GROUP BY createTime | |||
| @@ -217,9 +241,13 @@ | |||
| <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | |||
| from wx_coupon_order c | |||
| where c.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.coupon_order_status = 1 | |||
| where c.coupon_order_status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime and null != endTime"> | |||
| and c.update_date BETWEEN #{startTime} and #{endTime} | |||
| </if> | |||
| @@ -229,8 +257,13 @@ | |||
| <select id="queryForSceneRepotyHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | |||
| from wx_coupon_order c | |||
| where c.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime and null != endTime"> | |||
| and c.create_date BETWEEN #{startTime} and #{endTime} | |||
| </if> | |||
| @@ -241,9 +274,11 @@ | |||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | |||
| from wx_coupon_order c left join wx_coupon_action_log cal on cal.tenant_id = c.tenant_id | |||
| where cal.coupon_order_id=c.id | |||
| and c.tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != channelType and null != channelType"> | |||
| and cal.channel_type=#{channelType} | |||
| @@ -257,8 +292,12 @@ | |||
| <select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" > | |||
| SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order | |||
| where 1=1 | |||
| <if test=" null != tenantId"> and tenant_id = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponOrderStatus"> | |||
| and coupon_order_status = #{couponOrderStatus} | |||
| </if> | |||
| @@ -290,12 +329,12 @@ | |||
| </if> | |||
| </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId"> | |||
| and (co.tenant_id = #{tenantId} or co.parent_tenant_id = #{tenantId}) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <!--<if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if>--> | |||
| </if> | |||
| <if test=" null != couponOrderStatus"> | |||
| and co.coupon_order_status = #{couponOrderStatus} | |||
| </if> | |||
| @@ -381,10 +420,10 @@ | |||
| FROM wx_coupon_order co | |||
| inner join wx_coupon c on c.id = co.coupon_id | |||
| where 1=1 | |||
| <if test=" null != tenantId"> | |||
| and co.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponOrderStatus"> | |||
| @@ -475,10 +514,10 @@ | |||
| inner join wx_coupon c on c.id = co.coupon_id and c.business = #{businessId} | |||
| </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId"> | |||
| and co.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponOrderStatus"> | |||
| @@ -564,8 +603,13 @@ | |||
| <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price from wx_coupon_order | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | |||
| </select> | |||
| @@ -749,11 +793,11 @@ | |||
| and co.coupon_type < 100 | |||
| </otherwise> | |||
| </choose> | |||
| <if test=" null != tenantId "> | |||
| and co.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and co.parent_tenant_id = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponOrderStatus "> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and co.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and co.c_user_id = #{cUserId} | |||
| where co.c_user_id = #{cUserId} | |||
| and co.coupon_order_status = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and co.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and co.c_user_id = #{cUserId} | |||
| where co.c_user_id = #{cUserId} | |||
| and co.coupon_order_status = 100 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and cm.merchant_id = #{merchantId} | |||
| and co.expired_time > now() | |||
| and c.type in (1, 2, 6) | |||
| @@ -1179,10 +1231,10 @@ | |||
| <if test="cUserId != null"> | |||
| and co.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and co.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="id != null"> | |||
| @@ -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 | |||
| <if test="tenantId != null"> | |||
| and tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="ownerId != null"> | |||
| @@ -26,11 +26,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -89,10 +89,10 @@ | |||
| select <include refid="allColumns" /> | |||
| from wx_coupon_password | |||
| <where> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -130,8 +130,13 @@ | |||
| <select id="findCouponGroupList" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap"> | |||
| select `coupon_id`,`coupon_short` | |||
| from wx_coupon_password | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| group by `coupon_id`,`coupon_short` | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.status=0 and c.put_apply_status in(0,2) | |||
| where c.status=0 and c.put_apply_status in(0,2) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and cp.`coupon_id` = #{couponId} | |||
| </if> | |||
| @@ -22,10 +22,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -22,15 +22,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| @@ -46,12 +46,11 @@ | |||
| and cs.id = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and cs.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cs.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and cs.parent_tenant_id = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| @@ -31,10 +31,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| @@ -104,11 +104,11 @@ | |||
| <if test=" null != endTime"> | |||
| and credit.create_date < #{endTime} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and credit.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and credit.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and credit.parent_tenant_id = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and credit.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != operatorType "> | |||
| and credit.operator_type = #{operatorType} | |||
| @@ -179,10 +179,10 @@ | |||
| <select id="loginCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | |||
| select COUNT(0) from wx_credit_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| @@ -218,10 +218,10 @@ | |||
| select count(0) | |||
| from wx_credit_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| @@ -235,9 +235,13 @@ | |||
| <update id="updateNewId" parameterType="com.iformall.domain.vo.WxCreditHistoryNewIdVo"> | |||
| update wx_credit_history | |||
| set c_user_id=#{newUserId} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and c_user_id = #{cUserId} | |||
| where c_user_id = #{cUserId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <select id="getTotalCreditAmount" parameterType="com.iformall.domain.po.WxCreditHistory" | |||
| @@ -26,12 +26,11 @@ | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parent "> | |||
| and `parent` = #{parent} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -27,11 +27,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != date "> | |||
| @@ -96,9 +95,13 @@ | |||
| <update id="updateAmount" parameterType="com.iformall.domain.po.WxDateAmountRecord"> | |||
| update wx_date_amount_record set pay_price=pay_price+#{payPrice} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and merchant_id=#{merchantId} | |||
| where merchant_id=#{merchantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and type=#{type} and date = #{date} | |||
| </update> | |||
| @@ -31,11 +31,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -21,8 +21,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != parentId ">and `parent_id` = #{parentId}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != modelId"> and `model_id` = #{modelId} </if> | |||
| <if test="null != name and '' != name "> and `name` like concat('%', #{name},'%') </if> | |||
| @@ -17,10 +17,10 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| @@ -38,12 +38,12 @@ | |||
| <select id="getModelBybusiness" parameterType="com.iformall.domain.po.WxFlowModel" resultMap="BaseResultMap"> | |||
| select m.* from wx_flow_config w,wx_flow_model m | |||
| where w.model_id = m.id and w.type = #{flowType} | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and w.tenant_id = #{tenantId} | |||
| and m.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and w.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and w.`parent_tenant_id` = #{parentTenantId} | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -41,10 +41,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != businessId "> | |||
| @@ -21,14 +21,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != gameId "> | |||
| and `game_id` = #{gameId} | |||
| @@ -25,11 +25,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -22,11 +22,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -92,11 +91,10 @@ | |||
| <sql id="allCVoDynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| and lm.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and lm.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and lm.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -22,15 +22,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != mallId "> | |||
| and `mall_id` = #{mallId} | |||
| @@ -26,12 +26,12 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != mallId "> | |||
| and `mall_id` = #{mallId} | |||
| @@ -54,11 +54,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -173,10 +172,10 @@ | |||
| select st.menus | |||
| from mall_sale_type st, wx_mall m | |||
| where st.type = m.sale_type | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| @@ -28,13 +28,12 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != phone "> | |||
| and `phone` = #{phone} | |||
| @@ -24,9 +24,13 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != corpPapersType "> and `corp_papers_type` = #{corpPapersType} </if> | |||
| <if test=" null != corpPapersNumber "> and `corp_papers_number` = #{corpPapersNumber} </if> | |||
| @@ -57,10 +57,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -198,14 +198,13 @@ | |||
| <if test=" null != id "> | |||
| and m.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId "> | |||
| and (m.`tenant_id` = #{tenantId} or m.`parent_tenant_id` = #{tenantId}) | |||
| </if> | |||
| <!--<if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if>--> | |||
| </if> | |||
| <if test=" null != imgUrl "> | |||
| and m.`img_url` like concat('%', #{imgUrl},'%') | |||
| @@ -26,12 +26,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -23,13 +23,12 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -33,10 +33,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != orderId "> | |||
| @@ -113,10 +113,10 @@ | |||
| update wx_merchant_subsidy | |||
| set `status` = #{status} | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id`=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| @@ -179,10 +179,10 @@ | |||
| <if test=" null != id "> | |||
| and t.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and t.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and t.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != orderId "> | |||
| @@ -27,9 +27,13 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != taxpayerType "> and `taxpayer_type` = #{taxpayerType} </if> | |||
| <if test=" null != taxPapersType "> and `tax_papers_type` = #{taxPapersType} </if> | |||
| @@ -24,15 +24,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and (`tenant_id` = #{tenantId} or `tenant_id` = #{parentTenantId}) | |||
| </if> | |||
| </if> | |||
| <!--<if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if>--> | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| @@ -90,11 +89,10 @@ | |||
| and `report_date` != #{reportDate} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -143,17 +141,17 @@ | |||
| left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| and mtd.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and mtd.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and mtd.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and mtd.merchant_id = #{merchantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and mtd.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantName and ''!=merchantName"> | |||
| and m.name like concat('%', #{merchantName},'%') | |||
| </if> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and s.is_del=0 | |||
| where s.is_del=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| @@ -190,12 +192,11 @@ | |||
| left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| and mtd.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and mtd.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and mtd`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and mtd`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| @@ -220,10 +221,10 @@ | |||
| from wx_merchant_trade_daily mtd | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| and mtd.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and mtd.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and mtd.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != reportDate "> | |||
| @@ -33,12 +33,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and (`tenant_id` = #{tenantId} or `parent_tenant_id` = #{tenantId}) | |||
| </if> | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != secret "> | |||
| and `secret` like concat('%', #{secret},'%') | |||
| @@ -118,8 +120,13 @@ | |||
| <update id="updateRemains" parameterType="com.iformall.domain.po.WxMsgConfig"> | |||
| update wx_msg_config set remains = if(remains - #{remains} < 0,0,remains - #{remains}) | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| @@ -36,15 +36,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != modelId "> | |||
| and `model_id` = #{modelId} | |||
| @@ -25,11 +25,11 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id`=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id`=#{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != name and ''!= name"> | |||
| @@ -39,10 +39,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != receiverUserId "> | |||
| @@ -19,15 +19,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| @@ -22,8 +22,12 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != phone "> and `phone` = #{phone} </if> | |||
| <if test=" null != expiretime ">and `expiretime` = #{expiretime}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| @@ -35,8 +35,12 @@ | |||
| <if test=" null != minutes "> and `minutes` = #{minutes} </if> | |||
| <if test=" null != modelId "> and `model_id` = #{modelId} </if> | |||
| <if test=" null != type "> and `type` = #{type} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != open "> and `open` = #{open} </if> | |||
| <if test=" null != msgType "> and `msg_type` = #{msgType} </if> | |||
| <if test=" null != roleType "> and `role_type` = #{roleType} </if> | |||
| @@ -25,10 +25,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != orderId "> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and o.id=#{orderId} | |||
| where o.id=#{orderId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| @@ -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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.type=9 | |||
| where c.type=9 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and o.c_user_id=#{cUserId} | |||
| </if> | |||
| @@ -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 | |||
| <if test=" null != tenantId"> | |||
| and c.tenant_id=#{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != couponId and ''!=couponId"> | |||
| and c.coupon_id=#{couponId} | |||
| </if> | |||
| @@ -135,10 +143,10 @@ | |||
| <select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||
| select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order | |||
| where coupon_type=9 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -153,10 +161,10 @@ | |||
| <select id="queryOrderGroupVerifyCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||
| select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time | |||
| from wx_coupon_order where coupon_type=9 and coupon_order_status=1 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -171,10 +179,10 @@ | |||
| <select id="queryOrderGroupCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) total from wx_order_group | |||
| <where> | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -187,10 +195,10 @@ | |||
| select DATE_FORMAT(create_date,'%Y-%m-%d') xtime,count(*) xcount | |||
| from wx_order_group | |||
| <where> | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -202,10 +210,10 @@ | |||
| <select id="queryOrderGroupSuccessCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) total from wx_order_group where status=11 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -215,10 +223,10 @@ | |||
| <select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) from (select id from wx_order where order_group_id!=0 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -229,10 +237,10 @@ | |||
| <select id="queryOrderGroupVerifyCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) total from wx_coupon_order where coupon_type=9 and coupon_order_status=1 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -245,10 +253,10 @@ | |||
| <select id="queryOrderGroupSuccessPeopleCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) from wx_order where order_status=11 | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| @@ -42,11 +42,10 @@ | |||
| and `order_number` = #{orderNumber} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -151,11 +150,10 @@ | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and o.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -247,10 +245,10 @@ | |||
| <update id="updateOrderGroupStatusByCouponId" parameterType="com.iformall.domain.po.WxOrder"> | |||
| update wx_order set order_status=#{orderStatus},update_date=#{updateDate} | |||
| where product_id=#{productId} and order_status in(10,15) | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| @@ -258,10 +256,10 @@ | |||
| <update id="updateOrderGroupStatusByCouponChannelId" parameterType="com.iformall.domain.po.WxOrder"> | |||
| update wx_order set order_status=#{orderStatus},update_date=#{updateDate} | |||
| where coupon_channel_id=#{couponChannelId} and order_status in(10,15) | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| @@ -319,10 +317,10 @@ | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="orderStatus != null"> | |||
| @@ -341,10 +339,10 @@ | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="id != null"> | |||
| @@ -360,10 +358,10 @@ | |||
| inner join wx_merchant_b_user bu on bu.id = product_id | |||
| inner join wx_merchant m on m.id = bu.merchant_id | |||
| where o.`type` = 1 and o.`order_status` = 1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -438,10 +436,10 @@ | |||
| LEFT JOIN wx_c_user cu on cu.id = o.c_user_id | |||
| LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id | |||
| where o.order_status = '1' and o.`type` = 1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| @@ -525,9 +523,13 @@ | |||
| <select id="queryForSceneRepotyHistory" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount | |||
| from wx_order o | |||
| where o.`tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and o.`type` = #{type} | |||
| where o.`type` = #{type} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime and null != endTime"> | |||
| and o.`create_date` BETWEEN #{startTime} and #{endTime} | |||
| </if> | |||
| @@ -539,12 +541,12 @@ | |||
| count(o.id) count, | |||
| IFNULL (SUM(o.payment),0) amount | |||
| from wx_order o | |||
| where o.`tenant_id` = #{tenantId} | |||
| <if test=" null != tenantId"> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != type"> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.type=100 | |||
| where c.type=100 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| 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) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.type=8 and o.press_current_num>0 | |||
| where c.type=8 and o.press_current_num>0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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} | |||
| <if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if> | |||
| and c.type=9 and o.order_group_id>0 | |||
| where c.type=9 and o.order_group_id>0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) o | |||
| <where> | |||
| <if test="tenantId!=null"> | |||
| and o.tenant_id =#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="title!=null and title!=''"> | |||
| @@ -739,10 +757,10 @@ | |||
| left join wx_merchant m on o.merchant_id=m.id | |||
| ) o | |||
| <where> | |||
| <if test="tenantId!=null"> | |||
| and o.tenant_id =#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="startdate!=null and enddate!=null"> | |||
| @@ -758,10 +776,10 @@ | |||
| where o.type in (0,1,2) and o.order_status = #{order_status} | |||
| ) o | |||
| <where> | |||
| <if test="tenantId!=null"> | |||
| and o.tenant_id =#{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="startdate!=null and enddate!=null"> | |||
| @@ -776,12 +794,12 @@ | |||
| where o.type in (0,1,2) and o.order_status = #{order_status} | |||
| ) o | |||
| <where> | |||
| <if test="tenantId!=null"> | |||
| and o.tenant_id =#{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="startdate!=null and enddate!=null"> | |||
| and o.create_date between #{startdate} and #{enddate} | |||
| </if> | |||
| @@ -888,10 +906,10 @@ | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="orderStatus != null"> | |||
| @@ -910,10 +928,10 @@ | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and o.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="id != null"> | |||
| @@ -924,9 +942,13 @@ | |||
| <update id="updateStatusByOrderGroupId" parameterType="com.iformall.domain.po.WxOrder"> | |||
| update wx_order set order_status=#{orderStatus} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and order_group_id=#{orderGroupId} and order_status=10 | |||
| where order_group_id=#{orderGroupId} and order_status=10 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateOrderStatusForGroup"> | |||
| @@ -29,11 +29,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -30,11 +30,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -35,10 +35,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -46,10 +46,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -154,8 +154,12 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_pay_order | |||
| where 1=1 | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and id not in ( | |||
| select order_id from wx_profit_sharing_order where create_time>'2019-10-15' | |||
| ) | |||
| @@ -22,12 +22,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -23,11 +23,11 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| and p.`tenant_id` = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and p.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != id "> | |||
| and p.`id` = #{id} | |||
| @@ -26,10 +26,10 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and p.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and p.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != id "> | |||
| @@ -30,13 +30,12 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -31,11 +31,10 @@ | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -29,11 +29,10 @@ | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -68,8 +68,12 @@ | |||
| <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | |||
| <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | |||
| <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != filepath ">and `filepath` = #{filepath}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if> | |||
| @@ -31,15 +31,14 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| @@ -100,8 +100,12 @@ | |||
| <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | |||
| <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | |||
| <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != filepath ">and `filepath` = #{filepath}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if> | |||
| @@ -196,24 +200,48 @@ | |||
| </select> | |||
| <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where (tenant_id=#{tenantId} or parent_tenant_id=#{tenantId}) and status=#{status} | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| select count(id) from wx_rent_contract where status=#{status} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType "> | |||
| and rent_shop_type = #{rentShopType} | |||
| </if> | |||
| </select> | |||
| <select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where (tenant_id=#{tenantId} or parent_tenant_id=#{tenantId}) and status=4 | |||
| select count(id) from wx_rent_contract where status=4 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where (tenant_id=#{tenantId} or parent_tenant_id=#{tenantId}) and status in (2,3,4) | |||
| select count(id) from wx_rent_contract where status in (2,3,4) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where (tenant_id=#{tenantId} or parent_tenant_id=#{tenantId}) and status!=0 and status!=1 and status!=6 and | |||
| status!=7 | |||
| and rental_end_date <now() | |||
| select count(id) from wx_rent_contract where status!=0 and status!=1 and status!=6 and status!=7 and rental_end_date <now() | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| @@ -309,16 +337,26 @@ | |||
| <select id="selectRentContractByShopId" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and rent_shop_type =1 | |||
| <if test=" null != status ">and status=#{status} and status!=7</if> | |||
| </select> | |||
| <update id="updateInvalidContract" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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 id="selectRentContractByShopIds" resultType="com.iformall.domain.po.WxRentContract"> | |||
| SELECT rc.id,rc.rental_start_date,rc.rental_end_date,rc.`shop_id`,rc.`rent_shop_type`,rc.`rent_info` FROM | |||
| `wx_rent_contract` rc | |||
| WHERE tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| AND rc.`status` IN (2,3,4) AND status!=7 | |||
| WHERE rc.`status` IN (2,3,4) AND status!=7 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND ( (rc.`rent_shop_type`=2 AND rc.`shop_id` IN | |||
| <foreach collection="shopIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| @@ -463,9 +505,13 @@ | |||
| <select id="selectContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| SELECT count(*) | |||
| FROM wx_rent_contract | |||
| WHERE tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| AND `status` = #{status} AND status!=7 | |||
| WHERE `status` = #{status} AND status!=7 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND ( | |||
| `rent_shop_type` = 1 AND | |||
| json_contains(json_extract(rent_info, '$[*].shopId'), concat('"', #{shopId}, '"')) | |||
| @@ -27,11 +27,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -92,10 +91,10 @@ | |||
| select count(*) | |||
| from wx_score_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| @@ -111,10 +110,10 @@ | |||
| select count(*) | |||
| from wx_score_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| @@ -128,9 +127,13 @@ | |||
| <update id="updateNewId" parameterType="com.iformall.domain.vo.WxScoreHistoryNewIdVo"> | |||
| update wx_score_history | |||
| set c_user_id=#{newUserId} | |||
| where tenant_id=#{tenantId} | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| and c_user_id = #{cUserId} | |||
| where c_user_id = #{cUserId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| </mapper> | |||
| @@ -27,11 +27,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -88,10 +87,10 @@ | |||
| update wx_screen_ad sa | |||
| set sa.status = #{status}, sa.update_date = #{updateDate} | |||
| where sa.target_id = #{targetId} | |||
| <if test=" null != tenantId "> | |||
| and sa.tenant_id = #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and sa.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and sa.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| @@ -46,13 +46,12 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and (`tenant_id` = #{tenantId} or `parent_tenant_id` = #{tenantId}) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <!--<if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if>--> | |||
| </if> | |||
| <if test=" null != shopNumber and ''!=shopNumber"> | |||
| and `shop_number` like concat('%', #{shopNumber},'%') | |||
| @@ -158,12 +157,11 @@ | |||
| and s.`type` = #{type} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and s.`tenant_id`= #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and s.`parent_tenant_id`= #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != status"> | |||
| @@ -261,12 +259,11 @@ | |||
| and s.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and s.`tenant_id`= #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and s.`parent_tenant_id`= #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != shopNumber and ''!=shopNumber"> | |||
| @@ -350,12 +347,11 @@ | |||
| and s.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and s.`tenant_id`= #{tenantId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| and s.`sub_enant_id`= #{parentTenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != shopNumber and ''!=shopNumber"> | |||
| @@ -445,8 +441,13 @@ | |||
| <select id="getShopList" resultType="hashmap" parameterType="hashmap"> | |||
| select id,shop_number shopNumber from wx_shop | |||
| where tenant_id=#{tenantId} and shop_number = #{shopNumber} and is_del=0 | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where shop_number = #{shopNumber} and is_del=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap"> | |||
| @@ -456,14 +457,24 @@ | |||
| from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id | |||
| inner join wx_shop s on ms.shop_id=s.id | |||
| inner join wx_rent_contract c on ms.merchant_id=c.merchant_id | |||
| where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0 | |||
| <if test=" null != parentTenantId "> and ms.`parent_tenant_id` = #{parentTenantId} </if> | |||
| where ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and ms.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and ms.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop | |||
| where tenant_id=#{tenantId} and status=#{status} and is_del=0 | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| where status=#{status} and is_del=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap"> | |||
| @@ -483,9 +494,14 @@ | |||
| </if> | |||
| <if test="null!=status and status==1 and type!=null and type==2"> | |||
| and s.id not in( | |||
| SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(1,2,3,4,8) | |||
| <if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if> | |||
| SELECT shop_id FROM wx_rent_contract WHERE status in(1,2,3,4,8) | |||
| and rent_shop_type=2 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) | |||
| </if> | |||
| <if test=" null != type "> | |||
| @@ -583,8 +599,12 @@ | |||
| ,count(distinct w.shop_id) xCount | |||
| from wx_merchant_shop w left join wx_shop s on w.shop_id=s.id | |||
| where w.is_del=0 | |||
| and w.tenant_id = #{tenantId} | |||
| <if test=" null != parentTenantId "> and w.`parent_tenant_id` = #{parentTenantId} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and w.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and w.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test="building!=null"> | |||
| and s.building=#{building} | |||
| </if> | |||
| @@ -33,11 +33,11 @@ | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| @@ -22,11 +22,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -31,10 +31,10 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -24,12 +24,11 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -24,11 +24,10 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId "> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||