吴树波 1 týždeň pred
rodič
commit
3237738e77

+ 42 - 2
fs-service/src/main/java/com/fs/sop/mapper/SopUserLogsMapper.java

@@ -137,7 +137,6 @@ public interface SopUserLogsMapper {
     @DataSource(DataSourceType.SOP)
     SopUserLogs selectSopUserLogsByDateAndIds(SopUserLogsParamByDate sopUserLogs);
 
-    //TODO left join 改为inner join
     @DataSource(DataSourceType.SOP)
     @Select({"<script> " +
             "SELECT DISTINCT\n" +
@@ -152,7 +151,7 @@ public interface SopUserLogsMapper {
             "            l.user_id,\n" +
             "            DATEDIFF(CURRENT_DATE, l.start_time) + 1 AS count_days\n" +
             "        FROM sop_user_logs l " +
-            "left join sop_user_logs_info i on l.id = i.user_logs_id "  +
+            "inner join sop_user_logs_info i on l.id = i.user_logs_id "  +
             "where 1=1 " +
             "<if test = ' maps.id!=null '> " +
             "and l.id = #{maps.id} " +
@@ -179,6 +178,47 @@ public interface SopUserLogsMapper {
             "</script>"})
     List<SopUserLogsVO> selectSopUserLogsListByParam(@Param("maps") SopUserLogsParam param);
 
+    @DataSource(DataSourceType.SOP)
+    @Select({"<script> " +
+            "SELECT DISTINCT\n" +
+            "            l.id,\n" +
+            "            l.sop_id,\n" +
+            "            l.sop_temp_id,\n" +
+            "            l.qw_user_id,\n" +
+            "            l.corp_id,\n" +
+            "            l.chat_id,\n" +
+            "            l.start_time,\n" +
+            "            l.status,\n" +
+            "            l.user_id,\n" +
+            "            DATEDIFF(CURRENT_DATE, l.start_time) + 1 AS count_days\n" +
+            "        FROM sop_user_logs l " +
+            "left join sop_user_logs_info i on l.id = i.user_logs_id "  +
+            "where 1=1 " +
+            "<if test = ' maps.id!=null '> " +
+            "and l.id = #{maps.id} " +
+            "</if>" +
+            "<if test = ' maps.sopId != null '> " +
+            "and l.sop_id = #{maps.sopId} " +
+            "</if>" +
+            "<if test = ' maps.sopTempId != null '> " +
+            "and l.sop_temp_id = #{maps.sopTempId} " +
+            "</if>" +
+            "<if test = ' maps.qwUserId!=null  '> " +
+            "and l.qw_user_id = #{maps.qwUserId} " +
+            "</if>" +
+            "<if test = ' maps.startTime!=null  '> " +
+            "and l.start_time = #{maps.startTime} " +
+            "</if>" +
+            "<if test = ' maps.status!=null  '> " +
+            "and l.status = #{maps.status} " +
+            "</if>" +
+            "<if test = ' maps.externalUserName!=null and maps.externalUserName != \"\"  '> " +
+            "and i.external_user_name like concat('%', #{maps.externalUserName}, '%') " +
+            "</if>" +
+            "order by start_time desc" +
+            "</script>"})
+    List<SopUserLogsVO> selectSopUserLogsGroupListByParam(@Param("maps") SopUserLogsParam param);
+
 
     @DataSource(DataSourceType.SOP)
     void batchInsertSopUserLogs(@Param("list") List<SopUserLogs> list);

+ 9 - 1
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsServiceImpl.java

@@ -22,6 +22,7 @@ import com.fs.qw.service.IQwGroupChatService;
 import com.fs.qw.vo.QwSopRuleTimeVO;
 import com.fs.qw.vo.QwSopTempSetting;
 import com.fs.qwApi.service.QwApiService;
+import com.fs.sop.domain.QwSop;
 import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.domain.SopUserLogs;
 import com.fs.sop.domain.SopUserLogsInfo;
@@ -616,7 +617,14 @@ public class SopUserLogsServiceImpl  implements ISopUserLogsService {
 
     @Override
     public List<SopUserLogsVO> selectSopUserLogsList(SopUserLogsParam param) {
-        List<SopUserLogsVO> list = sopUserLogsMapper.selectSopUserLogsListByParam(param);
+        QwSop qwSop = sopMapper.selectQwSopById(param.getSopId());
+        Integer filterMode = qwSop.getFilterMode();
+        List<SopUserLogsVO> list;
+        if(filterMode == null || filterMode == 1){
+            list = sopUserLogsMapper.selectSopUserLogsListByParam(param);
+        }else{
+            list = sopUserLogsMapper.selectSopUserLogsGroupListByParam(param);
+        }
         List<String> chatIdList = PubFun.listToNewList(list, SopUserLogsVO::getChatId);
         if(!chatIdList.isEmpty()){
             List<QwGroupChat> qwGroupChatList = qwGroupChatService.selectQwGroupChatByChatIds(chatIdList.toArray(new String[0]));

+ 1 - 1
fs-service/src/main/resources/mapper/sop/QwSopMapper.xml

@@ -247,7 +247,7 @@
         and send_type in(2,3)
         order by create_time desc
     </select>
-    <select id="selectQwSopById" parameterType="String" resultMap="QwSopResult">
+    <select id="selectQwSopById" parameterType="String" resultType="com.fs.sop.domain.QwSop">
         <include refid="selectQwSopVo"/>
         where id = #{id}
     </select>