| @@ -26,6 +26,8 @@ public class WxCUser extends TenantEntity { | |||||
| protected Long id; | protected Long id; | ||||
| @io.swagger.annotations.ApiModelProperty(value="userId",name="userId") | |||||
| private Long userId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信openId",name="openId") | @io.swagger.annotations.ApiModelProperty(value="微信openId",name="openId") | ||||
| private String openId; | private String openId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="微信unionId",name="unionId") | @io.swagger.annotations.ApiModelProperty(value="微信unionId",name="unionId") | ||||
| @@ -28,6 +28,8 @@ public class WxCUserBasicInfo extends TenantEntity { | |||||
| @JsonIgnore | @JsonIgnore | ||||
| protected Date scoreDate; | protected Date scoreDate; | ||||
| private String finalTenantId; | |||||
| @Excel(name="姓名",width = 20,orderNum = "1") | @Excel(name="姓名",width = 20,orderNum = "1") | ||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | ||||
| @@ -120,6 +122,14 @@ public class WxCUserBasicInfo extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Date endTime; | private Date endTime; | ||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||||
| private Integer operatorType; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||||
| private Long operatorId; | |||||
| public String getAddressStr() { | public String getAddressStr() { | ||||
| if (address == null) | if (address == null) | ||||
| return null; | return null; | ||||
| @@ -151,5 +151,6 @@ public interface WxCUserBasicInfoService { | |||||
| ResultData updateStatus(WxCUserBasicInfo wxCUserBasicInfo); | ResultData updateStatus(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| WxCUserBasicInfo getByObject(WxCUserBasicInfo wxCUserBasicInfo); | |||||
| } | } | ||||
| @@ -871,6 +871,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| } | } | ||||
| } | } | ||||
| // update 昵称 | // update 昵称 | ||||
| { | { | ||||
| // check c_user 是否存在 | // check c_user 是否存在 | ||||
| @@ -1021,5 +1022,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| wxCUserBasicInfoMapper.updateById(wxCUserBasicInfo); | wxCUserBasicInfoMapper.updateById(wxCUserBasicInfo); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public WxCUserBasicInfo getByObject(WxCUserBasicInfo wxCUserBasicInfo) { | |||||
| try { | |||||
| return wxCUserBasicInfoMapper.selectOne(new QueryWrapper(wxCUserBasicInfo)); | |||||
| } catch (Exception e) { | |||||
| logger.error("NOT found: " + e.getMessage()); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -995,14 +995,7 @@ | |||||
| ifnull(round( | ifnull(round( | ||||
| (select sum(ss.money) from ( | (select sum(ss.money) from ( | ||||
| select ms.subsidy money,mm.id | |||||
| from wx_merchant_subsidy ms | |||||
| left join wx_coupon_order co on co.id = ms.coupon_order_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant mm on mm.id = ms.merchant_id | |||||
| left join wx_card_spend cs on cs.order_id = ms.order_id | |||||
| left join wx_c_user cu on cu.id = cs.owner_id | |||||
| where ms.status = 0 | |||||
| select subsidy money,merchant_id id from wx_merchant_subsidy where status = 0 | |||||
| union all | union all | ||||
| select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | ||||
| union all | union all | ||||
| @@ -1039,14 +1032,7 @@ | |||||
| )/100,2),0)- | )/100,2),0)- | ||||
| ifnull(round( | ifnull(round( | ||||
| (select sum(ss.money) from ( | (select sum(ss.money) from ( | ||||
| select ms.subsidy money,mm.id | |||||
| from wx_merchant_subsidy ms | |||||
| left join wx_coupon_order co on co.id = ms.coupon_order_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant mm on mm.id = ms.merchant_id | |||||
| left join wx_card_spend cs on cs.order_id = ms.order_id | |||||
| left join wx_c_user cu on cu.id = cs.owner_id | |||||
| where ms.order_type in(3,0) and ms.status = 0 | |||||
| select subsidy money,merchant_id id from wx_merchant_subsidy where order_type in(3,0) and status = 0 | |||||
| union all | union all | ||||
| select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | ||||
| union all | union all | ||||
| @@ -15,6 +15,7 @@ | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | ||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | ||||
| <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | <result column="name" jdbcType="VARCHAR" property="name"/> | ||||
| <result column="level" jdbcType="VARCHAR" property="level"/> | <result column="level" jdbcType="VARCHAR" property="level"/> | ||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | ||||
| @@ -28,7 +29,7 @@ | |||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | ||||
| `create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record` | |||||
| `create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`final_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record` | |||||
| ,(select level from wx_level_config | ,(select level from wx_level_config | ||||
| where poins >= points and tenant_id=wcubi.tenant_id | where poins >= points and tenant_id=wcubi.tenant_id | ||||
| order by points desc limit 1 ) level,status | order by points desc limit 1 ) level,status | ||||
| @@ -47,6 +48,9 @@ | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||||
| and `final_tenant_id` = #{finalTenantId} | |||||
| </if> | |||||
| <if test=" null != phone "> | <if test=" null != phone "> | ||||
| and `phone` like concat('%', #{phone},'%') | and `phone` like concat('%', #{phone},'%') | ||||
| @@ -231,7 +235,7 @@ | |||||
| <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumnsOfScoreList"/> | select <include refid="allColumnsOfScoreList"/> | ||||
| from wx_c_user_basic_info cub | from wx_c_user_basic_info cub | ||||
| inner join wx_c_user cu on cu.id = cub.id | |||||
| inner join wx_c_user cu on cu.user_id = cub.id | |||||
| where 1=1 and cub.status=0 | where 1=1 and cub.status=0 | ||||
| @@ -259,7 +263,7 @@ | |||||
| <select id="findBirthdayList" resultMap="BaseResultMap"> | <select id="findBirthdayList" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumnsOfScoreList"/> | select <include refid="allColumnsOfScoreList"/> | ||||
| from wx_c_user_basic_info cub | from wx_c_user_basic_info cub | ||||
| inner join wx_c_user cu on cu.id = cub.id | |||||
| inner join wx_c_user cu on cu.user_id = cub.id | |||||
| where cub.status = 0 and cu.phone is not null | where cub.status = 0 and cu.phone is not null | ||||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | ||||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | ||||
| @@ -554,7 +558,7 @@ | |||||
| <select id="findImportUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findImportUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.id where cu.id is null | |||||
| SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.user_id where cu.id is null | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and cubi.`tenant_id` = #{tenantId} | and cubi.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -564,7 +568,7 @@ | |||||
| </select> | </select> | ||||
| <select id="findGrowUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findGrowUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.id where cu.id is not null | |||||
| SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.user_id where cu.id is not null | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and cubi.`tenant_id` = #{tenantId} | and cubi.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -578,6 +582,6 @@ | |||||
| </update> | </update> | ||||
| <select id="selectNotCUserList" resultMap="BaseResultMap"> | <select id="selectNotCUserList" resultMap="BaseResultMap"> | ||||
| select id,credit from wx_c_user_basic_info cub where not exists (select * from wx_c_user c where c.id=cub.id) and cub.credit is null | |||||
| select id,credit from wx_c_user_basic_info cub where not exists (select * from wx_c_user c where c.user_id=cub.id) and cub.credit is null | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -3,6 +3,7 @@ | |||||
| <mapper namespace="com.iformall.mapper.WxCUserMapper"> | <mapper namespace="com.iformall.mapper.WxCUserMapper"> | ||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUser"> | <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUser"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | ||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | ||||
| <result column="open_id" jdbcType="VARCHAR" property="openId"/> | <result column="open_id" jdbcType="VARCHAR" property="openId"/> | ||||
| @@ -49,7 +50,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`, | |||||
| `id`,`user_id`,`tenant_id`,`parent_tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`, | |||||
| `city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`, | `city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`, | ||||
| `qrcode_source`,`scene`,`scene_address`,`session_key`,`score`, | `qrcode_source`,`scene`,`scene_address`,`session_key`,`score`, | ||||
| `update_date`,`create_date`,`app_id`,`token`,`expire_time`,`latitude`, `longitude`, | `update_date`,`create_date`,`app_id`,`token`,`expire_time`,`latitude`, `longitude`, | ||||
| @@ -66,6 +67,10 @@ | |||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != userId "> | |||||
| and `user_id` = #{userId} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -311,7 +316,7 @@ | |||||
| </select> | </select> | ||||
| <select id="listByChannel" resultMap="BaseResultMap" > | <select id="listByChannel" resultMap="BaseResultMap" > | ||||
| select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||||
| select id,user_id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -128,9 +128,10 @@ | |||||
| ci.`amount`,ci.`sale_amount`,ci.`remaining_amount`,ci.`service_fee_amount`, | ci.`amount`,ci.`sale_amount`,ci.`remaining_amount`,ci.`service_fee_amount`, | ||||
| ci.`share_fee_amount`,ci.`remaining_share_fee_amount`, ci.`rate_amount`, | ci.`share_fee_amount`,ci.`remaining_share_fee_amount`, ci.`rate_amount`, | ||||
| ci.`create_date`,ci.`update_date`, | ci.`create_date`,ci.`update_date`, | ||||
| c.`cover_img`, c.`cover_picture`,c.`detail_picture`,c.`title`, c.`sub_title`, c.`detail`, c.`unit`, c.`remark`, c.`sale_price`, c.`price`, c.`subsidy_type`, c.`subsidy_num`, | |||||
| c.`cover_img`, c.`cover_picture`,c.`detail_picture`,c.`title`, c.`sub_title`, c.`detail`, | |||||
| c.`unit`, c.`remark`, c.`sale_price`, c.`price`, c.`subsidy_type`, c.`subsidy_num`, | |||||
| co.`c_user_id`, co.`owner_id`, co.`expired_time`, co.`coupon_order_status` as status, | co.`c_user_id`, co.`owner_id`, co.`expired_time`, co.`coupon_order_status` as status, | ||||
| cu.`nick_name` as c_nick_name, ou.`nick_name` as o_nick_name, ou.`phone` as ou_phone | |||||
| ou.`nick_name` as c_nick_name, ou.`nick_name` as o_nick_name, ou.`phone` as ou_phone | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicVoWhereConditions"> | <sql id="dynamicVoWhereConditions"> | ||||
| @@ -210,8 +211,7 @@ | |||||
| from wx_card_info ci | from wx_card_info ci | ||||
| left join wx_coupon c on c.id = ci.coupon_id | left join wx_coupon c on c.id = ci.coupon_id | ||||
| left join wx_coupon_order co on co.id = ci.id | left join wx_coupon_order co on co.id = ci.id | ||||
| left join wx_c_user cu on cu.id = co.c_user_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| left join wx_c_user_basic_info ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | <include refid="dynamicVoWhereConditions" /> | ||||
| </select> | </select> | ||||
| @@ -411,7 +411,7 @@ | |||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| left join wx_merchant m on m.id = cs.merchant_id | left join wx_merchant m on m.id = cs.merchant_id | ||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | ||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| left join wx_c_user_basic_info ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | <include refid="dynamicVoWhereConditions"/> | ||||
| order by cs.create_date DESC | order by cs.create_date DESC | ||||
| </select> | </select> | ||||
| @@ -428,7 +428,7 @@ | |||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| left join wx_merchant m on m.id = cs.merchant_id | left join wx_merchant m on m.id = cs.merchant_id | ||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | ||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| left join wx_c_user_basic_info ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | <include refid="dynamicVoWhereConditions"/> | ||||
| group by cs.merchant_id | group by cs.merchant_id | ||||
| </select> | </select> | ||||
| @@ -445,7 +445,7 @@ | |||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| left join wx_merchant m on m.id = cs.merchant_id | left join wx_merchant m on m.id = cs.merchant_id | ||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | ||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| left join wx_c_user_basic_info ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | <include refid="dynamicVoWhereConditions"/> | ||||
| group by cs.owner_id | group by cs.owner_id | ||||
| </select> | </select> | ||||
| @@ -313,7 +313,7 @@ | |||||
| LEFT JOIN wx_coupon_send cs ON cal.channel_id = cs.id | LEFT JOIN wx_coupon_send cs ON cal.channel_id = cs.id | ||||
| LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id | LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id | ||||
| LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | ||||
| LEFT JOIN wx_c_user cu ON cu.id = co.c_user_id | |||||
| LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id | |||||
| LEFT JOIN wx_merchant_b_user mbu ON concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') | LEFT JOIN wx_merchant_b_user mbu ON concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') | ||||
| WHERE cal.channel_type = #{channelType} | WHERE cal.channel_type = #{channelType} | ||||
| AND cs.conditions -> '$.id' = concat(#{merchantId},'') | AND cs.conditions -> '$.id' = concat(#{merchantId},'') | ||||
| @@ -747,7 +747,8 @@ | |||||
| </sql> | </sql> | ||||
| <sql id="allAdminCouponOrderDetailColumns"> | <sql id="allAdminCouponOrderDetailColumns"> | ||||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, | |||||
| co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | ||||
| bu.name, bu.phone as bphone, | bu.name, bu.phone as bphone, | ||||
| cu.phone, | cu.phone, | ||||
| @@ -756,46 +757,31 @@ | |||||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap"> | <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap"> | ||||
| select <include refid="allAdminCouponOrderListColumns" /> | select <include refid="allAdminCouponOrderListColumns" /> | ||||
| <!-- | |||||
| from wx_coupon_order co | |||||
| inner join wx_coupon c on c.id = co.coupon_id | |||||
| inner join (select tco.id as tcoid, | |||||
| (select count(*) from wx_coupon_merchant tcm | |||||
| where tcm.product_id = tco.coupon_id | |||||
| and tcm.status = 0) as mc | |||||
| from wx_coupon_order tco) com on com.tcoid = co.id | |||||
| inner join wx_c_user cu on cu.id=co.c_user_id | |||||
| left join ( | |||||
| select bu.id as bu_id,m.name as verify_merchant_name | |||||
| from wx_merchant_b_user bu inner join wx_merchant m on bu.merchant_id=m.id | |||||
| where bu.tenant_id = #{tenantId} | |||||
| <if test=" null != parentTenantId "> and bu.`parent_tenant_id` = #{parentTenantId} </if> | |||||
| ) bu on bu.bu_id = co.b_user_id | |||||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | |||||
| left join wx_coupon_action_log cal on co.id = cal.coupon_order_id and co.coupon_id = cal.coupon_id | |||||
| --> | |||||
| <!-- | |||||
| from (select wcm.product_id,wcm.merchant_id,count(1) as mc from wx_coupon_merchant wcm where status = 0 and wcm.tenant_id = #{tenantId} group by product_id) couc | |||||
| right join (select co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price from wx_coupon_order co where co.tenant_id = #{tenantId}) co on co.coupon_id = couc.product_id | |||||
| inner join wx_c_user cu on cu.id=co.c_user_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m1 on m1.id = couc.merchant_id | |||||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | |||||
| left join wx_merchant_b_user mbu on mbu.id = co.b_user_id | |||||
| left join wx_merchant m2 on m2.id = mbu.merchant_id | |||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id and cal.coupon_id = co.coupon_id | |||||
| where 1=1--> | |||||
| FROM ( | FROM ( | ||||
| SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc | SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc | ||||
| FROM wx_coupon_merchant wcm | FROM wx_coupon_merchant wcm | ||||
| WHERE STATUS = 0 AND wcm.tenant_id = #{tenantId} GROUP BY product_id) couc | |||||
| WHERE STATUS = 0 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and wcm.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and wcm.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| GROUP BY product_id) couc | |||||
| RIGHT JOIN ( | RIGHT JOIN ( | ||||
| SELECT co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.coupon_type, | SELECT co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.coupon_type, | ||||
| co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price | co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price | ||||
| FROM wx_coupon_order co | |||||
| WHERE co.tenant_id = #{tenantId}) co | |||||
| FROM wx_coupon_order co WHERE 1=1 | |||||
| <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> | |||||
| ) co | |||||
| ON co.coupon_id = couc.product_id | ON co.coupon_id = couc.product_id | ||||
| INNER JOIN wx_c_user cu ON cu.id=co.c_user_id | |||||
| INNER JOIN wx_c_user_basic_info cu ON cu.id=co.c_user_id | |||||
| LEFT JOIN wx_coupon c ON c.id = co.coupon_id | LEFT JOIN wx_coupon c ON c.id = co.coupon_id | ||||
| LEFT JOIN wx_merchant m1 ON m1.id = couc.merchant_id | LEFT JOIN wx_merchant m1 ON m1.id = couc.merchant_id | ||||
| LEFT JOIN wx_merchant_subsidy ms ON co.id = ms.coupon_order_id AND ms.type = 1 | LEFT JOIN wx_merchant_subsidy ms ON co.id = ms.coupon_order_id AND ms.type = 1 | ||||
| @@ -889,7 +875,7 @@ | |||||
| <select id="findDetailOfAdmin" parameterType="java.lang.Long" resultMap="BVoResultMap"> | <select id="findDetailOfAdmin" parameterType="java.lang.Long" resultMap="BVoResultMap"> | ||||
| select <include refid="allAdminCouponOrderDetailColumns" /> | select <include refid="allAdminCouponOrderDetailColumns" /> | ||||
| from wx_coupon c, wx_coupon_order co | from wx_coupon c, wx_coupon_order co | ||||
| left join wx_c_user cu on cu.id = co.c_user_id | |||||
| left join wx_c_user_basic_info cu on cu.id = co.c_user_id | |||||
| left join wx_merchant_b_user bu on co.b_user_id = bu.id | left join wx_merchant_b_user bu on co.b_user_id = bu.id | ||||
| left join wx_merchant m on m.id = bu.merchant_id | left join wx_merchant m on m.id = bu.merchant_id | ||||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | ||||
| @@ -913,7 +899,7 @@ | |||||
| <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> | <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> | ||||
| select <include refid="allBUserOrderedCouponOrderColumns" /> | select <include refid="allBUserOrderedCouponOrderColumns" /> | ||||
| from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm, | |||||
| from wx_coupon_order co,wx_coupon c,wx_c_user_basic_info cu,wx_coupon_merchant cm, | |||||
| (select tco.id as tcoid, | (select tco.id as tcoid, | ||||
| (select count(*) from wx_coupon_merchant tcm | (select count(*) from wx_coupon_merchant tcm | ||||
| where tcm.product_id = tco.coupon_id | where tcm.product_id = tco.coupon_id | ||||
| @@ -938,7 +924,7 @@ | |||||
| <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> | <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> | ||||
| select <include refid="allBUserVerifiedCouponOrderColumns" /> | select <include refid="allBUserVerifiedCouponOrderColumns" /> | ||||
| from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu | |||||
| from wx_coupon_order co,wx_coupon c,wx_c_user_basic_info cu,wx_merchant_b_user bu | |||||
| where co.coupon_id = c.id | where co.coupon_id = c.id | ||||
| and cu.id = co.c_user_id | and cu.id = co.c_user_id | ||||
| and bu.id = co.b_user_id | and bu.id = co.b_user_id | ||||
| @@ -164,7 +164,7 @@ | |||||
| credit.ticket_number ticketNumber, | credit.ticket_number ticketNumber, | ||||
| case when credit.operator_type=4 then (select name from mall_user_info where id=credit.operator_id) | case when credit.operator_type=4 then (select name from mall_user_info where id=credit.operator_id) | ||||
| when credit.operator_type=3 then (select name from wx_merchant_b_user where id=credit.operator_id) | when credit.operator_type=3 then (select name from wx_merchant_b_user where id=credit.operator_id) | ||||
| when credit.operator_type=1 then (select nick_name from wx_c_user where id=credit.operator_id) | |||||
| when credit.operator_type=1 then (select nick_name from wx_c_user_basic_info where id=credit.operator_id) | |||||
| else '' end operator, | else '' end operator, | ||||
| credit.change_purpose changePurpose | credit.change_purpose changePurpose | ||||
| FROM | FROM | ||||
| @@ -427,7 +427,7 @@ | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`, | o.`id`,o.`order_number`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`, | ||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | ||||
| m.name as merchant_name, bu.name, bu.phone as bphone, | m.name as merchant_name, bu.name, bu.phone as bphone, | ||||
| cu.phone, cu.nick_name, cubi.name c_user_name | |||||
| cubi.phone, cubi.nick_name, cubi.name c_user_name | |||||
| </sql> | </sql> | ||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | ||||
| @@ -436,7 +436,6 @@ | |||||
| from wx_order o | from wx_order o | ||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | inner join wx_merchant_b_user bu on bu.id = o.product_id | ||||
| inner join wx_merchant m on m.id = bu.merchant_id | inner join wx_merchant m on m.id = bu.merchant_id | ||||
| 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 | LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id | ||||
| where o.order_status = '1' and o.`type` = 1 | where o.order_status = '1' and o.`type` = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -491,7 +490,7 @@ | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`, | o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`, | ||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | ||||
| m.name as merchant_name, bu.name, bu.phone as bphone, | m.name as merchant_name, bu.name, bu.phone as bphone, | ||||
| cu.phone, cu.nick_name, cubi.name c_user_name, | |||||
| cubi.phone, cubi.nick_name, cubi.name c_user_name, | |||||
| po.id as pay_order_id, po.transaction_id | po.id as pay_order_id, po.transaction_id | ||||
| </sql> | </sql> | ||||
| @@ -502,7 +501,6 @@ | |||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | inner join wx_merchant_b_user bu on bu.id = o.product_id | ||||
| inner join wx_merchant m on m.id = bu.merchant_id | inner join wx_merchant m on m.id = bu.merchant_id | ||||
| left join wx_pay_order po on po.order_id = o.id | left join wx_pay_order po on po.order_id = o.id | ||||
| 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 | LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id | ||||
| where o.order_status = '0' and o.`type` = 1 | where o.order_status = '0' and o.`type` = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -73,7 +73,7 @@ | |||||
| <select id="findPressList" parameterType="com.iformall.domain.vo.WxOrderPressVo" resultMap="VoBaseResultMap"> | <select id="findPressList" parameterType="com.iformall.domain.vo.WxOrderPressVo" resultMap="VoBaseResultMap"> | ||||
| select <include refid="allVoColumns" /> | select <include refid="allVoColumns" /> | ||||
| from wx_order_press op | from wx_order_press op | ||||
| left join wx_c_user cu on cu.id = op.user_id | |||||
| left join wx_c_user_basic_info cu on cu.id = op.user_id | |||||
| where op.`order_id` = #{orderId} | where op.`order_id` = #{orderId} | ||||
| order by op.`create_date` desc | order by op.`create_date` desc | ||||
| </select> | </select> | ||||