Selaa lähdekoodia

修改字段名称

xueyiming 8 kuukautta sitten
vanhempi
commit
ab90b720af
34 muutettua tiedostoa jossa 429 lisäystä ja 464 poistoa
  1. 3 4
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/enums/CorpEnum.java
  2. 2 2
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/controller/WeComController.java
  3. 32 0
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/CorpMapper.java
  4. 0 2
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/SendMessageMapper.java
  5. 0 32
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/SubjectMapper.java
  6. 31 31
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComHistoryDataJob.java
  7. 16 16
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComMessageDataJob.java
  8. 15 15
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComStaffDataJob.java
  9. 26 26
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java
  10. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/bo/XxlJobParam.java
  11. 7 7
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/Corp.java
  12. 30 30
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/CorpExample.java
  13. 6 6
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/HistoryMessage.java
  14. 24 24
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/HistoryMessageExample.java
  15. 6 6
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/SendMessage.java
  16. 24 24
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/SendMessageExample.java
  17. 6 6
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/Staff.java
  18. 24 24
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/StaffExample.java
  19. 6 6
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/User.java
  20. 24 24
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/UserExample.java
  21. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/AccessTokenService.java
  22. 13 13
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/AccessTokenServiceImpl.java
  23. 2 2
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageAttachmentServiceImpl.java
  24. 2 2
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageServiceImpl.java
  25. 6 6
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/UserServiceImpl.java
  26. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageAttachmentService.java
  27. 1 1
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageService.java
  28. 2 2
      we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/UserService.java
  29. 35 35
      we-com-server/src/main/resources/mapper/CorpMapper.xml
  30. 16 44
      we-com-server/src/main/resources/mapper/HistoryMessageMapper.xml
  31. 19 19
      we-com-server/src/main/resources/mapper/SendMessageMapper.xml
  32. 15 15
      we-com-server/src/main/resources/mapper/StaffMapper.xml
  33. 28 30
      we-com-server/src/main/resources/mapper/UserMapper.xml
  34. 5 7
      we-com-server/src/main/resources/mybatis-generator-config.xml

+ 3 - 4
we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/enums/SubjectEnum.java → we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/enums/CorpEnum.java

@@ -1,17 +1,16 @@
 package com.tzld.piaoquan.wecom.common.enums;
 
 import lombok.Getter;
-import org.springframework.web.bind.annotation.GetMapping;
 
 @Getter
