Przeglądaj źródła

fix bug

release_toaliyun_real
xiaohanzi 5 lat temu
rodzic
commit
94b7c6cf08
2 zmienionych plików z 84 dodań i 141 usunięć
  1. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/WxCUserCheckSchedule.java
  2. +83
    -140
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml

+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/WxCUserCheckSchedule.java Wyświetl plik

@@ -28,7 +28,7 @@ public class WxCUserCheckSchedule {
@Autowired
private WxCUserMapper cUserMapper;

@Scheduled(cron = "0 0 8 * * ?") // 每天凌晨08:00对c_user扫描查重
//@Scheduled(cron = "0 0 8 * * ?") // 每天凌晨08:00对c_user扫描查重
// @Scheduled(cron = "0 */1 * * * ?") // 测试1分钟一次
public void cuserCheckDuplicate() {



+ 83
- 140
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Wyświetl plik

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

</select>


<select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
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
select count(id) from wx_c_user_basic_info where 1=1
<if test=" null != startTime ">
and cub.create_date &gt;= #{startTime}
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and cub.create_date &lt;= #{endTime}
and create_date &lt;= #{endTime}
</if>

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

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

<if test=" null == birthStartTime and null == birthEndTime">
and cub.birthdate is null
and birthdate is null
</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 test="null != tenantId">
and tenant_id =#{tenantId}
</if>

</select>

<select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
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
select count(id) from wx_c_user_basic_info where 1=1
<if test=" null != startTime ">
and cub.create_date &gt;= #{startTime}
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and cub.create_date &lt;= #{endTime}
and create_date &lt;= #{endTime}
</if>

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

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

<if test=" null == levelStartScore and null == levelEndScore">
and cub.poins is null
and poins is null
</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 test="null != tenantId">
and tenant_id =#{tenantId}
</if>

</select>
@@ -253,11 +235,8 @@
and cub.poins is null
</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 test="null != tenantId">
and cub.tenant_id =#{tenantId}
</if>

</select>
@@ -269,83 +248,66 @@
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 '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
<if test="null != tenantId">
and cub.tenant_id = #{tenantId}
</if>
</select>

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

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

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

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}
from wx_c_user_basic_info where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
</if>
<if test=" null != startTime ">
and cub.create_date &gt;= #{startTime}
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and cub.create_date &lt; #{endTime}
and create_date &lt; #{endTime}
</if>
<if test="1 == reportType or 2 == reportType or 3 == reportType">
group by reportTime
@@ -386,12 +348,9 @@
and cu.`id` = #{id}
</if>

<if test=" null != tenantId and '' != tenantId">
<if test=" null != 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},'%')
@@ -456,7 +415,6 @@
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>
@@ -465,7 +423,6 @@
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>
@@ -477,12 +434,8 @@

<sql id="filterWhereConditions">
where 1=1

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

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

<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>
@@ -560,7 +512,6 @@
<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>
@@ -570,22 +521,15 @@

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

@@ -596,5 +540,4 @@
<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>
</mapper>

</mapper>

Ładowanie…
Anuluj
Zapisz