Procházet zdrojové kódy

增加删除用户任务,修改page查询逻辑

xueyiming před 7 měsíci
rodič
revize
64f2d0cb4a

+ 6 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/constant/WeComConstant.java

@@ -4,8 +4,14 @@ public interface WeComConstant {
     String CROP_ID = "1804267877438678017";
     String SECRET = "9fe05442559750d0cc3e71c5f81217a4";
     String POST_ACCESS_TOKEN_URL = "https://open.weibanzhushou.com/open-api/access_token/get";
+    //获取用户接口
     String GET_USER_URL = "https://open.weibanzhushou.com/open-api/external_user/list";
+    //更新用户接口
     String UPDATE_USER_URL = "https://open.weibanzhushou.com/open-api/external_user/update/list";
+    //获取历史推送接口
     String GET_HISTORY_DATA_URL = "https://open.weibanzhushou.com/open-api/group_msg/result";
+    //推送消息接口
     String POST_MESSAGE_PUSH_URL = "https://open.weibanzhushou.com/open-api/group_msg/add";
+    //获取删除用户接口
+    String GET_DELETE_USER_URL = "https://open.weibanzhushou.com/open-api/external_user/list/outflow";
 }

+ 1 - 4
we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/generator/MybatisGeneratorMain.java

@@ -13,10 +13,7 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * @author ehlxr
- * @since 2021-12-14 14:03.
- */
+
 public class MybatisGeneratorMain {
 
     public static void main(String[] args)

+ 1 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/UserMapper.java

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.wecom.dao.mapper;
 
 import com.tzld.piaoquan.wecom.model.po.User;
 import com.tzld.piaoquan.wecom.model.po.UserExample;
+import java.util.List;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 

+ 9 - 10
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComHistoryDataJob.java

@@ -8,7 +8,7 @@ import com.tzld.piaoquan.wecom.dao.mapper.HistoryMessageMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffWithUserMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
 import com.tzld.piaoquan.wecom.model.bo.MiniprogramRecord;
-import com.tzld.piaoquan.wecom.model.bo.StaffWithUserParam;
+import com.tzld.piaoquan.wecom.model.bo.XxlJobParam;
 import com.tzld.piaoquan.wecom.model.po.*;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.service.HistoryMessageService;
@@ -22,7 +22,6 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
@@ -62,22 +61,22 @@ public class WeComHistoryDataJob {
 
     @XxlJob("saveHistoryMessageJob")
     public ReturnT<String> selectHistoryMessageByDay(String param) {
-        StaffWithUserParam staffWithUserParam = new StaffWithUserParam();
+        XxlJobParam xxlJobParam = new XxlJobParam();
         if (StringUtils.isNotEmpty(param)) {
-            staffWithUserParam = JSONObject.parseObject(param, StaffWithUserParam.class);
+            xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
-        if (staffWithUserParam.getStartTime() == null) {
+        if (xxlJobParam.getStartTime() == null) {
             HistoryMessageExample example = new HistoryMessageExample();
             example.setOrderByClause("create_time desc");
             example.setPage(new Page<>(1, 1));
             List<HistoryMessage> historyMessages = historyMessageMapper.selectByExample(example);
-            staffWithUserParam.setStartTime(historyMessages.get(0).getCreateTime().getTime() / 1000);
+            xxlJobParam.setStartTime(historyMessages.get(0).getCreateTime().getTime() / 1000);
         }
-        if (staffWithUserParam.getEndTime() == null) {
-            staffWithUserParam.setEndTime(System.currentTimeMillis() / 1000);
+        if (xxlJobParam.getEndTime() == null) {
+            xxlJobParam.setEndTime(System.currentTimeMillis() / 1000);
         }
-        Long startTime = staffWithUserParam.getStartTime();
-        Long endTime = staffWithUserParam.getEndTime();
+        Long startTime = xxlJobParam.getStartTime();
+        Long endTime = xxlJobParam.getEndTime();
 
         for (; startTime < endTime; startTime += TimeConstant.DAY) {
             selectHistoryMessage(startTime, Math.min(startTime + TimeConstant.DAY, endTime));

+ 95 - 26
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java

@@ -6,7 +6,7 @@ import com.tzld.piaoquan.wecom.common.constant.TimeConstant;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffWithUserMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
-import com.tzld.piaoquan.wecom.model.bo.StaffWithUserParam;
+import com.tzld.piaoquan.wecom.model.bo.XxlJobParam;
 import com.tzld.piaoquan.wecom.model.po.*;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
@@ -17,7 +17,6 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
@@ -50,24 +49,24 @@ public class WeComUserDataJob {
 
     @XxlJob("insertStaffWithUserJob")
     public ReturnT<String> insertStaffWithUser(String param) {
-        StaffWithUserParam staffWithUserParam = new StaffWithUserParam();
+        XxlJobParam xxlJobParam = new XxlJobParam();
         if (StringUtils.isNotEmpty(param)) {
-            staffWithUserParam = JSONObject.parseObject(param, StaffWithUserParam.class);
+            xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
-        if (staffWithUserParam.getStartTime() == null) {
-            staffWithUserParam.setStartTime(1720540800L);
+        if (xxlJobParam.getStartTime() == null) {
+            xxlJobParam.setStartTime(1720540800L);
         }
-        if (staffWithUserParam.getEndTime() == null) {
-            staffWithUserParam.setEndTime(System.currentTimeMillis() / 1000);
+        if (xxlJobParam.getEndTime() == null) {
+            xxlJobParam.setEndTime(System.currentTimeMillis() / 1000);
         }
         StaffExample example = new StaffExample();
         StaffExample.Criteria criteria = example.createCriteria();
-        if (staffWithUserParam.getStaffId() != null) {
-            criteria.andIdEqualTo(staffWithUserParam.getStaffId());
+        if (xxlJobParam.getStaffId() != null) {
+            criteria.andIdEqualTo(xxlJobParam.getStaffId());
         }
         List<Staff> staffList = staffMapper.selectByExample(example);
         for (Staff staff : staffList) {
-            insertAllUser(staffWithUserParam.getStartTime(), staffWithUserParam.getEndTime(), staff);
+            insertAllUser(xxlJobParam.getStartTime(), xxlJobParam.getEndTime(), staff);
         }
         return ReturnT.SUCCESS;
     }
@@ -119,12 +118,12 @@ public class WeComUserDataJob {
                     staffWithUserMapper.insertList(insertStaffWithUserList);
                 }
                 if (jsonArray.size() < size) {
-                    if (total > sum) {
-                        log.error("insertAllUser插入数量不足 total = {}, sum={}", total, sum);
-                    }
                     break;
                 }
             }
+            if (total > sum) {
+                log.error("insertAllUser插入数量不足 total = {}, sum={}", total, sum);
+            }
         } catch (Exception e) {
             log.error("insertAllUser error", e);
         }
@@ -149,28 +148,28 @@ public class WeComUserDataJob {
 
     @XxlJob("updateStaffWithUserJob")
     public ReturnT<String> updateStaffWithUser(String param) {
-        StaffWithUserParam staffWithUserParam = new StaffWithUserParam();
+        XxlJobParam xxlJobParam = new XxlJobParam();
         if (StringUtils.isNotEmpty(param)) {
-            staffWithUserParam = JSONObject.parseObject(param, StaffWithUserParam.class);
+            xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
-        if (staffWithUserParam.getStartTime() == null) {
+        if (xxlJobParam.getStartTime() == null) {
             UserExample userExample = new UserExample();
             userExample.setOrderByClause("create_time desc");
             userExample.setPage(new Page<>(1, 1));
             List<User> userList = userMapper.selectByExample(userExample);
-            staffWithUserParam.setStartTime(userList.get(0).getCreateTime().getTime() / 1000 - 2L * TimeConstant.HOUR);
+            xxlJobParam.setStartTime(userList.get(0).getCreateTime().getTime() / 1000 - 2L * TimeConstant.HOUR);
         }
-        if (staffWithUserParam.getEndTime() == null) {
-            staffWithUserParam.setEndTime(System.currentTimeMillis() / 1000);
+        if (xxlJobParam.getEndTime() == null) {
+            xxlJobParam.setEndTime(System.currentTimeMillis() / 1000);
         }
         StaffExample example = new StaffExample();
         StaffExample.Criteria criteria = example.createCriteria();
-        if (staffWithUserParam.getStaffId() != null) {
-            criteria.andIdEqualTo(staffWithUserParam.getStaffId());
+        if (xxlJobParam.getStaffId() != null) {
+            criteria.andIdEqualTo(xxlJobParam.getStaffId());
         }
         List<Staff> staffList = staffMapper.selectByExample(example);
         for (Staff staff : staffList) {
-            updateUser(staffWithUserParam.getStartTime(), staffWithUserParam.getEndTime(), staff);
+            updateUser(xxlJobParam.getStartTime(), xxlJobParam.getEndTime(), staff);
         }
         return ReturnT.SUCCESS;
     }
@@ -226,12 +225,13 @@ public class WeComUserDataJob {
                     sum++;
                 }
                 if (jsonArray.size() < size) {
-                    if (total > sum) {
-                        log.error("updateUser插入数量不足 total = {}, sum={}", total, sum);
-                    }
                     break;
                 }
             }
+
+            if (total > sum) {
+                log.error("updateUser插入数量不足 total = {}, sum={}", total, sum);
+            }
         } catch (IOException e) {
             log.error("updateUser error", e);
         }
@@ -255,4 +255,73 @@ public class WeComUserDataJob {
         return httpPoolClientDefault.get(url);
     }
 
+
+    @XxlJob("deleteUserJob")
+    public ReturnT<String> deleteUserJob(String param) {
+        XxlJobParam xxlJobParam = new XxlJobParam();
+        if (StringUtils.isNotEmpty(param)) {
+            xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
+        }
+        if (xxlJobParam.getStartTime() == null) {
+            xxlJobParam.setStartTime(1720540800L);
+        }
+        if (xxlJobParam.getEndTime() == null) {
+            xxlJobParam.setEndTime(System.currentTimeMillis() / 1000);
+        }
+        deleteUser(xxlJobParam.getStartTime(), xxlJobParam.getEndTime());
+        return ReturnT.SUCCESS;
+    }
+
+    //查询删除用户并更新
+    private void deleteUser(long startTime, long endTime) {
+        try {
+            Integer total = getDeleteUserTotal(startTime, endTime);
+            if (total == null || total == 0) {
+                return;
+            }
+            int page = total / size + 1;
+            int sum = 0;
+            for (int i = 0; i < page; i++) {
+                String res = getDeleteUser(size, i * size, startTime, endTime);
+                log.info("deleteUser size={}, i={}, startTime={}, endTime={}, res={}", size, i, startTime, endTime, res);
+                if (ObjectUtils.isEmpty(res)) {
+                    continue;
+                }
+                JSONObject jsonObject = JSONObject.parseObject(res);
+                JSONArray jsonArray = jsonObject.getJSONArray("external_user_list");
+                for (int j = 0; j < jsonArray.size(); j++) {
+                    JSONObject staffRelation = jsonArray.getJSONObject(j).getJSONObject("staff_relation");
+                    Long deletedAt = staffRelation.getLong("deleted_at");
+                    String externalUserId3rdParty = staffRelation.getString("external_user_ext_id");
+                    Long userId = userMapper.selectIdByExternalUserId3rdParty(externalUserId3rdParty);
+                    User updateUser = new User();
+                    updateUser.setId(userId);
+                    updateUser.setIsDelete(1);
+                    updateUser.setDeletedAt(deletedAt);
+                    userMapper.updateByPrimaryKeySelective(updateUser);
+                    sum++;
+                }
+            }
+            if (total > sum) {
+                log.error("deleteUser数量不足 total = {}, sum={}", total, sum);
+            }
+        } catch (Exception e) {
+            log.error("deleteUser error", e);
+        }
+    }
+
+    private Integer getDeleteUserTotal(Long startTime, Long endTime) throws IOException {
+        String res = getDeleteUser(1, 0, startTime, endTime);
+        JSONObject jsonObject = JSONObject.parseObject(res);
+        return jsonObject.getInteger("total_count");
+    }
+
+    private String getDeleteUser(Integer limit, Integer offset, Long startTime, Long endTime) throws IOException {
+        String accessToken = accessTokenService.getAccessToken();
+        String url = GET_DELETE_USER_URL
+                + "?access_token=" + accessToken
+                + "&limit=" + limit + "&offset=" + offset + "&start_time=" + startTime + "&end_time=" + endTime;
+        return httpPoolClientDefault.get(url);
+    }
+
 }

+ 1 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/bo/StaffWithUserParam.java → we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/bo/XxlJobParam.java

@@ -3,7 +3,7 @@ package com.tzld.piaoquan.wecom.model.bo;
 import lombok.Data;
 
 @Data
-public class StaffWithUserParam {
+public class XxlJobParam {
 
     private Long startTime;
 

+ 11 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/User.java

@@ -25,6 +25,8 @@ public class User {
 
     private Long updatedAt;
 
+    private Long deletedAt;
+
     private Date createTime;
 
     private Date updateTime;
@@ -117,6 +119,14 @@ public class User {
         this.updatedAt = updatedAt;
     }
 
+    public Long getDeletedAt() {
+        return deletedAt;
+    }
+
+    public void setDeletedAt(Long deletedAt) {
+        this.deletedAt = deletedAt;
+    }
+
     public Date getCreateTime() {
         return createTime;
     }
@@ -150,6 +160,7 @@ public class User {
         sb.append(", isDelete=").append(isDelete);
         sb.append(", createdAt=").append(createdAt);
         sb.append(", updatedAt=").append(updatedAt);
+        sb.append(", deletedAt=").append(deletedAt);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);
         sb.append("]");

+ 60 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/UserExample.java

@@ -826,6 +826,66 @@ public class UserExample {
             return (Criteria) this;
         }
 
+        public Criteria andDeletedAtIsNull() {
+            addCriterion("deleted_at is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtIsNotNull() {
+            addCriterion("deleted_at is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtEqualTo(Long value) {
+            addCriterion("deleted_at =", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtNotEqualTo(Long value) {
+            addCriterion("deleted_at <>", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtGreaterThan(Long value) {
+            addCriterion("deleted_at >", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtGreaterThanOrEqualTo(Long value) {
+            addCriterion("deleted_at >=", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtLessThan(Long value) {
+            addCriterion("deleted_at <", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtLessThanOrEqualTo(Long value) {
+            addCriterion("deleted_at <=", value, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtIn(List<Long> values) {
+            addCriterion("deleted_at in", values, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtNotIn(List<Long> values) {
+            addCriterion("deleted_at not in", values, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtBetween(Long value1, Long value2) {
+            addCriterion("deleted_at between", value1, value2, "deletedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDeletedAtNotBetween(Long value1, Long value2) {
+            addCriterion("deleted_at not between", value1, value2, "deletedAt");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateTimeIsNull() {
             addCriterion("create_time is null");
             return (Criteria) this;

+ 32 - 17
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageAttachmentServiceImpl.java

@@ -116,7 +116,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             if (staff == null || staff.getCarrierId() == null) {
                 return "";
             }
-            String page = selectPage(staff.getCarrierId(), videoId);
+            String page = selectPage(videoId, staff.getCarrierId(), "企微", "日常推送");
             if (StringUtils.isNotEmpty(page)) {
                 return page;
             }
@@ -151,23 +151,38 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
         return data.getString("url");
     }
 
-    public String selectPage(String carrierId, Long videoId) throws IOException {
-        Map<String, String> map = new HashMap<>();
-        String url = "https://api.piaoquantv.com/ad/put/flow/list/tencent?videoId=${videoId}&putScene=touliu&channel=tencentqw&currentPage=1&pageSize=20"
-                .replace("${videoId}", "" + videoId);
-        String res = httpPoolClientDefault.get(url);
-        JSONObject jsonObject = JSONObject.parseObject(res);
-        JSONObject data = jsonObject.getJSONObject("data");
-        JSONArray objs = data.getJSONArray("objs");
-        for (int i = 0; i < objs.size(); i++) {
-            JSONObject obj = objs.getJSONObject(i);
-            String putCarrierId = obj.getString("putCarrierId");
-            String page = obj.getString("url");
-            if (StringUtils.isEmpty(putCarrierId) || StringUtils.isEmpty(page)) {
-                continue;
+    public String selectPage(Long videoId, String carrierId, String typeOne, String typeTwo) throws IOException {
+        int pageSize = 20;
+        int totalPage = 1;
+        for (int n = 1; n < totalPage + 1; n++) {
+            String url = "https://api.piaoquantv.com/ad/put/flow/list/tencent?videoId=${videoId}&putScene=touliu&channel=tencentqw&currentPage=${page}&pageSize=${pageSize}"
+                    .replace("${videoId}", String.valueOf(videoId))
+                    .replace("${page}", String.valueOf(n))
+                    .replace("${pageSize}", String.valueOf(pageSize));
+            String res = httpPoolClientDefault.get(url);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            JSONObject data = jsonObject.getJSONObject("data");
+            if(data.getInteger("totalPage") != null){
+                totalPage = data.getInteger("totalPage");
+            }
+            JSONArray objs = data.getJSONArray("objs");
+            for (int i = 0; i < objs.size(); i++) {
+                JSONObject obj = objs.getJSONObject(i);
+                String putCarrierId = obj.getString("putCarrierId");
+                String page = obj.getString("url");
+                String putTypeOne = obj.getString("putTypeOne");
+                String putTypeTwo = obj.getString("putTypeTwo");
+                if (StringUtils.isEmpty(putCarrierId)
+                        || StringUtils.isEmpty(page)
+                        || StringUtils.isEmpty(putTypeOne)
+                        || StringUtils.isEmpty(putTypeTwo)) {
+                    continue;
+                }
+                if (putCarrierId.equals(carrierId) && putTypeOne.equals(typeOne) && putTypeTwo.equals(typeTwo)) {
+                    return page;
+                }
             }
-            map.put(putCarrierId, page);
         }
-        return map.get(carrierId);
+        return null;
     }
 }

+ 27 - 13
we-com-server/src/main/resources/mapper/UserMapper.xml

@@ -13,6 +13,7 @@
     <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
     <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>
@@ -76,7 +77,7 @@
   </sql>
   <sql id="Base_Column_List">
     id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`, avatar, 
-    gender, is_delete, created_at, updated_at, create_time, update_time
+    gender, is_delete, created_at, updated_at, deleted_at, create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.UserExample" resultMap="BaseResultMap">
     select
@@ -111,20 +112,17 @@
       <include refid="Example_Where_Clause" />
     </if>
   </delete>
-  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.User" useGeneratedKeys="true" keyProperty="id">
-      insert into we_com_user (id, external_user_id, union_id,
-      external_user_id_3rd_party, `type`, `name`,
+  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.User">
+    insert into we_com_user (id, external_user_id, union_id, 
+      external_user_id_3rd_party, `type`, `name`, 
       avatar, gender,
-      created_at, updated_at, create_time,
-      update_time)
-      values (#{id,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR},
-      #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
+      created_at, updated_at, deleted_at, 
+      create_time, update_time)
+    values (#{id,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, 
+      #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
       #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
-      #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
-      #{updateTime,jdbcType=TIMESTAMP})
-      <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-          select LAST_INSERT_ID()
-      </selectKey>
+      #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.User">
     insert into we_com_user
@@ -162,6 +160,9 @@
       <if test="updatedAt != null">
         updated_at,
       </if>
+      <if test="deletedAt != null">
+        deleted_at,
+      </if>
       <if test="createTime != null">
         create_time,
       </if>
@@ -203,6 +204,9 @@
       <if test="updatedAt != null">
         #{updatedAt,jdbcType=BIGINT},
       </if>
+      <if test="deletedAt != null">
+        #{deletedAt,jdbcType=BIGINT},
+      </if>
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
@@ -253,6 +257,9 @@
       <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>
@@ -277,6 +284,7 @@
       is_delete = #{record.isDelete,jdbcType=INTEGER},
       created_at = #{record.createdAt,jdbcType=BIGINT},
       updated_at = #{record.updatedAt,jdbcType=BIGINT},
+      deleted_at = #{record.deletedAt,jdbcType=BIGINT},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
       update_time = #{record.updateTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
@@ -316,6 +324,9 @@
       <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>
@@ -337,6 +348,7 @@
       is_delete = #{isDelete,jdbcType=INTEGER},
       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}
@@ -362,6 +374,7 @@
     gender,
     created_at,
     updated_at,
+    deleted_at,
     create_time,
     update_time
     )
@@ -377,6 +390,7 @@
       #{item.gender,jdbcType=INTEGER},
       #{item.createdAt,jdbcType=BIGINT},
       #{item.updatedAt,jdbcType=BIGINT},
+      #{item.deletedAt,jdbcType=BIGINT},
       #{item.createTime,jdbcType=TIMESTAMP},
       #{item.updateTime,jdbcType=TIMESTAMP}
       )

+ 3 - 3
we-com-server/src/main/resources/mybatis-generator-config.xml

@@ -27,7 +27,7 @@
         </commentGenerator>
 
         <jdbcConnection driverClass="com.mysql.jdbc.Driver"
-                        connectionURL="jdbc:mysql://rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false"
+                        connectionURL="jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false"
                         userId="crawler" password="crawler123456@">
         </jdbcConnection>
 
@@ -50,12 +50,12 @@
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
-<!--        <table tableName="we_com_user" domainObjectName="User" alias=""/>-->
+        <table tableName="we_com_user" domainObjectName="User" alias=""/>
 <!--        <table tableName="we_com_history_message" domainObjectName="HistoryMessage" alias=""/>-->
 <!--        <table tableName="we_com_message_attachment" domainObjectName="MessageAttachment" alias=""/>-->
 <!--        <table tableName="we_com_staff" domainObjectName="Staff" alias=""/>-->
 <!--        <table tableName="we_com_staff_with_user" domainObjectName="StaffWithUser" alias=""/>-->
-        <table tableName="we_com_send_message" domainObjectName="SendMessage" alias=""/>
+<!--        <table tableName="we_com_send_message" domainObjectName="SendMessage" alias=""/>-->
 
 
     </context>