-public enum SubjectEnum {
+public enum CorpEnum {
 
-    SUBJECT_ENUM_1(1L, "湖南为趣时代");
+    HNWQ(1L, "湖南为趣时代");
 
     final Long id;
     final String desc;
 
-    SubjectEnum(Long id, String desc) {
+    CorpEnum(Long id, String desc) {
         this.id = id;
         this.desc = desc;
     }

+ 2 - 2
we-com-server/src/main/java/com/tzld/piaoquan/wecom/controller/WeComController.java

@@ -21,7 +21,7 @@ import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.util.Map;
 
-import static com.tzld.piaoquan.wecom.common.enums.SubjectEnum.SUBJECT_ENUM_1;
+import static com.tzld.piaoquan.wecom.common.enums.CorpEnum.HNWQ;
 
 @Slf4j
 @RestController
@@ -105,7 +105,7 @@ public class WeComController {
                     String userId = (String) suiteMap.get("UserID");
                     String externalUserId = (String) suiteMap.get("ExternalUserID");
                     log.info("addStaffWithUser userId={} externalUserId={}", userId, externalUserId);
-                    userService.addStaffWithUser(externalUserId, userId, SUBJECT_ENUM_1.getId());
+                    userService.addStaffWithUser(externalUserId, userId, HNWQ.getId());
                 }
 
                 if (StringUtils.isNotEmpty(changeType) && changeType.equals("del_follow_user")) {

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

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

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

@@ -36,8 +36,6 @@ public interface SendMessageMapper {
 
     List<SendMessage> getGroupList(@Param("createTime") Date createTime, @Param("isSend") Integer isSend);
 
-    List<String> selectExternalUserId3rdParty(@Param("record") SendMessage record);
-
     List<String> selectExternalUserId(@Param("record") SendMessage record);
 
 }

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

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

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

@@ -8,7 +8,7 @@ import com.tzld.piaoquan.wecom.common.enums.MessageAttachmentTypeEnum;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
 import com.tzld.piaoquan.wecom.dao.mapper.HistoryMessageMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
-import com.tzld.piaoquan.wecom.dao.mapper.SubjectMapper;
+import com.tzld.piaoquan.wecom.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
 import com.tzld.piaoquan.wecom.model.bo.ExternalUser;
 import com.tzld.piaoquan.wecom.model.bo.MiniprogramRecord;
@@ -69,7 +69,7 @@ public class WeComHistoryDataJob {
     private UserService userService;
 
     @Autowired
-    private SubjectMapper subjectMapper;
+    private CorpMapper corpMapper;
 
 
     @XxlJob("saveHistoryMessageJob")
@@ -95,26 +95,26 @@ public class WeComHistoryDataJob {
         }
         Long startTime = xxlJobParam.getStartTime();
         Long endTime = xxlJobParam.getEndTime();
-        SubjectExample example = new SubjectExample();
-        if (xxlJobParam.getSubjectId() != null) {
-            example.createCriteria().andIdEqualTo(xxlJobParam.getSubjectId());
+        CorpExample example = new CorpExample();
+        if (xxlJobParam.getCorpId() != null) {
+            example.createCriteria().andIdEqualTo(xxlJobParam.getCorpId());
         }
-        List<Subject> subjects = subjectMapper.selectByExample(example);
-        if (CollectionUtils.isEmpty(subjects)) {
+        List<Corp> corps = corpMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(corps)) {
             return ReturnT.SUCCESS;
         }
-        for (Subject subject : subjects) {
+        for (Corp corp : corps) {
             for (; startTime < endTime; startTime += TimeConstant.DAY) {
-                selectGroupMsgList(startTime, Math.min(startTime + TimeConstant.DAY, endTime), subject.getId());
+                selectGroupMsgList(startTime, Math.min(startTime + TimeConstant.DAY, endTime), corp.getId());
             }
         }
-        for (Subject subject : subjects) {
-            selectAlertHistoryMessage(xxlJobParam.getStartTime(), xxlJobParam.getEndTime(), subject.getId(), subject.getName());
+        for (Corp corp : corps) {
+            selectAlertHistoryMessage(xxlJobParam.getStartTime(), xxlJobParam.getEndTime(), corp.getId(), corp.getName());
         }
         return ReturnT.SUCCESS;
     }
 
-    private void selectAlertHistoryMessage(Long startTime, Long endTime, Long subjectId, String subjectName) {
+    private void selectAlertHistoryMessage(Long startTime, Long endTime, Long corpId, String corpName) {
         StaffExample staffExample = new StaffExample();
         List<Staff> staffList = staffMapper.selectByExample(staffExample);
         ArrayList<Integer> statusList = Lists.newArrayList(0, 1, 2, 3);
@@ -129,7 +129,7 @@ public class WeComHistoryDataJob {
                         .andStaffIdEqualTo(staff.getId())
                         .andStatusEqualTo(status)
                         .andIsDeleteEqualTo(0)
-                        .andSubjectIdEqualTo(subjectId);
+                        .andCorpIdEqualTo(corpId);
                 long l = historyMessageMapper.countByExample(example);
                 countList.add(l / MAX_VIDEO_NUM);
             }
@@ -137,7 +137,7 @@ public class WeComHistoryDataJob {
             sendDetailList.add(sendDetail);
         }
         StringBuilder stringBuilder = new StringBuilder();
-        stringBuilder.append(subjectName).append("\n");
+        stringBuilder.append(corpName).append("\n");
         for (SendDetail sendDetail : sendDetailList) {
             List<Long> sendCountList = sendDetail.getSendCountList();
             if (CollectionUtils.isEmpty(sendCountList)) {
@@ -155,12 +155,12 @@ public class WeComHistoryDataJob {
         LarkRobotUtil.sendMessage(stringBuilder.toString());
     }
 
-    private void selectGroupMsgList(Long startTime, Long endTime, Long subjectId) {
+    private void selectGroupMsgList(Long startTime, Long endTime, Long corpId) {
         delHistoryMessageList(startTime, endTime);
         try {
             String cursor = "";
             do {
-                String res = getGroupMsgList(startTime, endTime, cursor, subjectId);
+                String res = getGroupMsgList(startTime, endTime, cursor, corpId);
                 JSONObject jsonObject = JSONObject.parseObject(res);
                 Integer errCode = jsonObject.getInteger("errcode");
                 if (errCode != 0) {
@@ -208,7 +208,7 @@ public class WeComHistoryDataJob {
                         messageAttachment.setType(MessageAttachmentTypeEnum.MINI_PROGRAM.getType());
                         messageAttachmentList.add(messageAttachment);
                     }
-                    List<String> userIdList = selectGroupMsgTask(msgId, subjectId);
+                    List<String> userIdList = selectGroupMsgTask(msgId, corpId);
                     if (CollectionUtils.isEmpty(userIdList)) {
                         continue;
                     }
@@ -220,11 +220,11 @@ public class WeComHistoryDataJob {
                             LarkRobotUtil.sendMessage("企微推送报警:userId不存在请检查 " + userId);
                             continue;
                         }
-                        List<ExternalUser> externalUsers = selectGroupMsgSendResult(msgId, userId, subjectId);
+                        List<ExternalUser> externalUsers = selectGroupMsgSendResult(msgId, userId, corpId);
                         if (CollectionUtils.isEmpty(externalUsers)) {
                             continue;
                         }
-                        insertHistoryMessageList(staffList.get(0), externalUsers, miniprogramRecordList, createTime, subjectId);
+                        insertHistoryMessageList(staffList.get(0), externalUsers, miniprogramRecordList, createTime, corpId);
                         messageAttachmentService.addMiniProgram(messageAttachmentList);
                     }
                 }
@@ -240,11 +240,11 @@ public class WeComHistoryDataJob {
         }
     }
 
-    private List<ExternalUser> selectGroupMsgSendResult(String msgId, String userId, Long subjectId) throws IOException {
+    private List<ExternalUser> selectGroupMsgSendResult(String msgId, String userId, Long corpId) throws IOException {
         List<ExternalUser> resList = new ArrayList<>();
         String cursor = "";
         do {
-            String res = getGroupMsgSendResult(msgId, userId, cursor, subjectId);
+            String res = getGroupMsgSendResult(msgId, userId, cursor, corpId);
             JSONObject jsonObject = JSONObject.parseObject(res);
             Integer errCode = jsonObject.getInteger("errcode");
             if (errCode != 0) {
@@ -272,8 +272,8 @@ public class WeComHistoryDataJob {
         return resList;
     }
 
-    private String getGroupMsgSendResult(String msgId, String userId, String cursor, Long subjectId) throws IOException {
-        String accessToken = accessTokenService.getWeComAccessToken(subjectId);
+    private String getGroupMsgSendResult(String msgId, String userId, String cursor, Long corpId) throws IOException {
+        String accessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = POST_WE_COM_GROUP_MSG_SEND_RESULT
                 + "?access_token=" + accessToken;
         JSONObject param = new JSONObject();
@@ -286,11 +286,11 @@ public class WeComHistoryDataJob {
         return httpPoolClient.post(url, param.toJSONString());
     }
 
-    private List<String> selectGroupMsgTask(String msgId, Long subjectId) throws IOException {
+    private List<String> selectGroupMsgTask(String msgId, Long corpId) throws IOException {
         List<String> resList = new ArrayList<>();
         String cursor = "";
         do {
-            String res = getGroupMsgTask(msgId, cursor, subjectId);
+            String res = getGroupMsgTask(msgId, cursor, corpId);
             JSONObject jsonObject = JSONObject.parseObject(res);
             Integer errCode = jsonObject.getInteger("errcode");
             if (errCode != 0) {
@@ -313,8 +313,8 @@ public class WeComHistoryDataJob {
         return resList;
     }
 
-    private String getGroupMsgTask(String msgId, String cursor, Long subjectId) throws IOException {
-        String accessToken = accessTokenService.getWeComAccessToken(subjectId);
+    private String getGroupMsgTask(String msgId, String cursor, Long corpId) throws IOException {
+        String accessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = POST_WE_COM_GROUP_MSG_TASK
                 + "?access_token=" + accessToken;
         JSONObject param = new JSONObject();
@@ -335,7 +335,7 @@ public class WeComHistoryDataJob {
 
     }
 
-    private void insertHistoryMessageList(Staff staff, List<ExternalUser> externalUsers, List<MiniprogramRecord> miniprogramRecordList, Long createTime, Long subjectId) {
+    private void insertHistoryMessageList(Staff staff, List<ExternalUser> externalUsers, List<MiniprogramRecord> miniprogramRecordList, Long createTime, Long corpId) {
         if (CollectionUtils.isEmpty(externalUsers) || CollectionUtils.isEmpty(miniprogramRecordList)) {
             return;
         }
@@ -363,7 +363,7 @@ public class WeComHistoryDataJob {
                 historyMessage.setUserId(userId);
                 historyMessage.setStaffId(staff.getId());
                 historyMessage.setStatus(status);
-                historyMessage.setSubjectId(subjectId);
+                historyMessage.setCorpId(corpId);
                 historyMessageList.add(historyMessage);
                 if (status == 2) {
                     userService.delStaffWithUser(userId, staff.getId(), sendTime);
@@ -373,8 +373,8 @@ public class WeComHistoryDataJob {
         historyMessageService.batchInsertHistoryMessage(historyMessageList);
     }
 
-    private String getGroupMsgList(Long startTime, Long endTime, String cursor, Long subjectId) throws IOException {
-        String accessToken = accessTokenService.getWeComAccessToken(subjectId);
+    private String getGroupMsgList(Long startTime, Long endTime, String cursor, Long corpId) throws IOException {
+        String accessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = POST_WE_COM_GROUP_MSG_LIST_URL
                 + "?access_token=" + accessToken;
         JSONObject param = new JSONObject();

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

@@ -64,7 +64,7 @@ public class WeComMessageDataJob {
     private SendMessageMapper sendMessageMapper;
 
     @Autowired
-    private SubjectMapper subjectMapper;
+    private CorpMapper corpMapper;
 
 
     //发送小程序标题限制字节数
@@ -146,21 +146,21 @@ public class WeComMessageDataJob {
             xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
         init();
-        SubjectExample subjectExample = new SubjectExample();
-        if (xxlJobParam.getSubjectId() != null) {
-            subjectExample.createCriteria().andIdEqualTo(xxlJobParam.getSubjectId());
+        CorpExample corpExample = new CorpExample();
+        if (xxlJobParam.getCorpId() != null) {
+            corpExample.createCriteria().andIdEqualTo(xxlJobParam.getCorpId());
         }
-        List<Subject> subjects = subjectMapper.selectByExample(subjectExample);
-        if (CollectionUtils.isEmpty(subjects)) {
+        List<Corp> corps = corpMapper.selectByExample(corpExample);
+        if (CollectionUtils.isEmpty(corps)) {
             return ReturnT.SUCCESS;
         }
-        for (Subject subject : subjects) {
+        for (Corp corp : corps) {
             Long staffId = null;
             if (xxlJobParam.getStaffId() != null) {
                 staffId = xxlJobParam.getStaffId();
             }
             UserExample userExample = new UserExample();
-            userExample.createCriteria().andExternalUserIdIsNotNull().andSubjectIdEqualTo(subject.getId());
+            userExample.createCriteria().andExternalUserIdIsNotNull().andCorpIdEqualTo(corp.getId());
             if (xxlJobParam.getUserId() != null) {
                 userExample.createCriteria().andIdEqualTo(xxlJobParam.getUserId());
             }
@@ -177,7 +177,7 @@ public class WeComMessageDataJob {
                 //落库逻辑
                 List<SendMessage> allSeneMessageList = new ArrayList<>();
                 for (User user : userList) {
-                    List<SendMessage> sendMessageList = getSendMessage(user, staffId, subject.getId());
+                    List<SendMessage> sendMessageList = getSendMessage(user, staffId, corp.getId());
                     if (CollectionUtils.isEmpty(sendMessageList)) {
                         continue;
                     }
@@ -220,7 +220,7 @@ public class WeComMessageDataJob {
         redisTemplate.delete(key);
     }
 
-    private List<SendMessage> getSendMessage(User user, Long staffId, Long subjectId) {
+    private List<SendMessage> getSendMessage(User user, Long staffId, Long corpId) {
         StaffWithUserExample example = new StaffWithUserExample();
         StaffWithUserExample.Criteria criteria = example.createCriteria();
         criteria.andUserIdEqualTo(user.getId());
@@ -283,7 +283,7 @@ public class WeComMessageDataJob {
                 LarkRobotUtil.sendMessage("组装数据失败 user=" + user);
                 throw new RuntimeException();
             }
-            sendMessage.setSubjectId(subjectId);
+            sendMessage.setCorpId(corpId);
             sendMessage.setStaffId(staffWithUser.getStaffId());
             sendMessage.setUserId(staffWithUser.getUserId());
             sendMessageList.add(sendMessage);
@@ -299,9 +299,9 @@ public class WeComMessageDataJob {
             xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
         List<SendMessage> groupList = sendMessageMapper.getGroupList(DateUtil.getThatDayDate(), 0);
-        if (xxlJobParam.getSubjectId() != null) {
-            Long subjectId = xxlJobParam.getSubjectId();
-            groupList = groupList.stream().filter(e -> Objects.equals(e.getSubjectId(), subjectId)).collect(Collectors.toList());
+        if (xxlJobParam.getCorpId() != null) {
+            Long corpId = xxlJobParam.getCorpId();
+            groupList = groupList.stream().filter(e -> Objects.equals(e.getCorpId(), corpId)).collect(Collectors.toList());
         }
         if (CollectionUtils.isEmpty(groupList)) {
             return ReturnT.SUCCESS;
@@ -371,7 +371,7 @@ public class WeComMessageDataJob {
                 title = ToolUtils.truncateString(title, MAX_BYTES - 3) + "...";
             }
             miniprogram.put("title", title);
-            String picMediaId = messageAttachmentService.getPicMediaId(messageAttachment.getCover(), sendMessage.getSubjectId());
+            String picMediaId = messageAttachmentService.getPicMediaId(messageAttachment.getCover(), sendMessage.getCorpId());
             if (StringUtils.isEmpty(picMediaId)) {
                 log.error("pushMessage getPicMediaId error cover={}", messageAttachment.getCover());
                 return false;
@@ -407,7 +407,7 @@ public class WeComMessageDataJob {
         }
         for (JSONObject pushJsonObject : pushList) {
             log.info("pushMessage pushJsonObject={}", pushJsonObject);
-            boolean flag = messageService.pushWeComMessage(pushJsonObject, sendMessage.getSubjectId());
+            boolean flag = messageService.pushWeComMessage(pushJsonObject, sendMessage.getCorpId());
             if (!flag) {
                 return flag;
             }

+ 15 - 15
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComStaffDataJob.java

@@ -3,12 +3,12 @@ package com.tzld.piaoquan.wecom.job;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
-import com.tzld.piaoquan.wecom.dao.mapper.SubjectMapper;
+import com.tzld.piaoquan.wecom.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.wecom.model.bo.XxlJobParam;
 import com.tzld.piaoquan.wecom.model.po.Staff;
 import com.tzld.piaoquan.wecom.model.po.StaffExample;
-import com.tzld.piaoquan.wecom.model.po.Subject;
-import com.tzld.piaoquan.wecom.model.po.SubjectExample;
+import com.tzld.piaoquan.wecom.model.po.Corp;
+import com.tzld.piaoquan.wecom.model.po.CorpExample;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
 import com.tzld.piaoquan.wecom.utils.LarkRobotUtil;
@@ -40,7 +40,7 @@ public class WeComStaffDataJob {
     private StaffMapper staffMapper;
 
     @Autowired
-    private SubjectMapper subjectMapper;
+    private CorpMapper corpMapper;
 
     @XxlJob("insertStaffJob")
     public ReturnT<String> insertStaff(String param) {
@@ -49,23 +49,23 @@ public class WeComStaffDataJob {
             if (StringUtils.isNotEmpty(param)) {
                 xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
             }
-            SubjectExample subjectExample = new SubjectExample();
-            if (xxlJobParam.getSubjectId() != null) {
-                subjectExample.createCriteria().andIdEqualTo(xxlJobParam.getSubjectId());
+            CorpExample corpExample = new CorpExample();
+            if (xxlJobParam.getCorpId() != null) {
+                corpExample.createCriteria().andIdEqualTo(xxlJobParam.getCorpId());
             }
-            List<Subject> subjects = subjectMapper.selectByExample(subjectExample);
-            if (CollectionUtils.isEmpty(subjects)) {
+            List<Corp> corps = corpMapper.selectByExample(corpExample);
+            if (CollectionUtils.isEmpty(corps)) {
                 return ReturnT.SUCCESS;
             }
-            for (Subject subject : subjects) {
-                List<String> carrierIdList = getCarrierIdList(subject.getId());
+            for (Corp corp : corps) {
+                List<String> carrierIdList = getCarrierIdList(corp.getId());
                 for (String carrierId : carrierIdList) {
                     StaffExample example = new StaffExample();
-                    example.createCriteria().andCarrierIdEqualTo(carrierId).andSubjectIdEqualTo(subject.getId());
+                    example.createCriteria().andCarrierIdEqualTo(carrierId).andCorpIdEqualTo(corp.getId());
                     List<Staff> staffList = staffMapper.selectByExample(example);
                     if (CollectionUtils.isEmpty(staffList)) {
                         Staff staff = new Staff();
-                        staff.setSubjectId(subject.getId());
+                        staff.setCorpId(corp.getId());
                         staff.setCarrierId(carrierId);
                         staff.setRemark("");
                         staffMapper.insert(staff);
@@ -79,8 +79,8 @@ public class WeComStaffDataJob {
         return ReturnT.SUCCESS;
     }
 
-    private List<String> getCarrierIdList(Long subjectId) throws IOException {
-        String weComAccessToken = accessTokenService.getWeComAccessToken(subjectId);
+    private List<String> getCarrierIdList(Long corpId) throws IOException {
+        String weComAccessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = String.format(GET_WE_COM_FOLLOW_USER_LIST + "?access_token=%s", weComAccessToken);
         String res = httpPoolClient.get(url);
         JSONObject jsonObject = JSONObject.parseObject(res);

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

@@ -3,9 +3,9 @@ package com.tzld.piaoquan.wecom.job;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
+import com.tzld.piaoquan.wecom.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffWithUserMapper;
-import com.tzld.piaoquan.wecom.dao.mapper.SubjectMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
 import com.tzld.piaoquan.wecom.model.bo.XxlJobParam;
 import com.tzld.piaoquan.wecom.model.po.*;
@@ -51,7 +51,7 @@ public class WeComUserDataJob {
     private UserService userService;
 
     @Autowired
-    private SubjectMapper subjectMapper;
+    private CorpMapper corpMapper;
 
     @XxlJob("updateStaffWithUserJob")
     public ReturnT<String> updateStaffWithUser(String param) {
@@ -59,19 +59,19 @@ public class WeComUserDataJob {
         if (StringUtils.isNotEmpty(param)) {
             xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
         }
-        SubjectExample subjectExample = new SubjectExample();
-        SubjectExample.Criteria subjectCriteria = subjectExample.createCriteria();
-        if (xxlJobParam.getSubjectId() != null) {
-            subjectCriteria.andIdEqualTo(xxlJobParam.getSubjectId());
+        CorpExample corpExample = new CorpExample();
+        CorpExample.Criteria corpCriteria = corpExample.createCriteria();
+        if (xxlJobParam.getCorpId() != null) {
+            corpCriteria.andIdEqualTo(xxlJobParam.getCorpId());
         }
-        List<Subject> subjects = subjectMapper.selectByExample(subjectExample);
-        if (CollectionUtils.isEmpty(subjects)) {
+        List<Corp> corps = corpMapper.selectByExample(corpExample);
+        if (CollectionUtils.isEmpty(corps)) {
             return ReturnT.SUCCESS;
         }
-        for (Subject subject : subjects) {
+        for (Corp corp : corps) {
             StaffExample staffExample = new StaffExample();
             StaffExample.Criteria staffCriteria = staffExample.createCriteria();
-            staffCriteria.andSubjectIdEqualTo(subject.getId());
+            staffCriteria.andCorpIdEqualTo(corp.getId());
             if (xxlJobParam.getStaffId() != null) {
                 staffCriteria.andIdEqualTo(xxlJobParam.getStaffId());
             }
@@ -80,18 +80,18 @@ public class WeComUserDataJob {
                 continue;
             }
             for (Staff staff : staffList) {
-                updateUserList(staff, subject.getId());
+                updateUserList(staff, corp.getId());
             }
         }
         return ReturnT.SUCCESS;
     }
 
 
-    private void updateUserList(Staff staff, Long subjectId) {
+    private void updateUserList(Staff staff, Long corpId) {
         try {
             String cursor = "";
             do {
-                String res = getUserDetailList(staff.getCarrierId(), cursor, subjectId);
+                String res = getUserDetailList(staff.getCarrierId(), cursor, corpId);
                 log.info("updateUserList res={} cursor={}", res, cursor);
                 JSONObject jsonObject = JSONObject.parseObject(res);
                 Integer errCode = jsonObject.getInteger("errcode");
@@ -156,8 +156,8 @@ public class WeComUserDataJob {
         }
     }
 
-    private String getUserDetailList(String userId, String cursor, Long subjectId) throws IOException {
-        String accessToken = accessTokenService.getWeComAccessToken(subjectId);
+    private String getUserDetailList(String userId, String cursor, Long corpId) throws IOException {
+        String accessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = POST_WE_COM_GET_BY_USER
                 + "?access_token=" + accessToken;
         JSONObject param = new JSONObject();
@@ -178,27 +178,27 @@ public class WeComUserDataJob {
             if (StringUtils.isNotEmpty(param)) {
                 xxlJobParam = JSONObject.parseObject(param, XxlJobParam.class);
             }
-            SubjectExample subjectExample = new SubjectExample();
-            SubjectExample.Criteria subjectCriteria = subjectExample.createCriteria();
-            if (xxlJobParam.getSubjectId() != null) {
-                subjectCriteria.andIdEqualTo(xxlJobParam.getSubjectId());
+            CorpExample corpExample = new CorpExample();
+            CorpExample.Criteria corpCriteria = corpExample.createCriteria();
+            if (xxlJobParam.getCorpId() != null) {
+                corpCriteria.andIdEqualTo(xxlJobParam.getCorpId());
             }
-            List<Subject> subjects = subjectMapper.selectByExample(subjectExample);
-            for (Subject subject : subjects) {
+            List<Corp> corps = corpMapper.selectByExample(corpExample);
+            for (Corp corp : corps) {
                 StaffExample staffExample = new StaffExample();
                 StaffExample.Criteria staffCriteria = staffExample.createCriteria();
-                staffCriteria.andSubjectIdEqualTo(subject.getId());
+                staffCriteria.andCorpIdEqualTo(corp.getId());
                 if (xxlJobParam.getStaffId() != null) {
                     staffCriteria.andIdEqualTo(xxlJobParam.getStaffId());
                 }
                 List<Staff> staffList = staffMapper.selectByExample(staffExample);
                 for (Staff staff : staffList) {
-                    List<String> externalUserIds = getUserList(staff.getCarrierId(), subject.getId());
+                    List<String> externalUserIds = getUserList(staff.getCarrierId(), corp.getId());
                     if (CollectionUtils.isEmpty(externalUserIds)) {
                         continue;
                     }
                     for (String externalUserId : externalUserIds) {
-                        userService.insertStaffWithUser(externalUserId, staff, subject.getId());
+                        userService.insertStaffWithUser(externalUserId, staff, corp.getId());
                     }
                 }
             }
@@ -211,8 +211,8 @@ public class WeComUserDataJob {
 
     }
 
-    public List<String> getUserList(String userId, Long subjectId) throws IOException {
-        String weComAccessToken = accessTokenService.getWeComAccessToken(subjectId);
+    public List<String> getUserList(String userId, Long corpId) throws IOException {
+        String weComAccessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = String.format(GET_WE_COM_EXTERNAL_CONTACT_LIST + "?access_token=%s&userid=%s", weComAccessToken, userId);
         String res = httpPoolClient.get(url);
         JSONObject jsonObject = JSONObject.parseObject(res);

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

@@ -5,7 +5,7 @@ import lombok.Data;
 @Data
 public class XxlJobParam {
 
-    private Long subjectId;
+    private Long corpId;
 
     private Long startTime;
 

+ 7 - 7
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/Subject.java → we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/Corp.java

@@ -2,12 +2,12 @@ package com.tzld.piaoquan.wecom.model.po;
 
 import java.util.Date;
 
-public class Subject {
+public class Corp {
     private Long id;
 
     private String name;
 
-    private String cropId;
+    private String corpId;
 
     private String secret;
 
@@ -33,12 +33,12 @@ public class Subject {
         this.name = name;
     }
 
-    public String getCropId() {
-        return cropId;
+    public String getCorpId() {
+        return corpId;
     }
 
-    public void setCropId(String cropId) {
-        this.cropId = cropId;
+    public void setCorpId(String corpId) {
+        this.corpId = corpId;
     }
 
     public String getSecret() {
@@ -81,7 +81,7 @@ public class Subject {
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
         sb.append(", name=").append(name);
-        sb.append(", cropId=").append(cropId);
+        sb.append(", corpId=").append(corpId);
         sb.append(", secret=").append(secret);
         sb.append(", isDelete=").append(isDelete);
         sb.append(", createTime=").append(createTime);

+ 30 - 30
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/SubjectExample.java → we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/CorpExample.java

@@ -5,7 +5,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-public class SubjectExample {
+public class CorpExample {
     protected String orderByClause;
 
     protected boolean distinct;
@@ -14,7 +14,7 @@ public class SubjectExample {
 
     protected Page page;
 
-    public SubjectExample() {
+    public CorpExample() {
         oredCriteria = new ArrayList<Criteria>();
     }
 
@@ -246,73 +246,73 @@ public class SubjectExample {
             return (Criteria) this;
         }
 
-        public Criteria andCropIdIsNull() {
-            addCriterion("crop_id is null");
+        public Criteria andCorpIdIsNull() {
+            addCriterion("corp_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdIsNotNull() {
-            addCriterion("crop_id is not null");
+        public Criteria andCorpIdIsNotNull() {
+            addCriterion("corp_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdEqualTo(String value) {
-            addCriterion("crop_id =", value, "cropId");
+        public Criteria andCorpIdEqualTo(String value) {
+            addCriterion("corp_id =", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdNotEqualTo(String value) {
-            addCriterion("crop_id <>", value, "cropId");
+        public Criteria andCorpIdNotEqualTo(String value) {
+            addCriterion("corp_id <>", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdGreaterThan(String value) {
-            addCriterion("crop_id >", value, "cropId");
+        public Criteria andCorpIdGreaterThan(String value) {
+            addCriterion("corp_id >", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdGreaterThanOrEqualTo(String value) {
-            addCriterion("crop_id >=", value, "cropId");
+        public Criteria andCorpIdGreaterThanOrEqualTo(String value) {
+            addCriterion("corp_id >=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdLessThan(String value) {
-            addCriterion("crop_id <", value, "cropId");
+        public Criteria andCorpIdLessThan(String value) {
+            addCriterion("corp_id <", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdLessThanOrEqualTo(String value) {
-            addCriterion("crop_id <=", value, "cropId");
+        public Criteria andCorpIdLessThanOrEqualTo(String value) {
+            addCriterion("corp_id <=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdLike(String value) {
-            addCriterion("crop_id like", value, "cropId");
+        public Criteria andCorpIdLike(String value) {
+            addCriterion("corp_id like", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdNotLike(String value) {
-            addCriterion("crop_id not like", value, "cropId");
+        public Criteria andCorpIdNotLike(String value) {
+            addCriterion("corp_id not like", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdIn(List<String> values) {
-            addCriterion("crop_id in", values, "cropId");
+        public Criteria andCorpIdIn(List<String> values) {
+            addCriterion("corp_id in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdNotIn(List<String> values) {
-            addCriterion("crop_id not in", values, "cropId");
+        public Criteria andCorpIdNotIn(List<String> values) {
+            addCriterion("corp_id not in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdBetween(String value1, String value2) {
-            addCriterion("crop_id between", value1, value2, "cropId");
+        public Criteria andCorpIdBetween(String value1, String value2) {
+            addCriterion("corp_id between", value1, value2, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andCropIdNotBetween(String value1, String value2) {
-            addCriterion("crop_id not between", value1, value2, "cropId");
+        public Criteria andCorpIdNotBetween(String value1, String value2) {
+            addCriterion("corp_id not between", value1, value2, "corpId");
             return (Criteria) this;
         }
 

+ 6 - 6
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/HistoryMessage.java

@@ -5,7 +5,7 @@ import java.util.Date;
 public class HistoryMessage {
     private Long id;
 
-    private Long subjectId;
+    private Long corpId;
 
     private Long userId;
 
@@ -33,12 +33,12 @@ public class HistoryMessage {
         this.id = id;
     }
 
-    public Long getSubjectId() {
-        return subjectId;
+    public Long getCorpId() {
+        return corpId;
     }
 
-    public void setSubjectId(Long subjectId) {
-        this.subjectId = subjectId;
+    public void setCorpId(Long corpId) {
+        this.corpId = corpId;
     }
 
     public Long getUserId() {
@@ -120,7 +120,7 @@ public class HistoryMessage {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", subjectId=").append(subjectId);
+        sb.append(", corpId=").append(corpId);
         sb.append(", userId=").append(userId);
         sb.append(", staffId=").append(staffId);
         sb.append(", videoId=").append(videoId);

+ 24 - 24
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/HistoryMessageExample.java

@@ -176,63 +176,63 @@ public class HistoryMessageExample {
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNull() {
-            addCriterion("subject_id is null");
+        public Criteria andCorpIdIsNull() {
+            addCriterion("corp_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNotNull() {
-            addCriterion("subject_id is not null");
+        public Criteria andCorpIdIsNotNull() {
+            addCriterion("corp_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdEqualTo(Long value) {
-            addCriterion("subject_id =", value, "subjectId");
+        public Criteria andCorpIdEqualTo(Long value) {
+            addCriterion("corp_id =", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotEqualTo(Long value) {
-            addCriterion("subject_id <>", value, "subjectId");
+        public Criteria andCorpIdNotEqualTo(Long value) {
+            addCriterion("corp_id <>", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThan(Long value) {
-            addCriterion("subject_id >", value, "subjectId");
+        public Criteria andCorpIdGreaterThan(Long value) {
+            addCriterion("corp_id >", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThanOrEqualTo(Long value) {
-            addCriterion("subject_id >=", value, "subjectId");
+        public Criteria andCorpIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("corp_id >=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThan(Long value) {
-            addCriterion("subject_id <", value, "subjectId");
+        public Criteria andCorpIdLessThan(Long value) {
+            addCriterion("corp_id <", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThanOrEqualTo(Long value) {
-            addCriterion("subject_id <=", value, "subjectId");
+        public Criteria andCorpIdLessThanOrEqualTo(Long value) {
+            addCriterion("corp_id <=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIn(List<Long> values) {
-            addCriterion("subject_id in", values, "subjectId");
+        public Criteria andCorpIdIn(List<Long> values) {
+            addCriterion("corp_id in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotIn(List<Long> values) {
-            addCriterion("subject_id not in", values, "subjectId");
+        public Criteria andCorpIdNotIn(List<Long> values) {
+            addCriterion("corp_id not in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdBetween(Long value1, Long value2) {
-            addCriterion("subject_id between", value1, value2, "subjectId");
+        public Criteria andCorpIdBetween(Long value1, Long value2) {
+            addCriterion("corp_id between", value1, value2, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotBetween(Long value1, Long value2) {
-            addCriterion("subject_id not between", value1, value2, "subjectId");
+        public Criteria andCorpIdNotBetween(Long value1, Long value2) {
+            addCriterion("corp_id not between", value1, value2, "corpId");
             return (Criteria) this;
         }
 

+ 6 - 6
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/SendMessage.java

@@ -5,7 +5,7 @@ import java.util.Date;
 public class SendMessage {
     private Long id;
 
-    private Long subjectId;
+    private Long corpId;
 
     private Long staffId;
 
@@ -31,12 +31,12 @@ public class SendMessage {
         this.id = id;
     }
 
-    public Long getSubjectId() {
-        return subjectId;
+    public Long getCorpId() {
+        return corpId;
     }
 
-    public void setSubjectId(Long subjectId) {
-        this.subjectId = subjectId;
+    public void setCorpId(Long corpId) {
+        this.corpId = corpId;
     }
 
     public Long getStaffId() {
@@ -110,7 +110,7 @@ public class SendMessage {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", subjectId=").append(subjectId);
+        sb.append(", corpId=").append(corpId);
         sb.append(", staffId=").append(staffId);
         sb.append(", userId=").append(userId);
         sb.append(", videoId1=").append(videoId1);

+ 24 - 24
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/SendMessageExample.java

@@ -176,63 +176,63 @@ public class SendMessageExample {
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNull() {
-            addCriterion("subject_id is null");
+        public Criteria andCorpIdIsNull() {
+            addCriterion("corp_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNotNull() {
-            addCriterion("subject_id is not null");
+        public Criteria andCorpIdIsNotNull() {
+            addCriterion("corp_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdEqualTo(Long value) {
-            addCriterion("subject_id =", value, "subjectId");
+        public Criteria andCorpIdEqualTo(Long value) {
+            addCriterion("corp_id =", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotEqualTo(Long value) {
-            addCriterion("subject_id <>", value, "subjectId");
+        public Criteria andCorpIdNotEqualTo(Long value) {
+            addCriterion("corp_id <>", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThan(Long value) {
-            addCriterion("subject_id >", value, "subjectId");
+        public Criteria andCorpIdGreaterThan(Long value) {
+            addCriterion("corp_id >", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThanOrEqualTo(Long value) {
-            addCriterion("subject_id >=", value, "subjectId");
+        public Criteria andCorpIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("corp_id >=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThan(Long value) {
-            addCriterion("subject_id <", value, "subjectId");
+        public Criteria andCorpIdLessThan(Long value) {
+            addCriterion("corp_id <", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThanOrEqualTo(Long value) {
-            addCriterion("subject_id <=", value, "subjectId");
+        public Criteria andCorpIdLessThanOrEqualTo(Long value) {
+            addCriterion("corp_id <=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIn(List<Long> values) {
-            addCriterion("subject_id in", values, "subjectId");
+        public Criteria andCorpIdIn(List<Long> values) {
+            addCriterion("corp_id in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotIn(List<Long> values) {
-            addCriterion("subject_id not in", values, "subjectId");
+        public Criteria andCorpIdNotIn(List<Long> values) {
+            addCriterion("corp_id not in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdBetween(Long value1, Long value2) {
-            addCriterion("subject_id between", value1, value2, "subjectId");
+        public Criteria andCorpIdBetween(Long value1, Long value2) {
+            addCriterion("corp_id between", value1, value2, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotBetween(Long value1, Long value2) {
-            addCriterion("subject_id not between", value1, value2, "subjectId");
+        public Criteria andCorpIdNotBetween(Long value1, Long value2) {
+            addCriterion("corp_id not between", value1, value2, "corpId");
             return (Criteria) this;
         }
 

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

@@ -5,7 +5,7 @@ import java.util.Date;
 public class Staff {
     private Long id;
 
-    private Long subjectId;
+    private Long corpId;
 
     private String staffExtId;
 
@@ -31,12 +31,12 @@ public class Staff {
         this.id = id;
     }
 
-    public Long getSubjectId() {
-        return subjectId;
+    public Long getCorpId() {
+        return corpId;
     }
 
-    public void setSubjectId(Long subjectId) {
-        this.subjectId = subjectId;
+    public void setCorpId(Long corpId) {
+        this.corpId = corpId;
     }
 
     public String getStaffExtId() {
@@ -110,7 +110,7 @@ public class Staff {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", subjectId=").append(subjectId);
+        sb.append(", corpId=").append(corpId);
         sb.append(", staffExtId=").append(staffExtId);
         sb.append(", carrierId=").append(carrierId);
         sb.append(", remark=").append(remark);

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

@@ -176,63 +176,63 @@ public class StaffExample {
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNull() {
-            addCriterion("subject_id is null");
+        public Criteria andCorpIdIsNull() {
+            addCriterion("corp_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNotNull() {
-            addCriterion("subject_id is not null");
+        public Criteria andCorpIdIsNotNull() {
+            addCriterion("corp_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdEqualTo(Long value) {
-            addCriterion("subject_id =", value, "subjectId");
+        public Criteria andCorpIdEqualTo(Long value) {
+            addCriterion("corp_id =", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotEqualTo(Long value) {
-            addCriterion("subject_id <>", value, "subjectId");
+        public Criteria andCorpIdNotEqualTo(Long value) {
+            addCriterion("corp_id <>", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThan(Long value) {
-            addCriterion("subject_id >", value, "subjectId");
+        public Criteria andCorpIdGreaterThan(Long value) {
+            addCriterion("corp_id >", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThanOrEqualTo(Long value) {
-            addCriterion("subject_id >=", value, "subjectId");
+        public Criteria andCorpIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("corp_id >=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThan(Long value) {
-            addCriterion("subject_id <", value, "subjectId");
+        public Criteria andCorpIdLessThan(Long value) {
+            addCriterion("corp_id <", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThanOrEqualTo(Long value) {
-            addCriterion("subject_id <=", value, "subjectId");
+        public Criteria andCorpIdLessThanOrEqualTo(Long value) {
+            addCriterion("corp_id <=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIn(List<Long> values) {
-            addCriterion("subject_id in", values, "subjectId");
+        public Criteria andCorpIdIn(List<Long> values) {
+            addCriterion("corp_id in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotIn(List<Long> values) {
-            addCriterion("subject_id not in", values, "subjectId");
+        public Criteria andCorpIdNotIn(List<Long> values) {
+            addCriterion("corp_id not in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdBetween(Long value1, Long value2) {
-            addCriterion("subject_id between", value1, value2, "subjectId");
+        public Criteria andCorpIdBetween(Long value1, Long value2) {
+            addCriterion("corp_id between", value1, value2, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotBetween(Long value1, Long value2) {
-            addCriterion("subject_id not between", value1, value2, "subjectId");
+        public Criteria andCorpIdNotBetween(Long value1, Long value2) {
+            addCriterion("corp_id not between", value1, value2, "corpId");
             return (Criteria) this;
         }
 

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

@@ -5,7 +5,7 @@ import java.util.Date;
 public class User {
     private Long id;
 
-    private Long subjectId;
+    private Long corpId;
 
     private String externalUserId;
 
@@ -41,12 +41,12 @@ public class User {
         this.id = id;
     }
 
-    public Long getSubjectId() {
-        return subjectId;
+    public Long getCorpId() {
+        return corpId;
     }
 
-    public void setSubjectId(Long subjectId) {
-        this.subjectId = subjectId;
+    public void setCorpId(Long corpId) {
+        this.corpId = corpId;
     }
 
     public String getExternalUserId() {
@@ -160,7 +160,7 @@ public class User {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", subjectId=").append(subjectId);
+        sb.append(", corpId=").append(corpId);
         sb.append(", externalUserId=").append(externalUserId);
         sb.append(", unionId=").append(unionId);
         sb.append(", externalUserId3rdParty=").append(externalUserId3rdParty);

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

@@ -176,63 +176,63 @@ public class UserExample {
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNull() {
-            addCriterion("subject_id is null");
+        public Criteria andCorpIdIsNull() {
+            addCriterion("corp_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIsNotNull() {
-            addCriterion("subject_id is not null");
+        public Criteria andCorpIdIsNotNull() {
+            addCriterion("corp_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdEqualTo(Long value) {
-            addCriterion("subject_id =", value, "subjectId");
+        public Criteria andCorpIdEqualTo(Long value) {
+            addCriterion("corp_id =", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotEqualTo(Long value) {
-            addCriterion("subject_id <>", value, "subjectId");
+        public Criteria andCorpIdNotEqualTo(Long value) {
+            addCriterion("corp_id <>", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThan(Long value) {
-            addCriterion("subject_id >", value, "subjectId");
+        public Criteria andCorpIdGreaterThan(Long value) {
+            addCriterion("corp_id >", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdGreaterThanOrEqualTo(Long value) {
-            addCriterion("subject_id >=", value, "subjectId");
+        public Criteria andCorpIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("corp_id >=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThan(Long value) {
-            addCriterion("subject_id <", value, "subjectId");
+        public Criteria andCorpIdLessThan(Long value) {
+            addCriterion("corp_id <", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdLessThanOrEqualTo(Long value) {
-            addCriterion("subject_id <=", value, "subjectId");
+        public Criteria andCorpIdLessThanOrEqualTo(Long value) {
+            addCriterion("corp_id <=", value, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdIn(List<Long> values) {
-            addCriterion("subject_id in", values, "subjectId");
+        public Criteria andCorpIdIn(List<Long> values) {
+            addCriterion("corp_id in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotIn(List<Long> values) {
-            addCriterion("subject_id not in", values, "subjectId");
+        public Criteria andCorpIdNotIn(List<Long> values) {
+            addCriterion("corp_id not in", values, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdBetween(Long value1, Long value2) {
-            addCriterion("subject_id between", value1, value2, "subjectId");
+        public Criteria andCorpIdBetween(Long value1, Long value2) {
+            addCriterion("corp_id between", value1, value2, "corpId");
             return (Criteria) this;
         }
 
-        public Criteria andSubjectIdNotBetween(Long value1, Long value2) {
-            addCriterion("subject_id not between", value1, value2, "subjectId");
+        public Criteria andCorpIdNotBetween(Long value1, Long value2) {
+            addCriterion("corp_id not between", value1, value2, "corpId");
             return (Criteria) this;
         }
 

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

@@ -2,6 +2,6 @@ package com.tzld.piaoquan.wecom.service;
 
 public interface AccessTokenService {
 
-    String getWeComAccessToken(Long subjectId);
+    String getWeComAccessToken(Long corpId);
 
 }

+ 13 - 13
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/AccessTokenServiceImpl.java

@@ -2,9 +2,9 @@ package com.tzld.piaoquan.wecom.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
-import com.tzld.piaoquan.wecom.dao.mapper.SubjectMapper;
-import com.tzld.piaoquan.wecom.model.po.Subject;
-import com.tzld.piaoquan.wecom.model.po.SubjectExample;
+import com.tzld.piaoquan.wecom.dao.mapper.CorpMapper;
+import com.tzld.piaoquan.wecom.model.po.Corp;
+import com.tzld.piaoquan.wecom.model.po.CorpExample;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
 import com.tzld.piaoquan.wecom.utils.LarkRobotUtil;
@@ -34,26 +34,26 @@ public class AccessTokenServiceImpl implements AccessTokenService {
     private RedisTemplate<String, Object> redisTemplate;
 
     @Autowired
-    private SubjectMapper subjectMapper;
+    private CorpMapper corpMapper;
 
     @Override
-    public String getWeComAccessToken(Long subjectId) {
+    public String getWeComAccessToken(Long corpId) {
         try {
-            String key = String.format(WE_COM_ACCESS_TOKEN, subjectId);
+            String key = String.format(WE_COM_ACCESS_TOKEN, corpId);
             String accessToken = (String) redisTemplate.opsForValue().get(key);
             if (StringUtils.isNotEmpty(accessToken)) {
                 return accessToken;
             }
-            SubjectExample example = new SubjectExample();
-            example.createCriteria().andIdEqualTo(subjectId);
-            List<Subject> subjects = subjectMapper.selectByExample(example);
-            if (CollectionUtils.isEmpty(subjects)) {
+            CorpExample example = new CorpExample();
+            example.createCriteria().andIdEqualTo(corpId);
+            List<Corp> corps = corpMapper.selectByExample(example);
+            if (CollectionUtils.isEmpty(corps)) {
                 LarkRobotUtil.sendMessage("查询不到主体,获取access_token失败");
                 return "";
             }
-            Subject subject = subjects.get(0);
-            String cropId = subject.getCropId();
-            String secret = subject.getSecret();
+            Corp corp = corps.get(0);
+            String cropId = corp.getCorpId();
+            String secret = corp.getSecret();
             String res = httpPoolClient.get(String.format(GET_WE_COM_ACCESS_TOKEN_URL +
                     "?corpid=%s&corpsecret=%s", cropId, secret));
             JSONObject jsonObject = JSONObject.parseObject(res);

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

@@ -139,7 +139,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     }
 
     @Override
-    public String getPicMediaId(String cover, Long subjectId) {
+    public String getPicMediaId(String cover, Long corpId) {
         String mediaId = (String) redisTemplate.opsForValue().get(cover);
         if (StringUtils.isNotEmpty(mediaId)) {
             return mediaId;
@@ -161,7 +161,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             inputStream.close();
             httpUrl.disconnect();
             File file = new java.io.File(filePath);
-            String weComAccessToken = accessTokenService.getWeComAccessToken(subjectId);
+            String weComAccessToken = accessTokenService.getWeComAccessToken(corpId);
             String url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, "image");
             String res = httpPoolClient.post(url, file);
             JSONObject jsonObject = JSONObject.parseObject(res);

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

@@ -37,9 +37,9 @@ public class MessageServiceImpl implements MessageService {
     private RedisTemplate<String, Object> redisTemplate;
 
     @Override
-    public boolean pushWeComMessage(JSONObject jsonObject, Long subjectId) {
+    public boolean pushWeComMessage(JSONObject jsonObject, Long corpId) {
         try {
-            String accessToken = accessTokenService.getWeComAccessToken(subjectId);
+            String accessToken = accessTokenService.getWeComAccessToken(corpId);
             String url = POST_WE_COM_ADD_MSG_TEMPLATE
                     + "?access_token=" + accessToken;
             String s = httpPoolClient.post(url, jsonObject.toJSONString());

+ 6 - 6
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/UserServiceImpl.java

@@ -43,22 +43,22 @@ public class UserServiceImpl implements UserService {
     private StaffMapper staffMapper;
 
     @Override
-    public void addStaffWithUser(String externalUserId, String carrierId, Long subjectId) {
+    public void addStaffWithUser(String externalUserId, String carrierId, Long corpId) {
         if (StringUtils.isEmpty(externalUserId) || StringUtils.isEmpty(carrierId)) {
             return;
         }
         Staff staff = getStaff(carrierId);
-        insertStaffWithUser(externalUserId, staff, subjectId);
+        insertStaffWithUser(externalUserId, staff, corpId);
     }
 
     @Override
-    public void insertStaffWithUser(String externalUserId, Staff staff, Long subjectId) {
+    public void insertStaffWithUser(String externalUserId, Staff staff, Long corpId) {
         try {
             UserExample userExample = new UserExample();
             userExample.createCriteria().andExternalUserIdEqualTo(externalUserId);
             List<User> userList = userMapper.selectByExample(userExample);
             if (CollectionUtils.isEmpty(userList)) {
-                JSONObject userDetail = getUserDetail(externalUserId, subjectId);
+                JSONObject userDetail = getUserDetail(externalUserId, corpId);
                 if (userDetail == null) {
                     return;
                 }
@@ -206,8 +206,8 @@ public class UserServiceImpl implements UserService {
     }
 
 
-    public JSONObject getUserDetail(String externalUserId, Long subjectId) throws IOException {
-        String weComAccessToken = accessTokenService.getWeComAccessToken(subjectId);
+    public JSONObject getUserDetail(String externalUserId, Long corpId) throws IOException {
+        String weComAccessToken = accessTokenService.getWeComAccessToken(corpId);
         String url = String.format(GET_WE_COM_EXTERNAL_CONTACT_GET + "?access_token=%s&external_userid=%s", weComAccessToken, externalUserId);
         String res = httpPoolClient.get(url);
         JSONObject jsonObject = JSONObject.parseObject(res);

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

@@ -13,7 +13,7 @@ public interface MessageAttachmentService {
 
     CommonResponse<Void> createGuaranteedMiniProgram(GuaranteedParam guaranteedParam);
 
-    String getPicMediaId(String cover, Long subjectId);
+    String getPicMediaId(String cover, Long corpId);
 
     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.MessageTextParam;
 
 public interface MessageService {
 
-    boolean pushWeComMessage(JSONObject jsonObject, Long subjectId);
+    boolean pushWeComMessage(JSONObject jsonObject, Long corpId);
 
     void createMessageText(MessageTextParam messageTextParam);
 

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

@@ -6,9 +6,9 @@ import com.tzld.piaoquan.wecom.model.po.Staff;
 public interface UserService {
 
 
-    void addStaffWithUser(String externalUserId, String staffUserId, Long subjectId);
+    void addStaffWithUser(String externalUserId, String staffUserId, Long corpId);
 
-    void insertStaffWithUser(String externalUserId, Staff staff, Long subjectId);
+    void insertStaffWithUser(String externalUserId, Staff staff, Long corpId);
 
     void delStaffWithUser(String externalUserId, String staffUserId, Long deleteTime);
 

+ 35 - 35
we-com-server/src/main/resources/mapper/SubjectMapper.xml → we-com-server/src/main/resources/mapper/CorpMapper.xml

@@ -1,10 +1,10 @@
 <?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.SubjectMapper">
-  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.Subject">
+<mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.CorpMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.Corp">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="crop_id" jdbcType="VARCHAR" property="cropId" />
+    <result column="corp_id" jdbcType="VARCHAR" property="corpId" />
     <result column="secret" jdbcType="VARCHAR" property="secret" />
     <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -69,15 +69,15 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, `name`, crop_id, secret, is_delete, create_time, update_time
+    id, `name`, corp_id, secret, is_delete, create_time, update_time
   </sql>
-  <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.SubjectExample" resultMap="BaseResultMap">
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.CorpExample" resultMap="BaseResultMap">
     select
     <if test="distinct">
       distinct
     </if>
     <include refid="Base_Column_List" />
-    from we_com_subject
+    from we_com_corp
     <if test="_parameter != null">
       <include refid="Example_Where_Clause" />
     </if>
@@ -91,29 +91,29 @@
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />
-    from we_com_subject
+    from we_com_corp
     where id = #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from we_com_subject
+    delete from we_com_corp
     where id = #{id,jdbcType=BIGINT}
   </delete>
-  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.SubjectExample">
-    delete from we_com_subject
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.CorpExample">
+    delete from we_com_corp
     <if test="_parameter != null">
       <include refid="Example_Where_Clause" />
     </if>
   </delete>
-  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.Subject">
-    insert into we_com_subject (id, `name`, crop_id, 
-      secret, create_time,
+  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.Corp">
+    insert into we_com_corp (id, `name`, corp_id, 
+      secret, is_delete, create_time, 
       update_time)
-    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{cropId,jdbcType=VARCHAR}, 
-      #{secret,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
+    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{corpId,jdbcType=VARCHAR}, 
+      #{secret,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
       #{updateTime,jdbcType=TIMESTAMP})
   </insert>
-  <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.Subject">
-    insert into we_com_subject
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.Corp">
+    insert into we_com_corp
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="id != null">
         id,
@@ -121,8 +121,8 @@
       <if test="name != null">
         `name`,
       </if>
-      <if test="cropId != null">
-        crop_id,
+      <if test="corpId != null">
+        corp_id,
       </if>
       <if test="secret != null">
         secret,
@@ -144,8 +144,8 @@
       <if test="name != null">
         #{name,jdbcType=VARCHAR},
       </if>
-      <if test="cropId != null">
-        #{cropId,jdbcType=VARCHAR},
+      <if test="corpId != null">
+        #{corpId,jdbcType=VARCHAR},
       </if>
       <if test="secret != null">
         #{secret,jdbcType=VARCHAR},
@@ -161,14 +161,14 @@
       </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.SubjectExample" resultType="java.lang.Long">
-    select count(*) from we_com_subject
+  <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.CorpExample" resultType="java.lang.Long">
+    select count(*) from we_com_corp
     <if test="_parameter != null">
       <include refid="Example_Where_Clause" />
     </if>
   </select>
   <update id="updateByExampleSelective" parameterType="map">
-    update we_com_subject
+    update we_com_corp
     <set>
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
@@ -176,8 +176,8 @@
       <if test="record.name != null">
         `name` = #{record.name,jdbcType=VARCHAR},
       </if>
-      <if test="record.cropId != null">
-        crop_id = #{record.cropId,jdbcType=VARCHAR},
+      <if test="record.corpId != null">
+        corp_id = #{record.corpId,jdbcType=VARCHAR},
       </if>
       <if test="record.secret != null">
         secret = #{record.secret,jdbcType=VARCHAR},
@@ -197,10 +197,10 @@
     </if>
   </update>
   <update id="updateByExample" parameterType="map">
-    update we_com_subject
+    update we_com_corp
     set id = #{record.id,jdbcType=BIGINT},
       `name` = #{record.name,jdbcType=VARCHAR},
-      crop_id = #{record.cropId,jdbcType=VARCHAR},
+      corp_id = #{record.corpId,jdbcType=VARCHAR},
       secret = #{record.secret,jdbcType=VARCHAR},
       is_delete = #{record.isDelete,jdbcType=INTEGER},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
@@ -209,14 +209,14 @@
       <include refid="Update_By_Example_Where_Clause" />
     </if>
   </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.Subject">
-    update we_com_subject
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.Corp">
+    update we_com_corp
     <set>
       <if test="name != null">
         `name` = #{name,jdbcType=VARCHAR},
       </if>
-      <if test="cropId != null">
-        crop_id = #{cropId,jdbcType=VARCHAR},
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=VARCHAR},
       </if>
       <if test="secret != null">
         secret = #{secret,jdbcType=VARCHAR},
@@ -233,10 +233,10 @@
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.Subject">
-    update we_com_subject
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.Corp">
+    update we_com_corp
     set `name` = #{name,jdbcType=VARCHAR},
-      crop_id = #{cropId,jdbcType=VARCHAR},
+      corp_id = #{corpId,jdbcType=VARCHAR},
       secret = #{secret,jdbcType=VARCHAR},
       is_delete = #{isDelete,jdbcType=INTEGER},
       create_time = #{createTime,jdbcType=TIMESTAMP},

+ 16 - 44
we-com-server/src/main/resources/mapper/HistoryMessageMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.HistoryMessageMapper">
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="subject_id" jdbcType="BIGINT" property="subjectId" />
+    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
     <result column="user_id" jdbcType="BIGINT" property="userId" />
     <result column="staff_id" jdbcType="BIGINT" property="staffId" />
     <result column="video_id" jdbcType="BIGINT" property="videoId" />
@@ -73,7 +73,7 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, subject_id, user_id, staff_id, video_id, attachment_idx, message_id, `status`, send_time,
+    id, corp_id, user_id, staff_id, video_id, attachment_idx, message_id, `status`, send_time, 
     is_delete, create_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessageExample" resultMap="BaseResultMap">
@@ -110,14 +110,14 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
-    insert into we_com_history_message (id, subject_id, user_id, 
+    insert into we_com_history_message (id, corp_id, user_id, 
       staff_id, video_id, attachment_idx, 
       message_id, `status`, send_time, 
-      create_time)
-    values (#{id,jdbcType=BIGINT}, #{subjectId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, 
+      is_delete, create_time)
+    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, 
       #{staffId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, #{attachmentIdx,jdbcType=INTEGER}, 
       #{messageId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{sendTime,jdbcType=TIMESTAMP}, 
-      #{createTime,jdbcType=TIMESTAMP})
+      #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
     insert into we_com_history_message
@@ -125,8 +125,8 @@
       <if test="id != null">
         id,
       </if>
-      <if test="subjectId != null">
-        subject_id,
+      <if test="corpId != null">
+        corp_id,
       </if>
       <if test="userId != null">
         user_id,
@@ -160,8 +160,8 @@
       <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="subjectId != null">
-        #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        #{corpId,jdbcType=BIGINT},
       </if>
       <if test="userId != null">
         #{userId,jdbcType=BIGINT},
@@ -204,8 +204,8 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
-      <if test="record.subjectId != null">
-        subject_id = #{record.subjectId,jdbcType=BIGINT},
+      <if test="record.corpId != null">
+        corp_id = #{record.corpId,jdbcType=BIGINT},
       </if>
       <if test="record.userId != null">
         user_id = #{record.userId,jdbcType=BIGINT},
@@ -242,7 +242,7 @@
   <update id="updateByExample" parameterType="map">
     update we_com_history_message
     set id = #{record.id,jdbcType=BIGINT},
-      subject_id = #{record.subjectId,jdbcType=BIGINT},
+      corp_id = #{record.corpId,jdbcType=BIGINT},
       user_id = #{record.userId,jdbcType=BIGINT},
       staff_id = #{record.staffId,jdbcType=BIGINT},
       video_id = #{record.videoId,jdbcType=BIGINT},
@@ -259,8 +259,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
     update we_com_history_message
     <set>
-      <if test="subjectId != null">
-        subject_id = #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=BIGINT},
       </if>
       <if test="userId != null">
         user_id = #{userId,jdbcType=BIGINT},
@@ -294,7 +294,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
     update we_com_history_message
-    set subject_id = #{subjectId,jdbcType=BIGINT},
+    set corp_id = #{corpId,jdbcType=BIGINT},
       user_id = #{userId,jdbcType=BIGINT},
       staff_id = #{staffId,jdbcType=BIGINT},
       video_id = #{videoId,jdbcType=BIGINT},
@@ -306,32 +306,4 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <insert id="insertList" parameterType="java.util.List">
-    insert into we_com_history_message
-    (
-    subject_id,
-    user_id,
-    staff_id,
-    video_id,
-    attachment_idx,
-    message_id,
-    `status`,
-    send_time,
-    create_time
-    )
-    values
-    <foreach collection="list" item="item" separator=",">
-      (
-      #{item.subjectId,jdbcType=BIGINT},
-      #{item.userId,jdbcType=BIGINT},
-      #{item.staffId,jdbcType=BIGINT},
-      #{item.videoId,jdbcType=BIGINT},
-      #{item.attachmentIdx,jdbcType=INTEGER},
-      #{item.messageId,jdbcType=BIGINT},
-      #{item.status,jdbcType=INTEGER},
-      #{item.sendTime,jdbcType=TIMESTAMP},
-      #{item.createTime,jdbcType=TIMESTAMP}
-      )
-    </foreach>
-  </insert>
 </mapper>

+ 19 - 19
we-com-server/src/main/resources/mapper/SendMessageMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.SendMessageMapper">
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.SendMessage">
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="subject_id" jdbcType="BIGINT" property="subjectId" />
+    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
     <result column="staff_id" jdbcType="BIGINT" property="staffId" />
     <result column="user_id" jdbcType="BIGINT" property="userId" />
     <result column="video_id_1" jdbcType="BIGINT" property="videoId1" />
@@ -72,7 +72,7 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, subject_id, staff_id, user_id, video_id_1, video_id_2, video_id_3, is_send, create_time, 
+    id, corp_id, staff_id, user_id, video_id_1, video_id_2, video_id_3, is_send, create_time, 
     update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.SendMessageExample" resultMap="BaseResultMap">
@@ -109,11 +109,11 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.SendMessage">
-    insert into we_com_send_message (id, subject_id, staff_id, 
+    insert into we_com_send_message (id, corp_id, staff_id, 
       user_id, video_id_1, video_id_2, 
       video_id_3, is_send, create_time, 
       update_time)
-    values (#{id,jdbcType=BIGINT}, #{subjectId,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT}, 
+    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT}, 
       #{userId,jdbcType=BIGINT}, #{videoId1,jdbcType=BIGINT}, #{videoId2,jdbcType=BIGINT}, 
       #{videoId3,jdbcType=BIGINT}, #{isSend,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
       #{updateTime,jdbcType=TIMESTAMP})
@@ -124,8 +124,8 @@
       <if test="id != null">
         id,
       </if>
-      <if test="subjectId != null">
-        subject_id,
+      <if test="corpId != null">
+        corp_id,
       </if>
       <if test="staffId != null">
         staff_id,
@@ -156,8 +156,8 @@
       <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="subjectId != null">
-        #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        #{corpId,jdbcType=BIGINT},
       </if>
       <if test="staffId != null">
         #{staffId,jdbcType=BIGINT},
@@ -197,8 +197,8 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
-      <if test="record.subjectId != null">
-        subject_id = #{record.subjectId,jdbcType=BIGINT},
+      <if test="record.corpId != null">
+        corp_id = #{record.corpId,jdbcType=BIGINT},
       </if>
       <if test="record.staffId != null">
         staff_id = #{record.staffId,jdbcType=BIGINT},
@@ -232,7 +232,7 @@
   <update id="updateByExample" parameterType="map">
     update we_com_send_message
     set id = #{record.id,jdbcType=BIGINT},
-      subject_id = #{record.subjectId,jdbcType=BIGINT},
+      corp_id = #{record.corpId,jdbcType=BIGINT},
       staff_id = #{record.staffId,jdbcType=BIGINT},
       user_id = #{record.userId,jdbcType=BIGINT},
       video_id_1 = #{record.videoId1,jdbcType=BIGINT},
@@ -248,8 +248,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.SendMessage">
     update we_com_send_message
     <set>
-      <if test="subjectId != null">
-        subject_id = #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=BIGINT},
       </if>
       <if test="staffId != null">
         staff_id = #{staffId,jdbcType=BIGINT},
@@ -280,7 +280,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.SendMessage">
     update we_com_send_message
-    set subject_id = #{subjectId,jdbcType=BIGINT},
+    set corp_id = #{corpId,jdbcType=BIGINT},
       staff_id = #{staffId,jdbcType=BIGINT},
       user_id = #{userId,jdbcType=BIGINT},
       video_id_1 = #{videoId1,jdbcType=BIGINT},
@@ -295,7 +295,7 @@
   <insert id="insertList" parameterType="java.util.List">
     insert into we_com_send_message
     (
-    subject_id,
+    corp_id,
     staff_id,
     user_id,
     video_id_1,
@@ -305,7 +305,7 @@
     values
     <foreach collection="list" item="item" separator=",">
       (
-      #{item.subjectId,jdbcType=BIGINT},
+      #{item.corpId,jdbcType=BIGINT},
       #{item.staffId,jdbcType=BIGINT},
       #{item.userId,jdbcType=BIGINT},
       #{item.videoId1,jdbcType=BIGINT},
@@ -316,18 +316,18 @@
   </insert>
 
   <select id="getGroupList" resultMap="BaseResultMap">
-      select subject_id, staff_id, video_id_1, video_id_2, video_id_3
+      select corp_id, staff_id, video_id_1, video_id_2, video_id_3
       from we_com_send_message
       where create_time >= #{createTime}
         and is_send = #{isSend}
-      group by subject_id, staff_id, video_id_1, video_id_2, video_id_3
+      group by corp_id, staff_id, video_id_1, video_id_2, video_id_3
   </select>
 
   <select id="selectExternalUserId" parameterType="com.tzld.piaoquan.wecom.model.po.SendMessage" resultType="java.lang.String">
     select
       t2.external_user_id
     from we_com_send_message t1 left join we_com_user t2 on t1.user_id = t2.id
-    where t1.subject_id = #{record.subjectId}
+    where t1.corp_id = #{record.corpId}
       and t1.staff_id = #{record.staffId}
       and t1.video_id_1 = #{record.videoId1}
       and t1.video_id_2 = #{record.videoId2}

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

@@ -3,7 +3,7 @@
 <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="subject_id" jdbcType="BIGINT" property="subjectId" />
+    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
     <result column="staff_ext_id" jdbcType="VARCHAR" property="staffExtId" />
     <result column="carrier_id" jdbcType="VARCHAR" property="carrierId" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
@@ -72,8 +72,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, subject_id, staff_ext_id, carrier_id, remark, category1, category2, is_delete, 
-    create_time, update_time
+    id, corp_id, staff_ext_id, carrier_id, remark, category1, category2, is_delete, create_time, 
+    update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.StaffExample" resultMap="BaseResultMap">
     select
@@ -109,11 +109,11 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.Staff">
-    insert into we_com_staff (id, subject_id, staff_ext_id, 
+    insert into we_com_staff (id, corp_id, staff_ext_id, 
       carrier_id, remark, category1, 
       category2, create_time,
       update_time)
-    values (#{id,jdbcType=BIGINT}, #{subjectId,jdbcType=BIGINT}, #{staffExtId,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{staffExtId,jdbcType=VARCHAR}, 
       #{carrierId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{category1,jdbcType=VARCHAR}, 
       #{category2,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
       #{updateTime,jdbcType=TIMESTAMP})
@@ -124,8 +124,8 @@
       <if test="id != null">
         id,
       </if>
-      <if test="subjectId != null">
-        subject_id,
+      <if test="corpId != null">
+        corp_id,
       </if>
       <if test="staffExtId != null">
         staff_ext_id,
@@ -156,8 +156,8 @@
       <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="subjectId != null">
-        #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        #{corpId,jdbcType=BIGINT},
       </if>
       <if test="staffExtId != null">
         #{staffExtId,jdbcType=VARCHAR},
@@ -197,8 +197,8 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
-      <if test="record.subjectId != null">
-        subject_id = #{record.subjectId,jdbcType=BIGINT},
+      <if test="record.corpId != null">
+        corp_id = #{record.corpId,jdbcType=BIGINT},
       </if>
       <if test="record.staffExtId != null">
         staff_ext_id = #{record.staffExtId,jdbcType=VARCHAR},
@@ -232,7 +232,7 @@
   <update id="updateByExample" parameterType="map">
     update we_com_staff
     set id = #{record.id,jdbcType=BIGINT},
-      subject_id = #{record.subjectId,jdbcType=BIGINT},
+      corp_id = #{record.corpId,jdbcType=BIGINT},
       staff_ext_id = #{record.staffExtId,jdbcType=VARCHAR},
       carrier_id = #{record.carrierId,jdbcType=VARCHAR},
       remark = #{record.remark,jdbcType=VARCHAR},
@@ -248,8 +248,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.Staff">
     update we_com_staff
     <set>
-      <if test="subjectId != null">
-        subject_id = #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=BIGINT},
       </if>
       <if test="staffExtId != null">
         staff_ext_id = #{staffExtId,jdbcType=VARCHAR},
@@ -280,7 +280,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.Staff">
     update we_com_staff
-    set subject_id = #{subjectId,jdbcType=BIGINT},
+    set corp_id = #{corpId,jdbcType=BIGINT},
       staff_ext_id = #{staffExtId,jdbcType=VARCHAR},
       carrier_id = #{carrierId,jdbcType=VARCHAR},
       remark = #{remark,jdbcType=VARCHAR},

+ 28 - 30
we-com-server/src/main/resources/mapper/UserMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.UserMapper">
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.User">
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="subject_id" jdbcType="BIGINT" property="subjectId" />
+    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
     <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId" />
     <result column="union_id" jdbcType="VARCHAR" property="unionId" />
     <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty" />
@@ -77,7 +77,7 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, subject_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`,
+    id, corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`, 
     avatar, 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">
@@ -98,7 +98,7 @@
     </if>
   </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select
+    select 
     <include refid="Base_Column_List" />
     from we_com_user
     where id = #{id,jdbcType=BIGINT}
@@ -113,21 +113,19 @@
       <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, subject_id,external_user_id, union_id,
-    external_user_id_3rd_party, `type`, `name`,
-    avatar, gender,
-    created_at, updated_at, deleted_at,
-    create_time, update_time)
-    values (#{id,jdbcType=BIGINT}, #{subjectId,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}, #{deletedAt,jdbcType=BIGINT},
-    #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
-    <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-      select LAST_INSERT_ID()
-    </selectKey>
+  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.User">
+    insert into we_com_user (id, corp_id, external_user_id, 
+      union_id, external_user_id_3rd_party, `type`, 
+      `name`, avatar, gender, 
+      created_at, updated_at,
+      deleted_at, create_time, update_time
+      )
+    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, 
+      #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, 
+      #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, 
+      #{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
@@ -135,8 +133,8 @@
       <if test="id != null">
         id,
       </if>
-      <if test="subjectId != null">
-        subject_id,
+      <if test="corpId != null">
+        corp_id,
       </if>
       <if test="externalUserId != null">
         external_user_id,
@@ -182,8 +180,8 @@
       <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="subjectId != null">
-        #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        #{corpId,jdbcType=BIGINT},
       </if>
       <if test="externalUserId != null">
         #{externalUserId,jdbcType=VARCHAR},
@@ -238,8 +236,8 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
-      <if test="record.subjectId != null">
-        subject_id = #{record.subjectId,jdbcType=BIGINT},
+      <if test="record.corpId != null">
+        corp_id = #{record.corpId,jdbcType=BIGINT},
       </if>
       <if test="record.externalUserId != null">
         external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
@@ -288,7 +286,7 @@
   <update id="updateByExample" parameterType="map">
     update we_com_user
     set id = #{record.id,jdbcType=BIGINT},
-      subject_id = #{record.subjectId,jdbcType=BIGINT},
+      corp_id = #{record.corpId,jdbcType=BIGINT},
       external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
       union_id = #{record.unionId,jdbcType=VARCHAR},
       external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
@@ -309,8 +307,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.User">
     update we_com_user
     <set>
-      <if test="subjectId != null">
-        subject_id = #{subjectId,jdbcType=BIGINT},
+      <if test="corpId != null">
+        corp_id = #{corpId,jdbcType=BIGINT},
       </if>
       <if test="externalUserId != null">
         external_user_id = #{externalUserId,jdbcType=VARCHAR},
@@ -356,7 +354,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.User">
     update we_com_user
-    set subject_id = #{subjectId,jdbcType=BIGINT},
+    set corp_id = #{corpId,jdbcType=BIGINT},
       external_user_id = #{externalUserId,jdbcType=VARCHAR},
       union_id = #{unionId,jdbcType=VARCHAR},
       external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
@@ -389,7 +387,7 @@
     <insert id="insertList" parameterType="java.util.List">
         insert into we_com_user
         (
-        subject_id,
+        corp_id,
         external_user_id,
         union_id,
         external_user_id_3rd_party,
@@ -406,7 +404,7 @@
         values
         <foreach collection="list" item="item" separator=",">
             (
-            #{item.subjectId,jdbcType=BIGINT}
+            #{item.corpId,jdbcType=BIGINT}
             #{item.externalUserId,jdbcType=VARCHAR},
             #{item.unionId,jdbcType=VARCHAR},
             #{item.externalUserId3rdParty,jdbcType=VARCHAR},

+ 5 - 7
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-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false"
+                        connectionURL="jdbc:mysql://rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false"
                         userId="crawler" password="crawler123456@">
         </jdbcConnection>
 
@@ -53,13 +53,11 @@
 <!--        <table tableName="we_com_alert_message" domainObjectName="AlertMessage" 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" 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_user" domainObjectName="User" alias=""/>-->
-<!--        <table tableName="we_com_subject" domainObjectName="Subject" alias=""/>-->
-
-
+        <table tableName="we_com_send_message" domainObjectName="SendMessage" alias=""/>
+        <table tableName="we_com_user" domainObjectName="User" alias=""/>
+        <table tableName="we_com_corp" domainObjectName="Corp" alias=""/>
 
     </context>