Просмотр исходного кода

Merge branch '20251119-wyp-weCom' into test

wangyunpeng 4 недель назад
Родитель
Сommit
c8281de5b3

+ 2 - 2
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.java

@@ -8,10 +8,10 @@ import java.util.List;
 
 public interface ThirdPartWeComRoomMapperExt {
 
-    int getRoomCount(@Param("param") ThirdPartyRoomListParam param, @Param("pushAccountId") Long pushAccountId);
+    int getRoomCount(@Param("param") ThirdPartyRoomListParam param, @Param("pushAccountIds") List<Long> pushAccountIds);
 
     List<ThirdPartWeComRoom> getRoomList(@Param("param") ThirdPartyRoomListParam param,
-                                         @Param("pushAccountId") Long pushAccountId,
+                                         @Param("pushAccountIds") List<Long> pushAccountIds,
                                          @Param("offset") int offset, @Param("pageSize") Integer pageSize);
 
     List<ThirdPartWeComRoom> getNoConfigRoomList(@Param("staffId") Long id);

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComStaffMapperExt.java

@@ -17,5 +17,5 @@ public interface ThirdPartWeComStaffMapperExt {
                                                @Param("roomId") Long roomId,
                                                @Param("name") String name);
 
-    Long getStaffIdByName(@Param("name") String name);
+    List<Long> getStaffIdByName(@Param("name") String name);
 }

+ 4 - 4
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyRoomServiceImpl.java

@@ -54,16 +54,16 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
     public Page<ThirdPartyRoomVO> list(ThirdPartyRoomListParam param) {
         Page<ThirdPartyRoomVO> result = new Page<>(param.getPageNum(), param.getPageSize());
         int offset = (param.getPageNum() - 1) * param.getPageSize();
-        Long pushAccountId = null;
+        List<Long> pushAccountIds = null;
         if (StringUtils.isNotBlank(param.getPushAccountName())) {
-            pushAccountId = staffMapperExt.getStaffIdByName(param.getPushAccountName());
+            pushAccountIds = staffMapperExt.getStaffIdByName(param.getPushAccountName());
         }
-        int count = roomMapperExt.getRoomCount(param, pushAccountId);
+        int count = roomMapperExt.getRoomCount(param, pushAccountIds);
         result.setTotalSize(count);
         if (count == 0) {
             return result;
         }
-        List<ThirdPartWeComRoom> roomList = roomMapperExt.getRoomList(param, pushAccountId, offset, param.getPageSize());
+        List<ThirdPartWeComRoom> roomList = roomMapperExt.getRoomList(param, pushAccountIds, offset, param.getPageSize());
         List<ThirdPartyRoomVO> list = buildThirdPartyRoomVOList(roomList);
         result.setObjs(list);
         return result;

+ 24 - 23
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.xml

@@ -9,17 +9,18 @@
         join third_part_we_com_corp corp on staff.corp_id = corp.id
         left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
         where room.is_delete = 0
-        <trim prefixOverrides="and">
-            <if test="param.corpName != null">
-                and corp.name = #{param.corpName}
-            </if>
-            <if test="param.groupLeaderName != null">
-                and staff.name = #{param.groupLeaderName}
-            </if>
-            <if test="param.pushAccountName != null">
-                and (room_config.primary_push_account_id = #{pushAccountId} or room_config.secondary_push_account_id = #{pushAccountId})
-            </if>
-        </trim>
+        <if test="param.corpName != null">
+            and corp.name like concat('%', #{param.corpName}, '%')
+        </if>
+        <if test="param.groupLeaderName != null">
+            and staff.name like concat('%', #{param.groupLeaderName}, '%')
+        </if>
+        <if test="pushAccountIds != null and pushAccountIds.size() > 0">
+            and (room_config.primary_third_staff_id in
+            <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+            or room_config.second_third_staff_id in
+            <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
+        </if>
     </select>
 
     <select id="getRoomList"
@@ -30,18 +31,18 @@
         join third_part_we_com_corp corp on staff.corp_id = corp.id
         left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
         where room.is_delete = 0
-        <trim prefixOverrides="and">
-            <if test="param.corpName != null">
-                and corp.name = #{param.corpName}
-            </if>
-            <if test="param.groupLeaderName!= null">
-                and staff.name = #{param.groupLeaderName}
-            </if>
-            <if test="param.pushAccountName != null">
-                and (room_config.primary_push_account_id = #{pushAccountId} or room_config.secondary_push_account_id =
-                #{pushAccountId})
-            </if>
-        </trim>
+        <if test="param.corpName != null">
+            and corp.name like concat('%', #{param.corpName}, '%')
+        </if>
+        <if test="param.groupLeaderName!= null">
+            and staff.name like concat('%', #{param.groupLeaderName}, '%')
+        </if>
+        <if test="pushAccountIds != null and pushAccountIds.size() > 0">
+            and (room_config.primary_third_staff_id in
+            <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+            or room_config.second_third_staff_id in
+            <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
+        </if>
         order by staff.id desc
         limit #{offset}, #{pageSize}
     </select>

+ 5 - 5
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComStaffMapperExt.xml

@@ -9,10 +9,10 @@
         <where>
             <trim prefixOverrides="and">
                 <if test="param.corpName != null">
-                    and corp.name = #{param.corpName}
+                    and corp.name like concat('%', #{param.corpName}, '%')
                 </if>
                 <if test="param.accountName != null">
-                    and staff.name = #{param.accountName}
+                    and staff.name like concat('%', #{param.accountName}, '%')
                 </if>
                 <if test="param.mobile != null">
                     and staff.mobile = #{param.mobile}
@@ -29,10 +29,10 @@
         <where>
             <trim prefixOverrides="and">
                 <if test="param.corpName != null">
-                    and corp.name = #{param.corpName}
+                    and corp.name like concat('%', #{param.corpName}, '%')
                 </if>
                 <if test="param.accountName != null">
-                    and staff.name = #{param.accountName}
+                    and staff.name like concat('%', #{param.accountName}, '%')
                 </if>
                 <if test="param.mobile != null">
                     and staff.mobile = #{param.mobile}
@@ -66,7 +66,7 @@
     <select id="getStaffIdByName" resultType="java.lang.Long">
         select third_staff_id
         from third_part_we_com_staff
-        where name = #{name}
+        where name like concat('%', #{name}, '%')
     </select>
 
 </mapper>