Просмотр исходного кода

集团版第二次bug第一次

release_toaliyun_real
xhxu 5 лет назад
Родитель
Сommit
88b4a8d75e
2 измененных файлов: 161 добавлений и 90 удалений
  1. +136
    -80
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  2. +25
    -10
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 136
- 80
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -26,10 +26,10 @@
</resultMap>

<sql id="allColumns">
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
`create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record`
cub.`id`,cub.`phone`,cub.`birthdate`,cub.`education`,cub.`sex`,cub.`email`,cub.`address`,cub.`poins`,cub.`tag_id`,
cub.`create_date`,cub.`update_date`,cub.`tenant_id`,cub.`name`,cub.`nick_name`,cub.`credit`,cub.`active_time`,cub.`act_record`
,(select level from wx_level_config
where poins >= points and tenant_id=#{tenantId}
where poins >= points and tenant_id=cub.tenant_id
order by points desc limit 1 ) level,status
</sql>

@@ -37,74 +37,77 @@
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
and cub.`id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and `phone` like concat('%', #{phone},'%')
and cub.`phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and `birthdate` = #{birthdate}
and cub.`birthdate` = #{birthdate}
</if>

<if test=" null != education ">
and `education` like concat('%', #{education},'%')
and cub.`education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and `sex` = #{sex}
and cub.`sex` = #{sex}
</if>

<if test=" null != email ">
and `email` like concat('%', #{email},'%')
and cub.`email` like concat('%', #{email},'%')
</if>

<if test=" null != address ">
and `address` like concat('%', #{address},'%')
and cub.`address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and `poins` = #{poins}
and cub.`poins` = #{poins}
</if>

<if test=" null != credit ">
and `credit` = #{credit}
and cub.`credit` = #{credit}
</if>

<if test=" null != tagId ">
and `tag_id` = #{tagId}
and cub.`tag_id` = #{tagId}
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
and cub.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
and cub.`update_date` = #{updateDate}
</if>

<if test=" null != actRecord ">
and `act_record` = #{actRecord}
and cub.`act_record` = #{actRecord}
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')
and cub.`name` like concat('%', #{name},'%')
</if>
<if test=" null != startTime and null!=endTime">
and `create_date` between #{startTime} and #{endTime}
and cub.`create_date` between #{startTime} and #{endTime}
</if>
<if test=" null != status ">
and `status` = #{status}
and cub.`status` = #{status}
</if>
<if test=" null != ids ">
and id in
and cub.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
@@ -116,7 +119,8 @@
select r.* from (
select
<include refid="allColumns"/>
from wx_c_user_basic_info
from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
<include refid="dynamicWhereConditions"/>
) r where 1=1

@@ -132,81 +136,95 @@

<update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
update wx_c_user_basic_info set poins=#{poins}
where phone=#{phone} and tenant_id=#{tenantId}
where phone=#{phone}
and id=#{id}
</update>

<update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
update wx_c_user_basic_info set id=#{newId} , credit=#{credit} , poins=#{poins}
where tenant_id=#{tenantId}
and id = #{id}
where id = #{id}
</update>

<select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info
where sex =#{sex}
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where cub.sex =#{sex}
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>


<select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>

<if test=" null != birthStartTime ">
and birthdate &gt;= #{birthStartTime}
and cub.birthdate &gt;= #{birthStartTime}
</if>

<if test=" null != birthEndTime">
and birthdate &lt;= #{birthEndTime}
and cub.birthdate &lt;= #{birthEndTime}
</if>

<if test=" null == birthStartTime and null == birthEndTime">
and birthdate is null
and cub.birthdate is null
</if>

<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>

<select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>

<if test=" null != levelStartScore ">
and poins &gt;= #{levelStartScore}
and cub.poins &gt;= #{levelStartScore}
</if>

<if test=" null != levelEndScore">
and poins &lt; #{levelEndScore}
and cub.poins &lt; #{levelEndScore}
</if>

<if test=" null == levelStartScore and null == levelEndScore">
and poins is null
and cub.poins is null
</if>

<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>
@@ -235,8 +253,11 @@
and cub.poins is null
</if>

<if test="null != tenantId">
and cub.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>
@@ -248,29 +269,37 @@
where cub.status = 0 and cu.phone is not null
AND DATE_FORMAT(cub.birthdate,'%m-%d') &gt;= #{begin}
AND DATE_FORMAT(cub.birthdate,'%m-%d') &lt;= #{end}
<if test="null != tenantId">
and cub.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{endTime}
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
and cub.create_date &lt; #{endTime}
</if>
<if test="1 == queryImport">
and create_date like '%00:00:00'
and cub.create_date like '%00:00:00'
</if>
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="findCountHistory" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="com.iformall.domain.vo.UserCountVo">
select count(id) as incCount,
select count(cub.id) as incCount,
<if test="1 == reportType ">
date_format(create_date, '%Y-%m-%d') as reportTime,
</if>
@@ -282,35 +311,44 @@
</if>

<if test="1 == reportType or 2 == reportType or 3 == reportType">
(select count(id) from wx_c_user_basic_info
where
(select count(cubi.id) from wx_c_user_basic_info cubi
inner join wx_c_user cu1 on cu1.id = cubi.id
where 1=1
<if test="1 == reportType ">
date_format(create_date, '%Y-%m-%d') &lt;= reportTime
and cubi.date_format(create_date, '%Y-%m-%d') &lt;= reportTime
</if>
<if test="2 == reportType ">
date_format(create_date, '%Y-%m') &lt;= reportTime
and cubi.date_format(create_date, '%Y-%m') &lt;= reportTime
</if>
<if test="3 == reportType ">
date_format(create_date, '%Y') &lt;= reportTime
and cubi.date_format(create_date, '%Y') &lt;= reportTime
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu1.`parent_tenant_id` = #{parentTenantId}
</if>
) as totalCount
</if>

from wx_c_user_basic_info where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{endTime}
and cub.create_date &lt; #{endTime}
</if>
<if test="1 == reportType or 2 == reportType or 3 == reportType">
group by reportTime
group by cub.reportTime
</if>
</select>

@@ -348,9 +386,12 @@
and cu.`id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cu.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and cu.`phone` like concat('%', #{phone},'%')
@@ -415,6 +456,7 @@
select
<include refid="allVoColumns"/>
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions"/>
</select>
@@ -423,6 +465,7 @@
select
count(*)
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions"/>
</select>
@@ -434,8 +477,12 @@

<sql id="filterWhereConditions">
where 1=1
<if test="null != tenantId">
and cu.tenant_id =#{tenantId}

<if test=" null != tenantId and '' != tenantId">
and cu.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != startTime ">
@@ -503,6 +550,7 @@

<select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(*) from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
<if test=" null != tagIds ">
join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
</if>
@@ -512,6 +560,7 @@
<select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
select <include refid="msgColumns"/>
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
<if test=" null != tagIds ">
join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
</if>
@@ -521,15 +570,22 @@

<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
<if test="null != tenantId">
and cubi.tenant_id =#{tenantId}

<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<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
<if test="null != tenantId">
and cubi.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>



+ 25
- 10
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -249,8 +249,11 @@
<if test=" null != endTime">
and create_date &lt; #{endTime}
</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 '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>

@@ -277,15 +280,21 @@
<if test="3 == reportType ">
date_format(create_date, '%Y') &lt;= reportTime
</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 '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) as totalCount
</if>

from wx_c_user 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 and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
@@ -300,8 +309,11 @@

<select id="listByChannel" resultMap="BaseResultMap" >
select id,nick_name,phone,create_date,scene_address from wx_c_user 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 and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
@@ -321,8 +333,11 @@

<select id="countByChannel" resultType="java.lang.Long" >
select count(id) from wx_c_user 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 and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}


Загрузка…
Отмена
Сохранить