ThirdPartWeComRoomMapperExt.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComRoomMapperExt">
  4. <select id="getRoomCount" resultType="java.lang.Integer">
  5. select count(1)
  6. from third_part_we_com_room room
  7. join third_part_we_com_staff staff on room.staff_id = staff.id
  8. join third_part_we_com_corp corp on staff.corp_id = corp.id
  9. left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
  10. where room.is_delete = 0
  11. <if test="param.corpName != null">
  12. and corp.name like concat('%', #{param.corpName}, '%')
  13. </if>
  14. <if test="param.groupLeaderName != null">
  15. and staff.name like concat('%', #{param.groupLeaderName}, '%')
  16. </if>
  17. <if test="param.roomName != null">
  18. and room.name like concat('%', #{param.roomName}, '%')
  19. </if>
  20. <if test="pushAccountIds != null and pushAccountIds.size() > 0">
  21. and (room_config.primary_third_staff_id in
  22. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
  23. or room_config.second_third_staff_id in
  24. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
  25. </if>
  26. </select>
  27. <select id="getRoomList"
  28. resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom">
  29. select room.*
  30. from third_part_we_com_room room
  31. join third_part_we_com_staff staff on room.staff_id = staff.id
  32. join third_part_we_com_corp corp on staff.corp_id = corp.id
  33. left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
  34. where room.is_delete = 0
  35. <if test="param.corpName != null">
  36. and corp.name like concat('%', #{param.corpName}, '%')
  37. </if>
  38. <if test="param.groupLeaderName!= null">
  39. and staff.name like concat('%', #{param.groupLeaderName}, '%')
  40. </if>
  41. <if test="param.roomName != null">
  42. and room.name like concat('%', #{param.roomName}, '%')
  43. </if>
  44. <if test="pushAccountIds != null and pushAccountIds.size() > 0">
  45. and (room_config.primary_third_staff_id in
  46. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
  47. or room_config.second_third_staff_id in
  48. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
  49. </if>
  50. order by staff.id desc
  51. limit #{offset}, #{pageSize}
  52. </select>
  53. <select id="getNoConfigRoomList"
  54. resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom">
  55. select room.*
  56. from third_part_we_com_room room
  57. join third_part_we_com_staff staff on room.staff_id = staff.id
  58. left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
  59. where room.is_delete = 0 and staff.id = #{staffId} and room_config.id is null
  60. </select>
  61. </mapper>