NewsMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.oa.mapper.NewsMapper">
  6. <select id="manageBox" parameterType="com.xjrsoft.module.oa.dto.NewsPageDto"
  7. resultType="com.xjrsoft.module.oa.vo.NewsPageVo">
  8. select
  9. t.*,
  10. t2.name as classIdCN,
  11. (select count(*) from xjr_oa_news_relation where reply_content is not null ) as replyContentNum
  12. from xjr_oa_news t
  13. left join xjr_oa_news_relation t1 on t1.news_id = t.id
  14. left join base_class t2 on t2.id = t.class_id
  15. where t.delete_mark = 0
  16. <if test="dto.type != null and dto.type > 0">
  17. and t.type_id = #{dto.type}
  18. </if>
  19. <if test="dto.authorName != null and dto.authorName != ''">
  20. and t.author_name LIKE CONCAT('%',#{dto.authorName},'%')
  21. </if>
  22. <if test="dto.fullHead != null and dto.fullHead != ''">
  23. and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
  24. </if>
  25. <if test="dto.keyword != null and dto.keyword != ''">
  26. and t.keyword LIKE CONCAT('%',#{dto.keyword},'%')
  27. </if>
  28. <if test="dto.loginId != null and dto.loginId > 0">
  29. and t.create_user_id = #{dto.loginId}
  30. </if>
  31. order by t.release_time desc
  32. </select>
  33. <select id="receiptBox" parameterType="com.xjrsoft.module.oa.dto.NewsPageDto"
  34. resultType="com.xjrsoft.module.oa.vo.NewsPageVo">
  35. select
  36. t.*,
  37. t2.name as classIdCN,
  38. (select count(*) from xjr_oa_news_relation where reply_content is not null ) as replyContentNum
  39. from xjr_oa_news t
  40. left join xjr_oa_news_relation t1 on t1.news_id = t.id
  41. left join base_class t2 on t2.id = t.class_id
  42. where t.delete_mark = 0 and
  43. (t.send_end_date > now() or t.send_end_date is null)
  44. <if test="dto.type != null and dto.type > 0">
  45. and t.type_id = #{dto.type}
  46. </if>
  47. <if test="dto.authorName != null and dto.authorName != ''">
  48. and t.author_name LIKE CONCAT('%',#{dto.authorName},'%')
  49. </if>
  50. <if test="dto.fullHead != null and dto.fullHead != ''">
  51. and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
  52. </if>
  53. <if test="dto.keyword != null and dto.keyword != ''">
  54. and t.keyword LIKE CONCAT('%',#{dto.keyword},'%')
  55. </if>
  56. <if test="dto.type != null and dto.type == 2 and dto.loginId != null and dto.loginId > 0">
  57. and t1.user_id = #{dto.loginId}
  58. </if>
  59. order by
  60. t.send_start_date desc
  61. </select>
  62. </mapper>