HidWorklistMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.zhgd.scs.mapper.HidWorklistMapper">
  6. <resultMap id="BaseResultMap" type="com.zhgd.scs.domain.HidWorklist">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="fid" column="fid" jdbcType="BIGINT"/>
  9. <result property="createdDate" column="created_date" jdbcType="TIMESTAMP"/>
  10. <result property="createdPerson" column="created_person" jdbcType="BIGINT"/>
  11. <result property="rectificationPerson" column="rectification_person" jdbcType="BIGINT"/>
  12. <result property="approvePerson" column="approve_person" jdbcType="BIGINT"/>
  13. <result property="rectificationDate" column="rectification_date" jdbcType="TIMESTAMP"/>
  14. <result property="content" column="content" jdbcType="VARCHAR"/>
  15. <result property="type" column="type" jdbcType="INTEGER"/>
  16. <result property="state" column="state" jdbcType="INTEGER"/>
  17. <result property="overtime" column="overtime" jdbcType="INTEGER"/>
  18. <result property="ishandle" column="ishandle" jdbcType="INTEGER"/>
  19. <result property="isexamine" column="isexamine" jdbcType="INTEGER"/>
  20. <result property="passDate" column="pass_date" jdbcType="TIMESTAMP"/>
  21. <result property="position" column="position" jdbcType="VARCHAR"/>
  22. <result property="projectId" column="project_id" jdbcType="BIGINT"/>
  23. </resultMap>
  24. <select id="pagelist" resultType="com.zhgd.scs.domain.vo.HidWorklistVo">
  25. SELECT w.*,su1.real_name createdPersonName,su2.real_name rectificationPersonName
  26. FROM hid_worklist w
  27. left join sys_user su1 on w.created_person = su1.id
  28. left join sys_user su2 on w.rectification_person = su2.id
  29. WHERE w.project_id = #{projectId} and w.fid IS NULL
  30. <if test="startDate!= null and endDate!= null ">
  31. AND (w.rectification_date between #{startDate} AND #{endDate} or w.created_date between #{startDate} AND #{endDate})
  32. </if>
  33. <if test="type!= null">
  34. AND w.type = #{type}
  35. </if>
  36. <if test="state!= null">
  37. AND w.state = #{state}
  38. </if>
  39. <if test="isEnd!= null">
  40. AND w.is_end = #{isEnd}
  41. </if>
  42. <if test="overtime!= null">
  43. AND w.overtime = #{overtime}
  44. </if>
  45. <if test="createdPerson!= null">
  46. AND w.created_person = #{createdPerson}
  47. </if>
  48. <if test="rectificationPerson!= null">
  49. AND w.rectification_person = #{rectificationPerson}
  50. </if>
  51. <if test="approvePerson!= null">
  52. AND w.approve_person = #{approvePerson}
  53. </if>
  54. <if test="allPerson!= null">
  55. AND( w.created_person = #{allPerson} or w.rectification_person = #{allPerson} or w.approve_person = #{allPerson})
  56. </if>
  57. <if test="worklistId!= null">
  58. AND w.id &lt; #{worklistId}
  59. </if>
  60. ORDER BY
  61. # CASE WHEN w.state = 3 THEN 1 ELSE 0 END, -- 先按 state=3 排序
  62. w.created_date DESC,w.id DESC -- 然后按 time 倒序排序
  63. </select>
  64. <select id="groupType" resultType="com.zhgd.scs.domain.vo.NameValue">
  65. select
  66. a.type name,
  67. count(a.id) value
  68. FROM
  69. hid_worklist a
  70. where a.project_id = #{projectId} and a.fid IS NULL
  71. <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
  72. and (a.created_date between #{startDate} and #{endDate}
  73. or date(a.created_date) = #{endDate})
  74. </if>
  75. GROUP BY name
  76. </select>
  77. <select id="getRectificationIds" resultType="java.lang.Long">
  78. select id from hid_worklist
  79. where fid = #{id}
  80. </select>
  81. </mapper>