NewsMapper.xml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. from xjr_oa_news t
  12. where t.delete_mark = 0
  13. <if test="dto.type != null and dto.type > 0">
  14. and t.type_id = #{dto.type}
  15. </if>
  16. <if test="dto.type != null and dto.type = 1">
  17. and t.wf_status = 1
  18. </if>
  19. <if test="dto.fullHead != null and dto.fullHead != ''">
  20. and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
  21. </if>
  22. <if test="dto.loginId != null and dto.loginId > 0">
  23. and t.create_user_id = #{dto.loginId}
  24. </if>
  25. <if test="dto.keyword != null and dto.keyword != ''">
  26. and (t.full_head LIKE CONCAT('%',#{dto.keyword},'%')
  27. or t.news_content LIKE CONCAT('%',#{dto.keyword},'%'))
  28. </if>
  29. order by t.release_time desc
  30. </select>
  31. <select id="receiptBox" parameterType="com.xjrsoft.module.oa.dto.NewsPageDto"
  32. resultType="com.xjrsoft.module.oa.vo.NewsPageVo">
  33. select
  34. t.*,t2.name as create_user_name
  35. from xjr_oa_news t
  36. left join xjr_user t2 on t.create_user_id = t2.id
  37. where t.delete_mark = 0 and
  38. (t.send_end_date > now() or t.send_end_date is null)
  39. and t.status = 2
  40. <if test="dto.type != null and dto.type == 2 and dto.loginId != null">
  41. and (t.send_range = 1 or t.id in (select news_id from xjr_oa_news_relation t1 where user_id = #{dto.loginId}))
  42. </if>
  43. <if test="dto.type != null and dto.type == 1">
  44. and t.wf_status = 1
  45. </if>
  46. <if test="dto.type != null and dto.type > 0">
  47. and t.type_id = #{dto.type}
  48. </if>
  49. <if test="dto.fullHead != null and dto.fullHead != ''">
  50. and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
  51. </if>
  52. <if test="dto.keyword != null and dto.keyword != ''">
  53. and (t.full_head LIKE CONCAT('%',#{dto.keyword},'%')
  54. or t.news_content LIKE CONCAT('%',#{dto.keyword},'%'))
  55. </if>
  56. order by
  57. t.release_time desc
  58. </select>
  59. <select id="getDeptIdOrClassId" parameterType="java.util.List"
  60. resultType="com.xjrsoft.module.oa.vo.DeptIdOrClassIdVo">
  61. select
  62. t.id as userId,
  63. t2.id as deptId,
  64. t3.id as classId
  65. from xjr_user t
  66. left join xjr_user_dept_relation t1 on t1.user_id = t.id
  67. LEFT JOIN xjr_department t2 ON t2.id = t1.dept_id
  68. left join base_student_school_roll t3 on t3.user_id = t.id
  69. left join base_class t4 on t4.id = t3.class_id
  70. where t.delete_mark = 0
  71. <if test="personalIdList != null and personalIdList.size() > 0">
  72. and t.id in
  73. <foreach item="userId" index="index" collection="personalIdList" open="(" close=")"
  74. separator=",">
  75. #{userId}
  76. </foreach>
  77. </if>
  78. </select>
  79. </mapper>