ThirdPartWeComRoomMapperExt.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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="pushAccountIds != null and pushAccountIds.size() > 0">
  18. and (room_config.primary_third_staff_id in
  19. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
  20. or room_config.second_third_staff_id in
  21. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
  22. </if>
  23. </select>
  24. <select id="getRoomList"
  25. resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom">
  26. select room.*
  27. from third_part_we_com_room room
  28. join third_part_we_com_staff staff on room.staff_id = staff.id
  29. join third_part_we_com_corp corp on staff.corp_id = corp.id
  30. left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
  31. where room.is_delete = 0
  32. <if test="param.corpName != null">
  33. and corp.name like concat('%', #{param.corpName}, '%')
  34. </if>
  35. <if test="param.groupLeaderName!= null">
  36. and staff.name like concat('%', #{param.groupLeaderName}, '%')
  37. </if>
  38. <if test="pushAccountIds != null and pushAccountIds.size() > 0">
  39. and (room_config.primary_third_staff_id in
  40. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
  41. or room_config.second_third_staff_id in
  42. <foreach collection="pushAccountIds" item="item" open="(" close=")" separator=",">#{item}</foreach>)
  43. </if>
  44. order by staff.id desc
  45. limit #{offset}, #{pageSize}
  46. </select>
  47. <select id="getNoConfigRoomList"
  48. resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom">
  49. select room.*
  50. from third_part_we_com_room room
  51. join third_part_we_com_staff staff on room.staff_id = staff.id
  52. left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
  53. where room.is_delete = 0 and staff.id = #{staffId} and room_config.id is null
  54. </select>
  55. </mapper>