Browse Source

Merge branch 'dev-xym-update-user' of Server/growth-manager into master

xueyiming 3 weeks ago
parent
commit
bd6b5b2b92

+ 2 - 2
api-module/src/main/java/com/tzld/piaoquan/api/dao/generator/MybatisGeneratorMain.java

@@ -20,9 +20,9 @@ public class MybatisGeneratorMain {
             throws SQLException, IOException, InterruptedException, InvalidConfigurationException, XMLParserException {
         List<String> warnings = new ArrayList<>();
 
-//        File configFile = new File(MybatisGeneratorMain.class.getResource("/mybatis-generator-config.xml").getFile());
+        File configFile = new File(MybatisGeneratorMain.class.getResource("/mybatis-generator-config.xml").getFile());
 //        File configFile = new File(MybatisGeneratorMain.class.getResource("/mybatis-api-generator-config.xml").getFile());
-        File configFile = new File(MybatisGeneratorMain.class.getResource("/mybatis-api-contentPlatform-generator-config.xml").getFile());
+//        File configFile = new File(MybatisGeneratorMain.class.getResource("/mybatis-api-contentPlatform-generator-config.xml").getFile());
         ConfigurationParser cp = new ConfigurationParser(warnings);
         Configuration config = cp.parseConfiguration(configFile);
         DefaultShellCallback callback = new DefaultShellCallback(true);

+ 3 - 2
api-module/src/main/resources/mybatis-generator-config.xml

@@ -50,6 +50,7 @@
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
+            <table tableName="we_com_user" domainObjectName="WeComUser" alias=""/>
 <!--        <table tableName="we_com_alert_message" domainObjectName="AlertMessage" alias=""/>-->
 <!--        <table tableName="gh_detail" domainObjectName="GhDetail" alias=""/>-->
 <!--        <table tableName="we_com_guarantees_video" domainObjectName="GuaranteesVideo" alias=""/>-->
@@ -60,8 +61,8 @@
 <!--        <table tableName="we_com_corp" domainObjectName="Corp" alias=""/>-->
 <!--        <table tableName="we_com_moment_send_message" domainObjectName="MomentSendMessage" alias=""/>-->
 <!--        <table tableName="we_com_staff_with_user" domainObjectName="StaffWithUser" alias=""/>-->
-        <table tableName="we_com_corp_statistics_total" domainObjectName="CorpStatisticsTotal" alias=""/>
-        <table tableName="we_com_staff_statistics_total" domainObjectName="StaffStatisticsTotal" alias=""/>
+<!--        <table tableName="we_com_corp_statistics_total" domainObjectName="CorpStatisticsTotal" alias=""/>-->
+<!--        <table tableName="we_com_staff_statistics_total" domainObjectName="StaffStatisticsTotal" alias=""/>-->
 
 
 

+ 3 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/common/constant/RedisConstant.java

@@ -4,4 +4,7 @@ public interface RedisConstant {
 
     String WE_COM_ACCESS_TOKEN = "WE_COM_ACCESS_TOKEN_%s";
 
+    String WE_COM_USER_AB_TYPE = "WE_COM_USER_AB_TYPE_COUNT";
+
+
 }

+ 11 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/WeComUser.java

@@ -31,6 +31,8 @@ public class WeComUser {
 
     private Long deletedAt;
 
+    private String abtype;
+
     private Date createTime;
 
     private Date updateTime;
@@ -147,6 +149,14 @@ public class WeComUser {
         this.deletedAt = deletedAt;
     }
 
+    public String getAbtype() {
+        return abtype;
+    }
+
+    public void setAbtype(String abtype) {
+        this.abtype = abtype;
+    }
+
     public Date getCreateTime() {
         return createTime;
     }
@@ -183,6 +193,7 @@ public class WeComUser {
         sb.append(", createdAt=").append(createdAt);
         sb.append(", updatedAt=").append(updatedAt);
         sb.append(", deletedAt=").append(deletedAt);
+        sb.append(", abtype=").append(abtype);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);
         sb.append("]");

+ 70 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/WeComUserExample.java

@@ -1,7 +1,6 @@
 package com.tzld.piaoquan.growth.common.model.po;
 
 import com.tzld.piaoquan.growth.common.utils.page.Page;
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -1007,6 +1006,76 @@ public class WeComUserExample {
             return (Criteria) this;
         }
 
+        public Criteria andAbtypeIsNull() {
+            addCriterion("abtype is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeIsNotNull() {
+            addCriterion("abtype is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeEqualTo(String value) {
+            addCriterion("abtype =", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeNotEqualTo(String value) {
+            addCriterion("abtype <>", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeGreaterThan(String value) {
+            addCriterion("abtype >", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeGreaterThanOrEqualTo(String value) {
+            addCriterion("abtype >=", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeLessThan(String value) {
+            addCriterion("abtype <", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeLessThanOrEqualTo(String value) {
+            addCriterion("abtype <=", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeLike(String value) {
+            addCriterion("abtype like", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeNotLike(String value) {
+            addCriterion("abtype not like", value, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeIn(List<String> values) {
+            addCriterion("abtype in", values, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeNotIn(List<String> values) {
+            addCriterion("abtype not in", values, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeBetween(String value1, String value2) {
+            addCriterion("abtype between", value1, value2, "abtype");
+            return (Criteria) this;
+        }
+
+        public Criteria andAbtypeNotBetween(String value1, String value2) {
+            addCriterion("abtype not between", value1, value2, "abtype");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateTimeIsNull() {
             addCriterion("create_time is null");
             return (Criteria) this;

+ 9 - 2
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java

@@ -25,6 +25,7 @@ import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -32,6 +33,7 @@ import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.tzld.piaoquan.growth.common.common.constant.RedisConstant.WE_COM_USER_AB_TYPE;
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.GET_WE_COM_EXTERNAL_CONTACT_GET;
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.POST_WE_COM_ADD_USER_TAG;
 
@@ -65,11 +67,12 @@ public class WeComUserServiceImpl implements WeComUserService {
     @Autowired
     private TagMapper tagMapper;
 
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
     @Value("${needFilterTagIdConfig:[]}")
     private String needFilterTagIdConfig;
 
-    @Autowired
-    private WeComSendService weComSendService;
 
 
     @Override
@@ -122,6 +125,10 @@ public class WeComUserServiceImpl implements WeComUserService {
                 weComUser.setType(type);
                 weComUser.setGender(gender);
                 weComUser.setCorpId(corpId);
+                Long increment = redisTemplate.opsForValue().increment(WE_COM_USER_AB_TYPE);
+                if(increment != null){
+                    weComUser.setAbtype("ab" + increment % 10);
+                }
                 weComUserMapper.insertSelective(weComUser);
                 Long userId = weComUser.getId();
                 if (userId == null) {

+ 480 - 472
common-module/src/main/resources/mapper/WeComUserMapper.xml

@@ -1,498 +1,506 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tzld.piaoquan.growth.common.dao.mapper.WeComUserMapper">
-    <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        <id column="id" jdbcType="BIGINT" property="id"/>
-        <result column="corp_id" jdbcType="BIGINT" property="corpId"/>
-        <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId"/>
-        <result column="union_id" jdbcType="VARCHAR" property="unionId"/>
-        <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty"/>
-        <result column="type" jdbcType="INTEGER" property="type"/>
-        <result column="name" jdbcType="VARCHAR" property="name"/>
-        <result column="avatar" jdbcType="VARCHAR" property="avatar"/>
-        <result column="gender" jdbcType="INTEGER" property="gender"/>
-        <result column="is_delete" jdbcType="INTEGER" property="isDelete"/>
-        <result column="group_msg_disabled" jdbcType="TINYINT" property="groupMsgDisabled"/>
-        <result column="created_at" jdbcType="BIGINT" property="createdAt"/>
-        <result column="updated_at" jdbcType="BIGINT" property="updatedAt"/>
-        <result column="deleted_at" jdbcType="BIGINT" property="deletedAt"/>
-        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
-        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
-    </resultMap>
-    <sql id="Example_Where_Clause">
-        <where>
-            <foreach collection="oredCriteria" item="criteria" separator="or">
-                <if test="criteria.valid">
-                    <trim prefix="(" prefixOverrides="and" suffix=")">
-                        <foreach collection="criteria.criteria" item="criterion">
-                            <choose>
-                                <when test="criterion.noValue">
-                                    and ${criterion.condition}
-                                </when>
-                                <when test="criterion.singleValue">
-                                    and ${criterion.condition} #{criterion.value}
-                                </when>
-                                <when test="criterion.betweenValue">
-                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                                </when>
-                                <when test="criterion.listValue">
-                                    and ${criterion.condition}
-                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
-                                             separator=",">
-                                        #{listItem}
-                                    </foreach>
-                                </when>
-                            </choose>
-                        </foreach>
-                    </trim>
-                </if>
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
+    <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId" />
+    <result column="union_id" jdbcType="VARCHAR" property="unionId" />
+    <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
+    <result column="gender" jdbcType="INTEGER" property="gender" />
+    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
+    <result column="group_msg_disabled" jdbcType="TINYINT" property="groupMsgDisabled" />
+    <result column="created_at" jdbcType="BIGINT" property="createdAt" />
+    <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
+    <result column="deleted_at" jdbcType="BIGINT" property="deletedAt" />
+    <result column="abtype" jdbcType="VARCHAR" property="abtype" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
             </foreach>
-        </where>
-    </sql>
-    <sql id="Update_By_Example_Where_Clause">
-        <where>
-            <foreach collection="example.oredCriteria" item="criteria" separator="or">
-                <if test="criteria.valid">
-                    <trim prefix="(" prefixOverrides="and" suffix=")">
-                        <foreach collection="criteria.criteria" item="criterion">
-                            <choose>
-                                <when test="criterion.noValue">
-                                    and ${criterion.condition}
-                                </when>
-                                <when test="criterion.singleValue">
-                                    and ${criterion.condition} #{criterion.value}
-                                </when>
-                                <when test="criterion.betweenValue">
-                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                                </when>
-                                <when test="criterion.listValue">
-                                    and ${criterion.condition}
-                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
-                                             separator=",">
-                                        #{listItem}
-                                    </foreach>
-                                </when>
-                            </choose>
-                        </foreach>
-                    </trim>
-                </if>
-            </foreach>
-        </where>
-    </sql>
-    <sql id="Base_Column_List">
-        id
-        , corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`,
-    avatar, gender, is_delete, group_msg_disabled, created_at, updated_at, deleted_at, 
-    create_time, update_time
-    </sql>
-    <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample"
-            resultMap="BaseResultMap">
-        select
-        <if test="distinct">
-            distinct
-        </if>
-        <include refid="Base_Column_List"/>
-        from we_com_user
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-        <if test="orderByClause != null">
-            order by ${orderByClause}
-        </if>
-        <if test="page != null">
-            limit #{page.offset} , #{page.pageSize}
+          </trim>
         </if>
-    </select>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-        select
-        <include refid="Base_Column_List"/>
-        from we_com_user
-        where id = #{id,jdbcType=BIGINT}
-    </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-        delete
-        from we_com_user
-        where id = #{id,jdbcType=BIGINT}
-    </delete>
-    <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample">
-        delete from we_com_user
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-    </delete>
-    <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true"
-            keyProperty="id">
-        insert into we_com_user (id, corp_id, external_user_id,
-        union_id, external_user_id_3rd_party, `type`,
-        `name`, avatar, gender,
-        is_delete, group_msg_disabled, created_at,
-        updated_at, deleted_at, create_time,
-        update_time)
-        values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR},
-        #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-        #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
-        #{isDelete,jdbcType=INTEGER}, #{groupMsgDisabled,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT},
-        #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
-        #{updateTime,jdbcType=TIMESTAMP})
-        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-            select LAST_INSERT_ID()
-        </selectKey>
-    </insert>
-    <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser"
-            useGeneratedKeys="true" keyProperty="id">
-        insert into we_com_user
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                id,
-            </if>
-            <if test="corpId != null">
-                corp_id,
-            </if>
-            <if test="externalUserId != null">
-                external_user_id,
-            </if>
-            <if test="unionId != null">
-                union_id,
-            </if>
-            <if test="externalUserId3rdParty != null">
-                external_user_id_3rd_party,
-            </if>
-            <if test="type != null">
-                `type`,
-            </if>
-            <if test="name != null">
-                `name`,
-            </if>
-            <if test="avatar != null">
-                avatar,
-            </if>
-            <if test="gender != null">
-                gender,
-            </if>
-            <if test="isDelete != null">
-                is_delete,
-            </if>
-            <if test="groupMsgDisabled != null">
-                group_msg_disabled,
-            </if>
-            <if test="createdAt != null">
-                created_at,
-            </if>
-            <if test="updatedAt != null">
-                updated_at,
-            </if>
-            <if test="deletedAt != null">
-                deleted_at,
-            </if>
-            <if test="createTime != null">
-                create_time,
-            </if>
-            <if test="updateTime != null">
-                update_time,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                #{id,jdbcType=BIGINT},
-            </if>
-            <if test="corpId != null">
-                #{corpId,jdbcType=BIGINT},
-            </if>
-            <if test="externalUserId != null">
-                #{externalUserId,jdbcType=VARCHAR},
-            </if>
-            <if test="unionId != null">
-                #{unionId,jdbcType=VARCHAR},
-            </if>
-            <if test="externalUserId3rdParty != null">
-                #{externalUserId3rdParty,jdbcType=VARCHAR},
-            </if>
-            <if test="type != null">
-                #{type,jdbcType=INTEGER},
-            </if>
-            <if test="name != null">
-                #{name,jdbcType=VARCHAR},
-            </if>
-            <if test="avatar != null">
-                #{avatar,jdbcType=VARCHAR},
-            </if>
-            <if test="gender != null">
-                #{gender,jdbcType=INTEGER},
-            </if>
-            <if test="isDelete != null">
-                #{isDelete,jdbcType=INTEGER},
-            </if>
-            <if test="groupMsgDisabled != null">
-                #{groupMsgDisabled,jdbcType=TINYINT},
-            </if>
-            <if test="createdAt != null">
-                #{createdAt,jdbcType=BIGINT},
-            </if>
-            <if test="updatedAt != null">
-                #{updatedAt,jdbcType=BIGINT},
-            </if>
-            <if test="deletedAt != null">
-                #{deletedAt,jdbcType=BIGINT},
-            </if>
-            <if test="createTime != null">
-                #{createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateTime != null">
-                #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </trim>
-        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-            select LAST_INSERT_ID()
-        </selectKey>
-    </insert>
-    <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample"
-            resultType="java.lang.Long">
-        select count(*) from we_com_user
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-    </select>
-    <update id="updateByExampleSelective" parameterType="map">
-        update we_com_user
-        <set>
-            <if test="record.id != null">
-                id = #{record.id,jdbcType=BIGINT},
-            </if>
-            <if test="record.corpId != null">
-                corp_id = #{record.corpId,jdbcType=BIGINT},
-            </if>
-            <if test="record.externalUserId != null">
-                external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
-            </if>
-            <if test="record.unionId != null">
-                union_id = #{record.unionId,jdbcType=VARCHAR},
-            </if>
-            <if test="record.externalUserId3rdParty != null">
-                external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
-            </if>
-            <if test="record.type != null">
-                `type` = #{record.type,jdbcType=INTEGER},
-            </if>
-            <if test="record.name != null">
-                `name` = #{record.name,jdbcType=VARCHAR},
-            </if>
-            <if test="record.avatar != null">
-                avatar = #{record.avatar,jdbcType=VARCHAR},
-            </if>
-            <if test="record.gender != null">
-                gender = #{record.gender,jdbcType=INTEGER},
-            </if>
-            <if test="record.isDelete != null">
-                is_delete = #{record.isDelete,jdbcType=INTEGER},
-            </if>
-            <if test="record.groupMsgDisabled != null">
-                group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
-            </if>
-            <if test="record.createdAt != null">
-                created_at = #{record.createdAt,jdbcType=BIGINT},
-            </if>
-            <if test="record.updatedAt != null">
-                updated_at = #{record.updatedAt,jdbcType=BIGINT},
-            </if>
-            <if test="record.deletedAt != null">
-                deleted_at = #{record.deletedAt,jdbcType=BIGINT},
-            </if>
-            <if test="record.createTime != null">
-                create_time = #{record.createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="record.updateTime != null">
-                update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </set>
-        <if test="_parameter != null">
-            <include refid="Update_By_Example_Where_Clause"/>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
         </if>
-    </update>
-    <update id="updateByExample" parameterType="map">
-        update we_com_user
-        set id = #{record.id,jdbcType=BIGINT},
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`, 
+    avatar, gender, is_delete, group_msg_disabled, created_at, updated_at, deleted_at, 
+    abtype, create_time, update_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from we_com_user
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from we_com_user
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from we_com_user
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample">
+    delete from we_com_user
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
+    insert into we_com_user (id, corp_id, external_user_id, 
+      union_id, external_user_id_3rd_party, `type`, 
+      `name`, avatar, gender, 
+      is_delete, group_msg_disabled, created_at, 
+      updated_at, deleted_at, abtype, 
+      create_time, update_time)
+    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, 
+      #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, 
+      #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, 
+      #{isDelete,jdbcType=INTEGER}, #{groupMsgDisabled,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT}, 
+      #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, #{abtype,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+    <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+      select LAST_INSERT_ID()
+    </selectKey>
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
+    insert into we_com_user
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="corpId != null">
+        corp_id,
+      </if>
+      <if test="externalUserId != null">
+        external_user_id,
+      </if>
+      <if test="unionId != null">
+        union_id,
+      </if>
+      <if test="externalUserId3rdParty != null">
+        external_user_id_3rd_party,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="avatar != null">
+        avatar,
+      </if>
+      <if test="gender != null">
+        gender,
+      </if>
+      <if test="isDelete != null">
+        is_delete,
+      </if>
+      <if test="groupMsgDisabled != null">
+        group_msg_disabled,
+      </if>
+      <if test="createdAt != null">
+        created_at,
+      </if>
+      <if test="updatedAt != null">
+        updated_at,
+      </if>
+      <if test="deletedAt != null">
+        deleted_at,
+      </if>
+      <if test="abtype != null">
+        abtype,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="corpId != null">
+        #{corpId,jdbcType=BIGINT},
+      </if>
+      <if test="externalUserId != null">
+        #{externalUserId,jdbcType=VARCHAR},
+      </if>
+      <if test="unionId != null">
+        #{unionId,jdbcType=VARCHAR},
+      </if>
+      <if test="externalUserId3rdParty != null">
+        #{externalUserId3rdParty,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="avatar != null">
+        #{avatar,jdbcType=VARCHAR},
+      </if>
+      <if test="gender != null">
+        #{gender,jdbcType=INTEGER},
+      </if>
+      <if test="isDelete != null">
+        #{isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="groupMsgDisabled != null">
+        #{groupMsgDisabled,jdbcType=TINYINT},
+      </if>
+      <if test="createdAt != null">
+        #{createdAt,jdbcType=BIGINT},
+      </if>
+      <if test="updatedAt != null">
+        #{updatedAt,jdbcType=BIGINT},
+      </if>
+      <if test="deletedAt != null">
+        #{deletedAt,jdbcType=BIGINT},
+      </if>
+      <if test="abtype != null">
+        #{abtype,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+    <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+      select LAST_INSERT_ID()
+    </selectKey>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultType="java.lang.Long">
+    select count(*) from we_com_user
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update we_com_user
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.corpId != null">
         corp_id = #{record.corpId,jdbcType=BIGINT},
+      </if>
+      <if test="record.externalUserId != null">
         external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.unionId != null">
         union_id = #{record.unionId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.externalUserId3rdParty != null">
         external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null">
         `type` = #{record.type,jdbcType=INTEGER},
+      </if>
+      <if test="record.name != null">
         `name` = #{record.name,jdbcType=VARCHAR},
+      </if>
+      <if test="record.avatar != null">
         avatar = #{record.avatar,jdbcType=VARCHAR},
+      </if>
+      <if test="record.gender != null">
         gender = #{record.gender,jdbcType=INTEGER},
+      </if>
+      <if test="record.isDelete != null">
         is_delete = #{record.isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="record.groupMsgDisabled != null">
         group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
+      </if>
+      <if test="record.createdAt != null">
         created_at = #{record.createdAt,jdbcType=BIGINT},
+      </if>
+      <if test="record.updatedAt != null">
         updated_at = #{record.updatedAt,jdbcType=BIGINT},
+      </if>
+      <if test="record.deletedAt != null">
         deleted_at = #{record.deletedAt,jdbcType=BIGINT},
+      </if>
+      <if test="record.abtype != null">
+        abtype = #{record.abtype,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
-        update_time = #{record.updateTime,jdbcType=TIMESTAMP}
-        <if test="_parameter != null">
-            <include refid="Update_By_Example_Where_Clause"/>
-        </if>
-    </update>
-    <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        update we_com_user
-        <set>
-            <if test="corpId != null">
-                corp_id = #{corpId,jdbcType=BIGINT},
-            </if>
-            <if test="externalUserId != null">
-                external_user_id = #{externalUserId,jdbcType=VARCHAR},
-            </if>
-            <if test="unionId != null">
-                union_id = #{unionId,jdbcType=VARCHAR},
-            </if>
-            <if test="externalUserId3rdParty != null">
-                external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
-            </if>
-            <if test="type != null">
-                `type` = #{type,jdbcType=INTEGER},
-            </if>
-            <if test="name != null">
-                `name` = #{name,jdbcType=VARCHAR},
-            </if>
-            <if test="avatar != null">
-                avatar = #{avatar,jdbcType=VARCHAR},
-            </if>
-            <if test="gender != null">
-                gender = #{gender,jdbcType=INTEGER},
-            </if>
-            <if test="isDelete != null">
-                is_delete = #{isDelete,jdbcType=INTEGER},
-            </if>
-            <if test="groupMsgDisabled != null">
-                group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
-            </if>
-            <if test="createdAt != null">
-                created_at = #{createdAt,jdbcType=BIGINT},
-            </if>
-            <if test="updatedAt != null">
-                updated_at = #{updatedAt,jdbcType=BIGINT},
-            </if>
-            <if test="deletedAt != null">
-                deleted_at = #{deletedAt,jdbcType=BIGINT},
-            </if>
-            <if test="createTime != null">
-                create_time = #{createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateTime != null">
-                update_time = #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </set>
-        where id = #{id,jdbcType=BIGINT}
-    </update>
-    <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        update we_com_user
-        set corp_id                    = #{corpId,jdbcType=BIGINT},
-            external_user_id           = #{externalUserId,jdbcType=VARCHAR},
-            union_id                   = #{unionId,jdbcType=VARCHAR},
-            external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
-            `type`                     = #{type,jdbcType=INTEGER},
-            `name`                     = #{name,jdbcType=VARCHAR},
-            avatar                     = #{avatar,jdbcType=VARCHAR},
-            gender                     = #{gender,jdbcType=INTEGER},
-            is_delete                  = #{isDelete,jdbcType=INTEGER},
-            group_msg_disabled         = #{groupMsgDisabled,jdbcType=TINYINT},
-            created_at                 = #{createdAt,jdbcType=BIGINT},
-            updated_at                 = #{updatedAt,jdbcType=BIGINT},
-            deleted_at                 = #{deletedAt,jdbcType=BIGINT},
-            create_time                = #{createTime,jdbcType=TIMESTAMP},
-            update_time                = #{updateTime,jdbcType=TIMESTAMP}
-        where id = #{id,jdbcType=BIGINT}
-    </update>
+      </if>
+      <if test="record.updateTime != null">
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update we_com_user
+    set id = #{record.id,jdbcType=BIGINT},
+      corp_id = #{record.corpId,jdbcType=BIGINT},
+      external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
+      union_id = #{record.unionId,jdbcType=VARCHAR},
+      external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
+      `type` = #{record.type,jdbcType=INTEGER},
+      `name` = #{record.name,jdbcType=VARCHAR},
+      avatar = #{record.avatar,jdbcType=VARCHAR},
+      gender = #{record.gender,jdbcType=INTEGER},
+      is_delete = #{record.isDelete,jdbcType=INTEGER},
+      group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
+      created_at = #{record.createdAt,jdbcType=BIGINT},
+      updated_at = #{record.updatedAt,jdbcType=BIGINT},
+      deleted_at = #{record.deletedAt,jdbcType=BIGINT},
+      abtype = #{record.abtype,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    update we_com_user
+    <set>
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=BIGINT},
+      </if>
+      <if test="externalUserId != null">
+        external_user_id = #{externalUserId,jdbcType=VARCHAR},
+      </if>
+      <if test="unionId != null">
+        union_id = #{unionId,jdbcType=VARCHAR},
+      </if>
+      <if test="externalUserId3rdParty != null">
+        external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="avatar != null">
+        avatar = #{avatar,jdbcType=VARCHAR},
+      </if>
+      <if test="gender != null">
+        gender = #{gender,jdbcType=INTEGER},
+      </if>
+      <if test="isDelete != null">
+        is_delete = #{isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="groupMsgDisabled != null">
+        group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
+      </if>
+      <if test="createdAt != null">
+        created_at = #{createdAt,jdbcType=BIGINT},
+      </if>
+      <if test="updatedAt != null">
+        updated_at = #{updatedAt,jdbcType=BIGINT},
+      </if>
+      <if test="deletedAt != null">
+        deleted_at = #{deletedAt,jdbcType=BIGINT},
+      </if>
+      <if test="abtype != null">
+        abtype = #{abtype,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    update we_com_user
+    set corp_id = #{corpId,jdbcType=BIGINT},
+      external_user_id = #{externalUserId,jdbcType=VARCHAR},
+      union_id = #{unionId,jdbcType=VARCHAR},
+      external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
+      `type` = #{type,jdbcType=INTEGER},
+      `name` = #{name,jdbcType=VARCHAR},
+      avatar = #{avatar,jdbcType=VARCHAR},
+      gender = #{gender,jdbcType=INTEGER},
+      is_delete = #{isDelete,jdbcType=INTEGER},
+      group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
+      created_at = #{createdAt,jdbcType=BIGINT},
+      updated_at = #{updatedAt,jdbcType=BIGINT},
+      deleted_at = #{deletedAt,jdbcType=BIGINT},
+      abtype = #{abtype,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
 
-    <select id="selectIdByExternalUserId" parameterType="String" resultType="Long">
-        select id
-        from we_com_user
-        where external_user_id = #{externalUserId}
-    </select>
+  <select id="selectIdByExternalUserId" parameterType="String" resultType="Long">
+    select id
+    from we_com_user
+    where external_user_id = #{externalUserId}
+  </select>
 
-    <insert id="insertList" parameterType="java.util.List">
-        insert into we_com_user
-        (
-        corp_id,
-        external_user_id,
-        union_id,
-        external_user_id_3rd_party,
-        `type`,
-        `name`,
-        avatar,
-        gender,
-        created_at,
-        updated_at,
-        deleted_at,
-        create_time,
-        update_time
-        )
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.corpId,jdbcType=BIGINT}
-            #{item.externalUserId,jdbcType=VARCHAR},
-            #{item.unionId,jdbcType=VARCHAR},
-            #{item.externalUserId3rdParty,jdbcType=VARCHAR},
-            #{item.type,jdbcType=INTEGER},
-            #{item.name,jdbcType=VARCHAR},
-            #{item.avatar,jdbcType=VARCHAR},
-            #{item.gender,jdbcType=INTEGER},
-            #{item.createdAt,jdbcType=BIGINT},
-            #{item.updatedAt,jdbcType=BIGINT},
-            #{item.deletedAt,jdbcType=BIGINT},
-            #{item.createTime,jdbcType=TIMESTAMP},
-            #{item.updateTime,jdbcType=TIMESTAMP}
-            )
-        </foreach>
-    </insert>
+  <insert id="insertList" parameterType="java.util.List">
+    insert into we_com_user
+    (
+    corp_id,
+    external_user_id,
+    union_id,
+    external_user_id_3rd_party,
+    `type`,
+    `name`,
+    avatar,
+    gender,
+    created_at,
+    updated_at,
+    deleted_at,
+    abtype,
+    create_time,
+    update_time
+    )
+    values
+    <foreach collection="list" item="item" separator=",">
+      (
+      #{item.corpId,jdbcType=BIGINT}
+      #{item.externalUserId,jdbcType=VARCHAR},
+      #{item.unionId,jdbcType=VARCHAR},
+      #{item.externalUserId3rdParty,jdbcType=VARCHAR},
+      #{item.type,jdbcType=INTEGER},
+      #{item.name,jdbcType=VARCHAR},
+      #{item.avatar,jdbcType=VARCHAR},
+      #{item.gender,jdbcType=INTEGER},
+      #{item.createdAt,jdbcType=BIGINT},
+      #{item.updatedAt,jdbcType=BIGINT},
+      #{item.deletedAt,jdbcType=BIGINT},
+      #{item.abtype,jdbcType=VARCHAR},
+      #{item.createTime,jdbcType=TIMESTAMP},
+      #{item.updateTime,jdbcType=TIMESTAMP}
+      )
+    </foreach>
+  </insert>
 
+  <select id="selectUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    select t1.*
+    from we_com_user t1
+    left join we_com_staff_with_user t2 on t1.id = t2.user_id
+    where t1.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
+    and t2.staff_id = #{staffId,jdbcType=BIGINT}
+    and t2.is_delete = 0
+    <if test="filterTagIdList != null and filterTagIdList.size() > 0">
+      and t1.id not in (
+      select t2.id
+      from we_com_user_with_tag t1
+      join we_com_user t2 on t1.user_id = t2.id
+      where t1.tag_id in
+      <foreach item="item" index="index" collection="filterTagIdList"
+               open="(" separator="," close=")">
+        #{item}
+      </foreach>
+      )
+    </if>
+    limit #{pageNum}, #{pageSize}
+  </select>
 
-    <select id="selectUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        select t1.*
-        from we_com_user t1
-        left join we_com_staff_with_user t2 on t1.id = t2.user_id
-        where t1.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
-        and t2.staff_id = #{staffId,jdbcType=BIGINT}
-        and t2.is_delete = 0
-        <if test="filterTagIdList != null and filterTagIdList.size() > 0">
-            and t1.id not in (
-            select t2.id
-            from we_com_user_with_tag t1
-            join we_com_user t2 on t1.user_id = t2.id
-            where t1.tag_id in
-            <foreach item="item" index="index" collection="filterTagIdList"
-                     open="(" separator="," close=")">
-                #{item}
-            </foreach>
-            )
-        </if>
-        limit #{pageNum}, #{pageSize}
-    </select>
-
-    <select id="selectByTagUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        select t1.*
-        from we_com_user t1
-                 join we_com_user_with_tag t2 on t1.id = t2.user_id
-        where t2.tag_id = #{tagId,jdbcType=BIGINT}
-    </select>
+  <select id="selectByTagUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    select t1.*
+    from we_com_user t1
+           join we_com_user_with_tag t2 on t1.id = t2.user_id
+    where t2.tag_id = #{tagId,jdbcType=BIGINT}
+  </select>
 
-    <select id="selectByGenderUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        select t1.*
-        from we_com_user t1
-        left join we_com_staff_with_user t2 on t1.id = t2.user_id
-        where t1.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
-        and t2.staff_id = #{staffId,jdbcType=BIGINT}
-        and t2.is_delete = 0
-        and t1.gender = #{gender,jdbcType=INTEGER}
-        <if test="filterTagIdList != null and filterTagIdList.size() > 0">
-            and t1.id not in (
-            select t2.id
-            from we_com_user_with_tag t1
-            join we_com_user t2 on t1.user_id = t2.id
-            where t1.tag_id in
-            <foreach item="item" index="index" collection="filterTagIdList"
-                     open="(" separator="," close=")">
-                #{item}
-            </foreach>
-            )
-        </if>
-    </select>
+  <select id="selectByGenderUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+    select t1.*
+    from we_com_user t1
+    left join we_com_staff_with_user t2 on t1.id = t2.user_id
+    where t1.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
+    and t2.staff_id = #{staffId,jdbcType=BIGINT}
+    and t2.is_delete = 0
+    and t1.gender = #{gender,jdbcType=INTEGER}
+    <if test="filterTagIdList != null and filterTagIdList.size() > 0">
+      and t1.id not in (
+      select t2.id
+      from we_com_user_with_tag t1
+      join we_com_user t2 on t1.user_id = t2.id
+      where t1.tag_id in
+      <foreach item="item" index="index" collection="filterTagIdList"
+               open="(" separator="," close=")">
+        #{item}
+      </foreach>
+      )
+    </if>
+  </select>
 </mapper>

+ 7 - 1
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComStaffDataJob.java

@@ -141,7 +141,7 @@ public class WeComStaffDataJob {
                 corpStatisticsTotal.setDate(date);
                 try {
                     corpStatisticsTotalMapper.insertSelective(corpStatisticsTotal);
-                }catch (Exception e){
+                } catch (Exception e) {
                     log.error("insert corpStatisticsTotal error", e);
                 }
             }
@@ -186,6 +186,12 @@ public class WeComStaffDataJob {
 
     private void statisticsStaffTotal(Staff staff, long startTime, long endTime, String date) throws IOException {
         Long corpId = staff.getCorpId();
+        StaffStatisticsTotalExample example = new StaffStatisticsTotalExample();
+        example.createCriteria().andCorpIdEqualTo(corpId).andStaffIdEqualTo(staff.getId()).andDateEqualTo(date);
+        long l = staffStatisticsTotalMapper.countByExample(example);
+        if (l > 0) {
+            return;
+        }
         String accessToken = weComAccessTokenService.getWeComAccessToken(corpId);
         String url = POST_WE_COM_USER_BEHAVIOR_DATA
                 + "?access_token=" + accessToken;

+ 11 - 7
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

@@ -18,6 +18,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
@@ -28,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import static com.tzld.piaoquan.growth.common.common.constant.RedisConstant.WE_COM_USER_AB_TYPE;
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.*;
 
 @Slf4j
@@ -66,13 +68,7 @@ public class WeComUserDataJob {
     private TagMapper tagMapper;
 
     @Autowired
-    private UserWithTagMapper userWithTagMapper;
-
-    @Autowired
-    private WeComStaffService weComStaffService;
-
-    @Autowired
-    private WeComSendService weComSendService;
+    private RedisTemplate<String, Object> redisTemplate;
 
 
     @XxlJob("updateStaffWithUserJob")
@@ -145,6 +141,10 @@ public class WeComUserDataJob {
                     weComUser.setCreatedAt(createAt);
                     Long userId;
                     if (CollectionUtils.isEmpty(weComUserList)) {
+                        Long increment = redisTemplate.opsForValue().increment(WE_COM_USER_AB_TYPE);
+                        if (increment != null) {
+                            weComUser.setAbtype("ab" + increment % 10);
+                        }
                         weComUserMapper.insertSelective(weComUser);
                         userId = weComUser.getId();
                     } else {
@@ -510,6 +510,10 @@ public class WeComUserDataJob {
             weComUser.setGender(gender);
             weComUser.setAvatar(avatar);
             weComUser.setCreatedAt(createAt);
+            Long increment = redisTemplate.opsForValue().increment(WE_COM_USER_AB_TYPE);
+            if (increment != null) {
+                weComUser.setAbtype("ab" + increment % 10);
+            }
             weComUserMapper.insertSelective(weComUser);
             userId = weComUser.getId();
             StaffWithUser staffWithUser = new StaffWithUser();