TaskRestartMapper.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.management.platform.mapper.TaskRestartMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.TaskRestart">
  6. <id column="id" property="id" />
  7. <result column="task_id" property="taskId" />
  8. <result column="operator_id" property="operatorId" />
  9. <result column="restart_date" property="restartDate" />
  10. <result column="restart_reason" property="restartReason" />
  11. <result column="task_comment_id" property="taskCommentId" />
  12. </resultMap>
  13. <!-- 通用查询结果列 -->
  14. <sql id="Base_Column_List">
  15. id, task_id, operator_id, restart_date, restart_reason, task_comment_id
  16. </sql>
  17. <select id="getTaskRestartList" resultType="java.util.Map">
  18. select c.project_name as projectName,c.project_code as projectCode,b.name as taskName,a.restart_reason as restartReason,date_format(a.restart_date,'%Y-%m-%d %H:%i:%s') as restartDate,GROUP_CONCAT(d.person_liable_id) as personLiableIds from task_restart a
  19. left join task b on b.id=a.task_id
  20. left join project c on c.id=b.project_id
  21. left join task_person_liable d on d.task_id=a.task_id
  22. <if test="personLiableId!=null and personLiableId!=''">
  23. left join task_person_liable d2 on d2.task_id=a.task_id
  24. </if>
  25. where c.company_id=#{companyId}
  26. <if test="startDate!=null and endDate!=null">
  27. and a.restart_date between #{startDate} and #{endDate}
  28. </if>
  29. <if test="inchargerId!=null">
  30. and c.incharger_id=#{inchargerId}
  31. </if>
  32. <if test="personLiableId!=null and personLiableId!=''">
  33. and d2.person_liable_id=#{personLiableId}
  34. </if>
  35. <if test="projectId!=null and projectId!=''">
  36. and c.id=#{projectId}
  37. </if>
  38. group by a.id
  39. <if test="start!=null and size!=null">
  40. limit #{start},#{size}
  41. </if>
  42. </select>
  43. <select id="getTaskRestartCount" resultType="java.lang.Long">
  44. select count(1) from (select c.project_name as projectName,c.project_code as projectCode,b.name as taskName,a.restart_reason as restartReason,date_format(a.restart_date,'%Y-%m-%d %H:%i:%s') as restartDate,GROUP_CONCAT(d.person_liable_id) as personLiableIds from task_restart a
  45. left join task b on b.id=a.task_id
  46. left join project c on c.id=b.project_id
  47. left join task_person_liable d on d.task_id=a.task_id
  48. <if test="personLiableId!=null and personLiableId!=''">
  49. left join task_person_liable d2 on d2.task_id=a.task_id
  50. </if>
  51. where c.company_id=#{companyId}
  52. <if test="startDate!=null and endDate!=null">
  53. and a.restart_date between #{startDate} and #{endDate}
  54. </if>
  55. <if test="inchargerId!=null">
  56. and c.incharger_id=#{inchargerId}
  57. </if>
  58. <if test="personLiableId!=null and personLiableId!=''">
  59. and d2.person_liable_id=#{personLiableId}
  60. </if>
  61. <if test="projectId!=null and projectId!=''">
  62. and c.id=#{projectId}
  63. </if>
  64. group by a.id) as total
  65. </select>
  66. </mapper>