Przeglądaj źródła

集团版 bug

release_toaliyun_real
xhxu 5 lat temu
rodzic
commit
6465920f02
4 zmienionych plików z 110 dodań i 43 usunięć
  1. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V2020070131031__GROUP__ADD_001.sql
  2. +69
    -30
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  3. +34
    -11
      mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
  4. +5
    -2
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V2020070131031__GROUP__ADD_001.sql Wyświetl plik

@@ -0,0 +1,2 @@
ALTER TABLE `wx_c_user_basic_info`
ADD COLUMN `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`;

+ 69
- 30
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Wyświetl plik

@@ -14,6 +14,7 @@
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
@@ -27,9 +28,9 @@

<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`
`create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record`
,(select level from wx_level_config
where poins >= points and tenant_id=#{tenantId}
where poins >= points and tenant_id=wcubi.tenant_id
order by points desc limit 1 ) level,status
</sql>

@@ -40,9 +41,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 '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and `phone` like concat('%', #{phone},'%')
@@ -116,7 +120,7 @@
select r.* from (
select
<include refid="allColumns"/>
from wx_c_user_basic_info
from wx_c_user_basic_info wcubi
<include refid="dynamicWhereConditions"/>
) r where 1=1

@@ -132,14 +136,13 @@

<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">
@@ -151,8 +154,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>

@@ -178,8 +184,11 @@
and birthdate is null
</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>
@@ -205,8 +214,11 @@
and poins is null
</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>
@@ -235,8 +247,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 cub.`parent_tenant_id` = #{parentTenantId}
</if>

</select>
@@ -248,8 +263,11 @@
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 cub.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

@@ -261,8 +279,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>
<if test="1 == queryImport">
and create_date like '%00:00:00'
@@ -293,15 +314,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_basic_info 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}
@@ -348,9 +375,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 cu.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and cu.`phone` like concat('%', #{phone},'%')
@@ -434,8 +464,11 @@

<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 cu.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != startTime ">
@@ -521,15 +554,21 @@

<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 cubi.`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 cubi.`parent_tenant_id` = #{parentTenantId}
</if>
</select>



+ 34
- 11
mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml Wyświetl plik

@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserCar">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
@@ -13,7 +14,7 @@
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`
`id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`
</sql>

<sql id="dynamicWhereConditions">
@@ -22,12 +23,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `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 != cUserId ">
and `c_user_id` = #{cUserId}
@@ -82,10 +85,14 @@
<select id="countUser" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Integer">
select count(DISTINCT ubi.id) from wx_c_user_car uc, wx_c_user_basic_info ubi
where uc.c_user_id = ubi.id
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and uc.tenant_id = #{tenantId}
and ubi.tenant_id = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and uc.parent_tenant_id = #{parentTenantId}
and ubi.parent_tenant_id = #{parentTenantId}
</if>
<if test=" null != startTime ">
and ubi.create_date &gt;= #{startTime}
</if>
@@ -96,13 +103,29 @@
</select>
<select id="queryCarCount" parameterType="hashmap" resultType="long">
select count(id) from wx_c_user_car where tenant_id=#{tenantId} and create_date between #{startdate} and #{enddate}
select count(id) from wx_c_user_car 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 between #{startdate} and #{enddate}
</select>

<select id="queryCarCountHistory" resultType="hashmap" parameterType="hashmap">
SELECT count(DISTINCT c.id) count, c.create_time FROM
(SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time FROM wx_c_user_car uc, wx_c_user_basic_info ubi WHERE uc.c_user_id = ubi.id
AND uc.tenant_id = #{tenantId} AND ubi.tenant_id = #{tenantId} AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c
(SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time FROM wx_c_user_car uc, wx_c_user_basic_info ubi
WHERE uc.c_user_id = ubi.id
<if test=" null != tenantId and '' != tenantId">
and uc.tenant_id = #{tenantId}
and ubi.tenant_id = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and uc.parent_tenant_id = #{parentTenantId}
and ubi.parent_tenant_id = #{parentTenantId}
</if>
AND ubi.create_date BETWEEN #{startdate} AND #{enddate}) c
GROUP BY c.create_time ORDER BY c.create_time
</select>
</mapper>

+ 5
- 2
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Wyświetl plik

@@ -66,8 +66,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 '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != openId ">


Ładowanie…
Anuluj
Zapisz