Sfoglia il codice sorgente

增加员工信息,关联员工和客户,推送消息按员工分组

xueyiming 8 mesi fa
parent
commit
0fce5afa53
17 ha cambiato i file con 2085 aggiunte e 88 eliminazioni
  1. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/enums/StaffExtEnum.java
  2. 30 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/StaffMapper.java
  3. 35 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/StaffWithUserMapper.java
  4. 54 19
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComMessageDataJob.java
  5. 94 29
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java
  6. 92 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/Staff.java
  7. 662 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/StaffExample.java
  8. 70 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/StaffWithUser.java
  9. 512 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/StaffWithUserExample.java
  10. 5 7
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageAttachmentServiceImpl.java
  11. 5 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageServiceImpl.java
  12. 2 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageAttachmentService.java
  13. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageService.java
  14. 246 0
      we-com-server/src/main/resources/mapper/StaffMapper.xml
  15. 241 0
      we-com-server/src/main/resources/mapper/StaffWithUserMapper.xml
  16. 32 29
      we-com-server/src/main/resources/mapper/UserMapper.xml
  17. 3 0
      we-com-server/src/main/resources/mybatis-generator-config.xml

+ 1 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/enums/StaffExtEnum.java

@@ -6,7 +6,7 @@ import lombok.Getter;
 public enum StaffExtEnum {
     STAFF_EXT_ENUM_1("wogizUDQAAzM5HbqIyA4k3KR6D8vKp3w", "songyi", "推荐官"),
     STAFF_EXT_ENUM_2("wogizUDQAAk5Z_5nLRD-XTAPU9poaRCw", "XinYi", "分享官"),
-    STAFF_EXT_ENUM_3("wogizUDQAA1oa8qD5jh_qvVkfNbyohUw", "XinYi", "福利官");
+    STAFF_EXT_ENUM_3("wogizUDQAA1oa8qD5jh_qvVkfNbyohUw", "17512006748", "福利官");
 
 
     final String id;

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

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.wecom.dao.mapper;
+
+import com.tzld.piaoquan.wecom.model.po.Staff;
+import com.tzld.piaoquan.wecom.model.po.StaffExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface StaffMapper {
+    long countByExample(StaffExample example);
+
+    int deleteByExample(StaffExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(Staff record);
+
+    int insertSelective(Staff record);
+
+    List<Staff> selectByExample(StaffExample example);
+
+    Staff selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") Staff record, @Param("example") StaffExample example);
+
+    int updateByExample(@Param("record") Staff record, @Param("example") StaffExample example);
+
+    int updateByPrimaryKeySelective(Staff record);
+
+    int updateByPrimaryKey(Staff record);
+}

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

@@ -0,0 +1,35 @@
+package com.tzld.piaoquan.wecom.dao.mapper;
+
+import com.tzld.piaoquan.wecom.model.po.StaffWithUser;
+import com.tzld.piaoquan.wecom.model.po.StaffWithUserExample;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface StaffWithUserMapper {
+    long countByExample(StaffWithUserExample example);
+
+    int deleteByExample(StaffWithUserExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(StaffWithUser record);
+
+    int insertSelective(StaffWithUser record);
+
+    List<StaffWithUser> selectByExample(StaffWithUserExample example);
+
+    StaffWithUser selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") StaffWithUser record, @Param("example") StaffWithUserExample example);
+
+    int updateByExample(@Param("record") StaffWithUser record, @Param("example") StaffWithUserExample example);
+
+    int updateByPrimaryKeySelective(StaffWithUser record);
+
+    int updateByPrimaryKey(StaffWithUser record);
+
+    void insertList(@Param("list") List<StaffWithUser> list);
+}

+ 54 - 19
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComMessageDataJob.java

@@ -5,12 +5,11 @@ import com.alibaba.fastjson.JSONObject;
 import com.aliyun.odps.data.Record;
 import com.google.common.collect.Lists;
 import com.tzld.piaoquan.wecom.dao.mapper.MessageAttachmentMapper;
+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.PushMessage;
-import com.tzld.piaoquan.wecom.model.po.MessageAttachment;
-import com.tzld.piaoquan.wecom.model.po.MessageAttachmentExample;
-import com.tzld.piaoquan.wecom.model.po.User;
-import com.tzld.piaoquan.wecom.model.po.UserExample;
+import com.tzld.piaoquan.wecom.model.po.*;
 import com.tzld.piaoquan.wecom.service.MessageAttachmentService;
 import com.tzld.piaoquan.wecom.service.MessageService;
 import com.tzld.piaoquan.wecom.utils.DateUtil;
@@ -48,6 +47,12 @@ public class WeComMessageDataJob {
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
+    @Autowired
+    private StaffWithUserMapper staffWithUserMapper;
+
+    @Autowired
+    private StaffMapper staffMapper;
+
     private static final int MAX_VIDEO_NUM = 3;
 
     //历史优质视频可推送用户列表
@@ -114,13 +119,18 @@ public class WeComMessageDataJob {
 
     public void assemble() {
         List<String> staffExtIdList = new ArrayList<>();
+        staffExtIdList.add("wogizUDQAA1oa8qD5jh_qvVkfNbyohUw");
         init();
         Map<String, List<String>> res = new HashMap<>();
         UserExample example = new UserExample();
+        List<String> list = new ArrayList<>();
+        list.add("wmgizUDQAAhUFId3OLvMROvFfnBeVpCg");
+        example.createCriteria().andExternalUserId3rdPartyIn(list);
         long count = userMapper.countByExample(example);
         int page = 1;
-        int pageSize = 1000;
+        int pageSize = 10;
         long totalPageSize = count / pageSize + 1;
+        totalPageSize = 1L;
         for (; page <= totalPageSize; page++) {
             example.setPage(new Page<>(page, pageSize));
             List<User> userList = userMapper.selectByExample(example);
@@ -128,17 +138,21 @@ public class WeComMessageDataJob {
                 continue;
             }
             for (User user : userList) {
-                String pushKey = getPushKey(user);
-                if (res.containsKey(pushKey)) {
-                    res.get(pushKey).add(user.getExternalUserId3rdParty());
-                } else {
-                    res.put(pushKey, Lists.newArrayList(user.getExternalUserId3rdParty()));
+                List<String> staffPushKeys = getStaffPushKey(user);
+                if (CollectionUtils.isEmpty(staffPushKeys)) {
+                    continue;
+                }
+                for (String staffPushKey : staffPushKeys) {
+                    if (res.containsKey(staffPushKey)) {
+                        res.get(staffPushKey).add(user.getExternalUserId3rdParty());
+                    } else {
+                        res.put(staffPushKey, Lists.newArrayList(user.getExternalUserId3rdParty()));
+                    }
                 }
             }
         }
-        for (String staffExtId : staffExtIdList) {
-            pushMessage(res, staffExtId);
-        }
+        pushMessage(res);
+
         saveGuaranteedVideoIdList(guaranteedVideoIdList);
     }
 
@@ -158,6 +172,20 @@ public class WeComMessageDataJob {
         }
     }
 
+    public List<String> getStaffPushKey(User user) {
+        StaffWithUserExample example = new StaffWithUserExample();
+        example.createCriteria().andUserIdEqualTo(user.getId());
+        List<StaffWithUser> staffWithUserList = staffWithUserMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(staffWithUserList)) {
+            return null;
+        }
+        String pushKey = getPushKey(user);
+        List<String> staffPushKeys = new ArrayList<>();
+        for (StaffWithUser staffWithUser : staffWithUserList) {
+            staffPushKeys.add(staffWithUser.getId() + "&" + pushKey);
+        }
+        return staffPushKeys;
+    }
 
     public String getPushKey(User user) {
         int n = 0;
@@ -193,16 +221,23 @@ public class WeComMessageDataJob {
         return key.toString();
     }
 
-    public void pushMessage(Map<String, List<String>> map, String staffExtId) {
+    public void pushMessage(Map<String, List<String>> map) {
         List<JSONObject> pushList = new ArrayList<>();
         String text = messageService.getMessageText();
         String name = MessageUtil.getName();
         for (Map.Entry<String, List<String>> entry : map.entrySet()) {
+            String[] split = entry.getKey().split("&");
+            Long staffId = Long.parseLong(split[0]);
+            StaffExample staffExample = new StaffExample();
+            staffExample.createCriteria().andIdEqualTo(staffId);
+            List<Staff> staffList = staffMapper.selectByExample(staffExample);
+            Staff staff = staffList.get(0);
+            String pushKey = split[1];
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("name", name);
             jsonObject.put("text", text);
             JSONArray attachments = new JSONArray();
-            List<Long> videoIdList = Arrays.stream(entry.getKey().split("_")).map(Long::parseLong).collect(Collectors.toList());
+            List<Long> videoIdList = Arrays.stream(pushKey.split("_")).map(Long::parseLong).collect(Collectors.toList());
             for (Long videoId : videoIdList) {
                 JSONObject attachment = new JSONObject();
                 attachment.put("msgtype", "miniprogram");
@@ -218,11 +253,11 @@ public class WeComMessageDataJob {
                 miniprogram.put("title", messageAttachment.getTitle());
 
                 String page = "";
-                String key = staffExtId + "_" + videoId;
+                String key = staff.getStaffExtId() + "_" + videoId;
                 if (pageMap.containsKey(key)) {
                     page = pageMap.get(key);
                 } else {
-                    page = messageAttachmentService.getPage(staffExtId, videoId);
+                    page = messageAttachmentService.getPage(staff, videoId);
                     pageMap.put(key, page);
                 }
                 if (StringUtils.isEmpty(page)) {
@@ -240,7 +275,7 @@ public class WeComMessageDataJob {
                 JSONObject newJSONObject = new JSONObject();
                 newJSONObject.putAll(jsonObject);
                 JSONObject staff_eu = new JSONObject();
-                staff_eu.put("staff_ext_id", staffExtId);
+                staff_eu.put("staff_ext_id", staff.getStaffExtId());
                 staff_eu.put("eu_ext_ids", list);
                 staffEuList.add(staff_eu);
                 newJSONObject.put("staff_eu_list", staffEuList);
@@ -261,7 +296,7 @@ public class WeComMessageDataJob {
 //            e.printStackTrace();
 //        }
 
-
+        System.out.println(pushList);
         for (JSONObject jsonObject : pushList) {
             messageService.pushMessage(jsonObject);
         }

+ 94 - 29
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java

@@ -2,14 +2,17 @@ package com.tzld.piaoquan.wecom.job;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+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.po.User;
-import com.tzld.piaoquan.wecom.model.po.UserExample;
+import com.tzld.piaoquan.wecom.model.po.*;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
 import com.tzld.piaoquan.wecom.utils.HttpPoolClient;
 import com.tzld.piaoquan.wecom.utils.page.Page;
 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;
@@ -33,34 +36,66 @@ public class WeComUserDataJob {
     @Autowired
     private AccessTokenService accessTokenService;
 
+    @Autowired
+    private StaffMapper staffMapper;
+
+    @Autowired
+    private StaffWithUserMapper staffWithUserMapper;
+
+    public void insertStaffWithUser() {
+        long endTime = 1727507085L;
+        long startTime = 1720540800L;
+        StaffExample example = new StaffExample();
+        example.createCriteria().andIdEqualTo(1L);
+        List<Staff> staffList = staffMapper.selectByExample(example);
+        for (Staff staff : staffList) {
+            insertAllUser(startTime, endTime, staff);
+        }
+    }
+
     //初始化用户使用此任务
-    public void insertAllUser() {
+    public void insertAllUser(long startTime, long endTime, Staff staff) {
         try {
-            Long endTime = System.currentTimeMillis() / 1000;
-            Long startTime = 1720540800L;
-            Integer total = getUserTotal(startTime, endTime);
+            Integer total = getUserTotal(startTime, endTime, staff.getStaffExtId());
             if (total == null || total == 0) {
                 return;
             }
             int page = total / size + 1;
             int sum = 0;
             for (int i = 0; i < page; i++) {
-                String res = getUser(size, i * size, 1720540800L, endTime);
+                String res = getUser(size, i * size, startTime, endTime, staff.getStaffExtId());
                 if (ObjectUtils.isEmpty(res)) {
                     continue;
                 }
                 JSONObject jsonObject = JSONObject.parseObject(res);
                 JSONArray jsonArray = jsonObject.getJSONArray("external_user_list");
-                List<User> userList = new ArrayList<>();
+                List<StaffWithUser> insertStaffWithUserList = new ArrayList<>();
                 for (int j = 0; j < jsonArray.size(); j++) {
-                    String id = (String) jsonArray.getJSONObject(j).get("id");
-                    jsonArray.getJSONObject(j).put("id", null);
-                    User user = jsonArray.getJSONObject(j).toJavaObject(User.class);
-                    user.setExternalUserId3rdParty(id);
-                    userList.add(user);
+                    String externalUserId3rdParty = (String) jsonArray.getJSONObject(j).get("id");
+                    Long userId = userMapper.selectIdByExternalUserId3rdParty(externalUserId3rdParty);
+                    if (userId == null) {
+                        jsonArray.getJSONObject(j).put("id", null);
+                        User user = jsonArray.getJSONObject(j).toJavaObject(User.class);
+                        user.setExternalUserId3rdParty(externalUserId3rdParty);
+                        userMapper.insert(user);
+                        userId = user.getId();
+                    }
+                    if (userId == null) {
+                        System.out.println("插入数据异常:" + jsonArray.getJSONObject(j));
+                        continue;
+                    }
+                    StaffWithUserExample staffWithUserExample = new StaffWithUserExample();
+                    staffWithUserExample.createCriteria().andStaffIdEqualTo(staff.getId()).andUserIdEqualTo(userId);
+                    List<StaffWithUser> staffWithUserList = staffWithUserMapper.selectByExample(staffWithUserExample);
+                    if (CollectionUtils.isEmpty(staffWithUserList)) {
+                        StaffWithUser staffWithUser = new StaffWithUser();
+                        staffWithUser.setUserId(userId);
+                        staffWithUser.setStaffId(staff.getId());
+                        insertStaffWithUserList.add(staffWithUser);
+                    }
                     sum++;
                 }
-                userMapper.insertList(userList);
+                staffWithUserMapper.insertList(insertStaffWithUserList);
                 if (jsonArray.size() < size) {
                     if (total > sum) {
                         System.out.println("插入数量不足");
@@ -73,37 +108,49 @@ public class WeComUserDataJob {
         }
     }
 
-    private Integer getUserTotal(Long startTime, Long endTime) throws IOException {
-        String res = getUser(1, 0, startTime, endTime);
+    private Integer getUserTotal(Long startTime, Long endTime, String staffId) throws IOException {
+        String res = getUser(1, 0, startTime, endTime, staffId);
         JSONObject jsonObject = JSONObject.parseObject(res);
         return jsonObject.getInteger("total");
     }
 
-    private String getUser(Integer limit, Integer offset, Long startTime, Long endTime) throws IOException {
+    private String getUser(Integer limit, Integer offset, Long startTime, Long endTime, String staffExtId) throws IOException {
         String accessToken = accessTokenService.getAccessToken();
         String url = GET_USER_URL
                 + "?access_token=" + accessToken
                 + "&limit=" + limit + "&offset=" + offset + "&start_time=" + startTime + "&end_time=" + endTime;
+        if (StringUtils.isNotEmpty(staffExtId)) {
+            url = url + "&staff_id=" + staffExtId;
+        }
         return httpPoolClientDefault.get(url);
     }
 
+    public void updateStaffWithUser() {
+//        UserExample userExample = new UserExample();
+//        userExample.setOrderByClause("create_time desc");
+//        userExample.setPage(new Page<>(1, 1));
+//        List<User> userList = userMapper.selectByExample(userExample);
+//        long startTime = userList.get(0).getCreateTime().getTime() / 1000;
+        long startTime = 1727467200L;
+        long endTime = System.currentTimeMillis() / 1000;
+        StaffExample example = new StaffExample();
+        List<Staff> staffList = staffMapper.selectByExample(example);
+        for (Staff staff : staffList) {
+            updateUser(startTime, endTime, staff);
+        }
+    }
+
 
-    public void updateUser() {
+    public void updateUser(long startTime, long endTime, Staff staff) {
         try {
-            UserExample userExample = new UserExample();
-            userExample.setOrderByClause("create_time desc");
-            userExample.setPage(new Page<>(1, 1));
-            List<User> userList = userMapper.selectByExample(userExample);
-            long startTime = userList.get(0).getCreateTime().getTime() / 1000;
-            Long endTime = System.currentTimeMillis() / 1000;
-            Integer total = getUpdateUserTotal(startTime, endTime);
+            Integer total = getUpdateUserTotal(startTime, endTime, staff.getStaffExtId());
             if (total == null || total == 0) {
                 return;
             }
             int page = total / size + 1;
             int sum = 0;
             for (int i = 0; i < page; i++) {
-                String res = getUpdateUser(size, i * size, startTime, endTime);
+                String res = getUpdateUser(size, i * size, startTime, endTime, staff.getStaffExtId());
                 if (ObjectUtils.isEmpty(res)) {
                     continue;
                 }
@@ -117,13 +164,28 @@ public class WeComUserDataJob {
                     UserExample example = new UserExample();
                     example.createCriteria().andExternalUserId3rdPartyEqualTo(user.getExternalUserId3rdParty());
                     List<User> list = userMapper.selectByExample(example);
+                    Long userId;
                     if (CollectionUtils.isEmpty(list)) {
                         //没有用户,走插入逻辑
                         userMapper.insert(user);
+                        userId = user.getId();
                     } else {
                         User oldUser = list.get(0);
                         user.setId(oldUser.getId());
                         userMapper.updateByPrimaryKeySelective(user);
+                        userId = oldUser.getId();
+                    }
+                    if (userId == null) {
+                        continue;
+                    }
+                    StaffWithUserExample staffWithUserExample = new StaffWithUserExample();
+                    staffWithUserExample.createCriteria().andStaffIdEqualTo(staff.getId()).andUserIdEqualTo(userId);
+                    List<StaffWithUser> staffWithUserList = staffWithUserMapper.selectByExample(staffWithUserExample);
+                    if (CollectionUtils.isEmpty(staffWithUserList)) {
+                        StaffWithUser staffWithUser = new StaffWithUser();
+                        staffWithUser.setStaffId(staff.getId());
+                        staffWithUser.setUserId(userId);
+                        staffWithUserMapper.insert(staffWithUser);
                     }
                     sum++;
                 }
@@ -142,18 +204,21 @@ public class WeComUserDataJob {
         }
     }
 
-    private Integer getUpdateUserTotal(Long startTime, Long endTime) throws IOException {
-        String res = getUpdateUser(1, 0, startTime, endTime);
+    private Integer getUpdateUserTotal(Long startTime, Long endTime, String staffExtId) throws IOException {
+        String res = getUpdateUser(1, 0, startTime, endTime, staffExtId);
         JSONObject jsonObject = JSONObject.parseObject(res);
         return jsonObject.getInteger("total");
     }
 
-    private String getUpdateUser(Integer limit, Integer offset, Long startTime, Long endTime) throws IOException {
+    private String getUpdateUser(Integer limit, Integer offset, Long startTime, Long endTime, String staffExtId) throws IOException {
         String accessToken = accessTokenService.getAccessToken();
         String url = UPDATE_USER_URL
                 + "?access_token=" + accessToken
                 + "&limit=" + limit + "&offset=" + offset + "&start_update_time=" + startTime + "&end_update_time=" + endTime
                 + "&source=external_user";
+        if (StringUtils.isNotEmpty(staffExtId)) {
+            url = url + "&staff_id=" + staffExtId;
+        }
         return httpPoolClientDefault.get(url);
     }
 

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

@@ -0,0 +1,92 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import java.util.Date;
+
+public class Staff {
+    private Long id;
+
+    private String staffExtId;
+
+    private String carrierId;
+
+    private String remark;
+
+    private Integer isDelete;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getStaffExtId() {
+        return staffExtId;
+    }
+
+    public void setStaffExtId(String staffExtId) {
+        this.staffExtId = staffExtId;
+    }
+
+    public String getCarrierId() {
+        return carrierId;
+    }
+
+    public void setCarrierId(String carrierId) {
+        this.carrierId = carrierId;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", staffExtId=").append(staffExtId);
+        sb.append(", carrierId=").append(carrierId);
+        sb.append(", remark=").append(remark);
+        sb.append(", isDelete=").append(isDelete);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -0,0 +1,662 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import com.tzld.piaoquan.wecom.utils.page.Page;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class StaffExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public StaffExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdIsNull() {
+            addCriterion("staff_ext_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdIsNotNull() {
+            addCriterion("staff_ext_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdEqualTo(String value) {
+            addCriterion("staff_ext_id =", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdNotEqualTo(String value) {
+            addCriterion("staff_ext_id <>", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdGreaterThan(String value) {
+            addCriterion("staff_ext_id >", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdGreaterThanOrEqualTo(String value) {
+            addCriterion("staff_ext_id >=", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdLessThan(String value) {
+            addCriterion("staff_ext_id <", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdLessThanOrEqualTo(String value) {
+            addCriterion("staff_ext_id <=", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdLike(String value) {
+            addCriterion("staff_ext_id like", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdNotLike(String value) {
+            addCriterion("staff_ext_id not like", value, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdIn(List<String> values) {
+            addCriterion("staff_ext_id in", values, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdNotIn(List<String> values) {
+            addCriterion("staff_ext_id not in", values, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdBetween(String value1, String value2) {
+            addCriterion("staff_ext_id between", value1, value2, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffExtIdNotBetween(String value1, String value2) {
+            addCriterion("staff_ext_id not between", value1, value2, "staffExtId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdIsNull() {
+            addCriterion("carrier_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdIsNotNull() {
+            addCriterion("carrier_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdEqualTo(String value) {
+            addCriterion("carrier_id =", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdNotEqualTo(String value) {
+            addCriterion("carrier_id <>", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdGreaterThan(String value) {
+            addCriterion("carrier_id >", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdGreaterThanOrEqualTo(String value) {
+            addCriterion("carrier_id >=", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdLessThan(String value) {
+            addCriterion("carrier_id <", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdLessThanOrEqualTo(String value) {
+            addCriterion("carrier_id <=", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdLike(String value) {
+            addCriterion("carrier_id like", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdNotLike(String value) {
+            addCriterion("carrier_id not like", value, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdIn(List<String> values) {
+            addCriterion("carrier_id in", values, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdNotIn(List<String> values) {
+            addCriterion("carrier_id not in", values, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdBetween(String value1, String value2) {
+            addCriterion("carrier_id between", value1, value2, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCarrierIdNotBetween(String value1, String value2) {
+            addCriterion("carrier_id not between", value1, value2, "carrierId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIsNull() {
+            addCriterion("remark is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIsNotNull() {
+            addCriterion("remark is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkEqualTo(String value) {
+            addCriterion("remark =", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotEqualTo(String value) {
+            addCriterion("remark <>", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkGreaterThan(String value) {
+            addCriterion("remark >", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkGreaterThanOrEqualTo(String value) {
+            addCriterion("remark >=", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLessThan(String value) {
+            addCriterion("remark <", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLessThanOrEqualTo(String value) {
+            addCriterion("remark <=", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLike(String value) {
+            addCriterion("remark like", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotLike(String value) {
+            addCriterion("remark not like", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIn(List<String> values) {
+            addCriterion("remark in", values, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotIn(List<String> values) {
+            addCriterion("remark not in", values, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkBetween(String value1, String value2) {
+            addCriterion("remark between", value1, value2, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotBetween(String value1, String value2) {
+            addCriterion("remark not between", value1, value2, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNull() {
+            addCriterion("is_delete is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNotNull() {
+            addCriterion("is_delete is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteEqualTo(Integer value) {
+            addCriterion("is_delete =", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotEqualTo(Integer value) {
+            addCriterion("is_delete <>", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThan(Integer value) {
+            addCriterion("is_delete >", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_delete >=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThan(Integer value) {
+            addCriterion("is_delete <", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThanOrEqualTo(Integer value) {
+            addCriterion("is_delete <=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIn(List<Integer> values) {
+            addCriterion("is_delete in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotIn(List<Integer> values) {
+            addCriterion("is_delete not in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete not between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNull() {
+            addCriterion("update_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNotNull() {
+            addCriterion("update_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeEqualTo(Date value) {
+            addCriterion("update_time =", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotEqualTo(Date value) {
+            addCriterion("update_time <>", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThan(Date value) {
+            addCriterion("update_time >", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("update_time >=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThan(Date value) {
+            addCriterion("update_time <", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("update_time <=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIn(List<Date> values) {
+            addCriterion("update_time in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotIn(List<Date> values) {
+            addCriterion("update_time not in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
+            addCriterion("update_time between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("update_time not between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

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

@@ -0,0 +1,70 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import java.util.Date;
+
+public class StaffWithUser {
+    private Long id;
+
+    private Long staffId;
+
+    private Long userId;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(Long staffId) {
+        this.staffId = staffId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", staffId=").append(staffId);
+        sb.append(", userId=").append(userId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -0,0 +1,512 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import com.tzld.piaoquan.wecom.utils.page.Page;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class StaffWithUserExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public StaffWithUserExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIsNull() {
+            addCriterion("staff_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIsNotNull() {
+            addCriterion("staff_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdEqualTo(Long value) {
+            addCriterion("staff_id =", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotEqualTo(Long value) {
+            addCriterion("staff_id <>", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThan(Long value) {
+            addCriterion("staff_id >", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("staff_id >=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThan(Long value) {
+            addCriterion("staff_id <", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThanOrEqualTo(Long value) {
+            addCriterion("staff_id <=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIn(List<Long> values) {
+            addCriterion("staff_id in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotIn(List<Long> values) {
+            addCriterion("staff_id not in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdBetween(Long value1, Long value2) {
+            addCriterion("staff_id between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotBetween(Long value1, Long value2) {
+            addCriterion("staff_id not between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNull() {
+            addCriterion("user_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNotNull() {
+            addCriterion("user_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdEqualTo(Long value) {
+            addCriterion("user_id =", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotEqualTo(Long value) {
+            addCriterion("user_id <>", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThan(Long value) {
+            addCriterion("user_id >", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("user_id >=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThan(Long value) {
+            addCriterion("user_id <", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThanOrEqualTo(Long value) {
+            addCriterion("user_id <=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIn(List<Long> values) {
+            addCriterion("user_id in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotIn(List<Long> values) {
+            addCriterion("user_id not in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdBetween(Long value1, Long value2) {
+            addCriterion("user_id between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotBetween(Long value1, Long value2) {
+            addCriterion("user_id not between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNull() {
+            addCriterion("update_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNotNull() {
+            addCriterion("update_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeEqualTo(Date value) {
+            addCriterion("update_time =", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotEqualTo(Date value) {
+            addCriterion("update_time <>", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThan(Date value) {
+            addCriterion("update_time >", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("update_time >=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThan(Date value) {
+            addCriterion("update_time <", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("update_time <=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIn(List<Date> values) {
+            addCriterion("update_time in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotIn(List<Date> values) {
+            addCriterion("update_time not in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
+            addCriterion("update_time between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("update_time not between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

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

@@ -10,6 +10,7 @@ import com.tzld.piaoquan.wecom.model.bo.AdPutFlowParam;
 import com.tzld.piaoquan.wecom.model.bo.VideoDetail;
 import com.tzld.piaoquan.wecom.model.po.MessageAttachment;
 import com.tzld.piaoquan.wecom.model.po.MessageAttachmentExample;
+import com.tzld.piaoquan.wecom.model.po.Staff;
 import com.tzld.piaoquan.wecom.model.vo.MiniprogramVo;
 import com.tzld.piaoquan.wecom.service.MessageAttachmentService;
 import com.tzld.piaoquan.wecom.utils.DateUtil;
@@ -119,19 +120,16 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     }
 
     @Override
-    public String getPage(String staffExtId, Long videoId) {
+    public String getPage(Staff staff, Long videoId) {
         try {
-            StaffExtEnum staffExtEnum = StaffExtEnum.find(staffExtId);
-            if (staffExtEnum == null || videoId == null) {
-                //TODO 枚举里少数据 或者 video为空
+            if (staff == null || staff.getCarrierId() == null) {
                 return "";
             }
-            String carrierId = staffExtEnum.getCarrierId();
-            String page = selectPage(carrierId, videoId);
+            String page = selectPage(staff.getCarrierId(), videoId);
             if (StringUtils.isNotEmpty(page)) {
                 return page;
             }
-            return insertPage(carrierId, videoId, staffExtEnum.getRemark());
+            return insertPage(staff.getCarrierId(), videoId, staff.getRemark());
         } catch (IOException e) {
             e.printStackTrace();
         }

+ 5 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageServiceImpl.java

@@ -32,16 +32,20 @@ public class MessageServiceImpl implements MessageService {
     @Autowired
     private RedisTemplate<String, Object> redisTemplate;
 
-    public void pushMessage(JSONObject jsonObject) {
+    public boolean pushMessage(JSONObject jsonObject) {
         try {
             String accessToken = accessTokenService.getAccessToken();
             String url = POST_MESSAGE_PUSH_URL
                     + "?access_token=" + accessToken;
             String s = httpPoolClientDefault.post(url, jsonObject.toJSONString());
             System.out.println(s);
+            JSONObject res = JSONObject.parseObject(s);
+            Integer code = res.getInteger("errcode");
+            return code == 0;
         } catch (IOException e) {
             e.printStackTrace();
         }
+        return false;
     }
 
     @Override

+ 2 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageAttachmentService.java

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.wecom.service;
 
 import com.tzld.piaoquan.wecom.model.po.MessageAttachment;
+import com.tzld.piaoquan.wecom.model.po.Staff;
 import com.tzld.piaoquan.wecom.model.vo.MessageTextVo;
 import com.tzld.piaoquan.wecom.model.vo.MiniprogramVo;
 
@@ -13,5 +14,5 @@ public interface MessageAttachmentService {
 
     void createGuaranteedMiniprogram(List<MiniprogramVo> miniprogramVoList);
 
-    String getPage(String staffExtId, Long videoId);
+    String getPage(Staff staff, Long videoId);
 }

+ 1 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageService.java

@@ -5,7 +5,7 @@ import com.tzld.piaoquan.wecom.model.vo.MessageTextVo;
 
 public interface MessageService {
 
-    void pushMessage(JSONObject jsonObject);
+    boolean pushMessage(JSONObject jsonObject);
 
     void createMessageText(MessageTextVo messageTextVo);
 

+ 246 - 0
we-com-server/src/main/resources/mapper/StaffMapper.xml

@@ -0,0 +1,246 @@
+<?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.wecom.dao.mapper.StaffMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.Staff">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="staff_ext_id" jdbcType="VARCHAR" property="staffExtId" />
+    <result column="carrier_id" jdbcType="VARCHAR" property="carrierId" />
+    <result column="remark" jdbcType="VARCHAR" property="remark" />
+    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
+    <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>
+      </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, staff_ext_id, carrier_id, remark, is_delete, create_time, update_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from we_com_staff
+    <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_staff
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from we_com_staff
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffExample">
+    delete from we_com_staff
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.Staff">
+    insert into we_com_staff (id, staff_ext_id, carrier_id, 
+      remark, is_delete, create_time, 
+      update_time)
+    values (#{id,jdbcType=BIGINT}, #{staffExtId,jdbcType=VARCHAR}, #{carrierId,jdbcType=VARCHAR}, 
+      #{remark,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.Staff">
+    insert into we_com_staff
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="staffExtId != null">
+        staff_ext_id,
+      </if>
+      <if test="carrierId != null">
+        carrier_id,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
+      <if test="isDelete != null">
+        is_delete,
+      </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="staffExtId != null">
+        #{staffExtId,jdbcType=VARCHAR},
+      </if>
+      <if test="carrierId != null">
+        #{carrierId,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        #{isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffExample" resultType="java.lang.Long">
+    select count(*) from we_com_staff
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update we_com_staff
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.staffExtId != null">
+        staff_ext_id = #{record.staffExtId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.carrierId != null">
+        carrier_id = #{record.carrierId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.remark != null">
+        remark = #{record.remark,jdbcType=VARCHAR},
+      </if>
+      <if test="record.isDelete != null">
+        is_delete = #{record.isDelete,jdbcType=INTEGER},
+      </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" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update we_com_staff
+    set id = #{record.id,jdbcType=BIGINT},
+      staff_ext_id = #{record.staffExtId,jdbcType=VARCHAR},
+      carrier_id = #{record.carrierId,jdbcType=VARCHAR},
+      remark = #{record.remark,jdbcType=VARCHAR},
+      is_delete = #{record.isDelete,jdbcType=INTEGER},
+      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.wecom.model.po.Staff">
+    update we_com_staff
+    <set>
+      <if test="staffExtId != null">
+        staff_ext_id = #{staffExtId,jdbcType=VARCHAR},
+      </if>
+      <if test="carrierId != null">
+        carrier_id = #{carrierId,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        remark = #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        is_delete = #{isDelete,jdbcType=INTEGER},
+      </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.wecom.model.po.Staff">
+    update we_com_staff
+    set staff_ext_id = #{staffExtId,jdbcType=VARCHAR},
+      carrier_id = #{carrierId,jdbcType=VARCHAR},
+      remark = #{remark,jdbcType=VARCHAR},
+      is_delete = #{isDelete,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 241 - 0
we-com-server/src/main/resources/mapper/StaffWithUserMapper.xml

@@ -0,0 +1,241 @@
+<?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.wecom.dao.mapper.StaffWithUserMapper">
+    <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.StaffWithUser">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="staff_id" jdbcType="BIGINT" property="staffId"/>
+        <result column="user_id" jdbcType="BIGINT" property="userId"/>
+        <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>
+            </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
+        , staff_id, user_id, create_time, update_time
+    </sql>
+    <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffWithUserExample"
+            resultMap="BaseResultMap">
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        <include refid="Base_Column_List"/>
+        from we_com_staff_with_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_staff_with_user
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete
+        from we_com_staff_with_user
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffWithUserExample">
+        delete from we_com_staff_with_user
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </delete>
+    <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.StaffWithUser">
+        insert into we_com_staff_with_user (id, staff_id, user_id,
+                                            create_time, update_time)
+        values (#{id,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
+                #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+    </insert>
+    <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.StaffWithUser">
+        insert into we_com_staff_with_user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="staffId != null">
+                staff_id,
+            </if>
+            <if test="userId != null">
+                user_id,
+            </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="staffId != null">
+                #{staffId,jdbcType=BIGINT},
+            </if>
+            <if test="userId != null">
+                #{userId,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+    <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffWithUserExample"
+            resultType="java.lang.Long">
+        select count(*) from we_com_staff_with_user
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </select>
+    <update id="updateByExampleSelective" parameterType="map">
+        update we_com_staff_with_user
+        <set>
+            <if test="record.id != null">
+                id = #{record.id,jdbcType=BIGINT},
+            </if>
+            <if test="record.staffId != null">
+                staff_id = #{record.staffId,jdbcType=BIGINT},
+            </if>
+            <if test="record.userId != null">
+                user_id = #{record.userId,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"/>
+        </if>
+    </update>
+    <update id="updateByExample" parameterType="map">
+        update we_com_staff_with_user
+        set id = #{record.id,jdbcType=BIGINT},
+        staff_id = #{record.staffId,jdbcType=BIGINT},
+        user_id = #{record.userId,jdbcType=BIGINT},
+        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.wecom.model.po.StaffWithUser">
+        update we_com_staff_with_user
+        <set>
+            <if test="staffId != null">
+                staff_id = #{staffId,jdbcType=BIGINT},
+            </if>
+            <if test="userId != null">
+                user_id = #{userId,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.wecom.model.po.StaffWithUser">
+        update we_com_staff_with_user
+        set staff_id    = #{staffId,jdbcType=BIGINT},
+            user_id     = #{userId,jdbcType=BIGINT},
+            create_time = #{createTime,jdbcType=TIMESTAMP},
+            update_time = #{updateTime,jdbcType=TIMESTAMP}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+
+    <insert id="insertList" parameterType="java.util.List">
+        insert into we_com_staff_with_user
+        (
+        id,
+        staff_id,
+        user_id,
+        create_time,
+        update_time
+        )
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.id,jdbcType=BIGINT},
+            #{item.staffId,jdbcType=BIGINT},
+            #{item.userId,jdbcType=BIGINT},
+            #{item.createTime,jdbcType=TIMESTAMP},
+            #{item.updateTime,jdbcType=TIMESTAMP}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 32 - 29
we-com-server/src/main/resources/mapper/UserMapper.xml

@@ -111,17 +111,20 @@
       <include refid="Example_Where_Clause" />
     </if>
   </delete>
-  <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`, 
+  <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`,
       avatar, gender,
-      created_at, updated_at, create_time, 
+      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}, 
+      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}, 
+      #{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>
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.User">
     insert into we_com_user
@@ -350,32 +353,32 @@
   <insert id="insertList" parameterType="java.util.List">
     insert into we_com_user
     (
-     external_user_id,
-     union_id,
-     external_user_id_3rd_party,
-     `type`,
-     `name`,
-     avatar,
-     gender,
-     created_at,
-     updated_at,
-     create_time,
-     update_time
+    external_user_id,
+    union_id,
+    external_user_id_3rd_party,
+    `type`,
+    `name`,
+    avatar,
+    gender,
+    created_at,
+    updated_at,
+    create_time,
+    update_time
     )
     values
     <foreach collection="list" item="item" separator=",">
       (
-       #{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.createTime,jdbcType=TIMESTAMP},
-       #{item.updateTime,jdbcType=TIMESTAMP}
+      #{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.createTime,jdbcType=TIMESTAMP},
+      #{item.updateTime,jdbcType=TIMESTAMP}
       )
     </foreach>
   </insert>

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

@@ -53,6 +53,9 @@
 <!--        <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=""/>-->
+
 
     </context>