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

+ 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;

+ 14 - 9
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.xml

@@ -11,13 +11,16 @@
         where room.is_delete = 0
         <trim prefixOverrides="and">
             <if test="param.corpName != null">
-                and corp.name = #{param.corpName}
+                and corp.name like concat('%', #{param.corpName}, '%')
             </if>
             <if test="param.groupLeaderName != null">
-                and staff.name = #{param.groupLeaderName}
+                and staff.name like concat('%', #{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 test="pushAccountIds != null and pushAccountIds.size() > 0">
+                and (room_config.primary_push_account_id in
+                <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+                or room_config.secondary_push_account_id in
+                <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
             </if>
         </trim>
     </select>
@@ -32,14 +35,16 @@
         where room.is_delete = 0
         <trim prefixOverrides="and">
             <if test="param.corpName != null">
-                and corp.name = #{param.corpName}
+                and corp.name like concat('%', #{param.corpName}, '%')
             </if>
             <if test="param.groupLeaderName!= null">
-                and staff.name = #{param.groupLeaderName}
+                and staff.name like concat('%', #{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 test="pushAccountIds != null and pushAccountIds.size() > 0">
+                and (room_config.primary_push_account_id in
+                <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+                or room_config.secondary_push_account_id in
+                <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
             </if>
         </trim>
         order by staff.id desc

+ 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>