BdglWorkTaskPlanMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.supervision.workingArrangements.mapper.BdglWorkTaskPlanMapper">
  6. <resultMap type="BdglWorkTaskPlan" id="BdglWorkTaskPlanResult">
  7. <result property="id" column="id" />
  8. <result property="taskName" column="task_name" />
  9. <result property="startTime" column="start_time" />
  10. <result property="endTime" column="end_time" />
  11. <result property="remarkInfo" column="remark_info" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. </resultMap>
  17. <resultMap id="BdglWorkTaskPlanBdglWorkTaskPlanAnnerResult" type="BdglWorkTaskPlan" extends="BdglWorkTaskPlanResult">
  18. <collection property="annexList" notNullColumn="sub_id" javaType="java.util.List" resultMap="BdglWorkTaskPlanAnnerResult" />
  19. </resultMap>
  20. <resultMap type="BdglWorkTaskPlanAnner" id="BdglWorkTaskPlanAnnerResult">
  21. <result property="id" column="sub_id" />
  22. <result property="name" column="sub_name" />
  23. <result property="url" column="sub_url" />
  24. <result property="taskPlanId" column="sub_task_plan_id" />
  25. <result property="taskPlanDetailId" column="sub_task_plan_detail_id" />
  26. </resultMap>
  27. <sql id="selectBdglWorkTaskPlanVo">
  28. select id, task_name, start_time, end_time, remark_info, create_by, create_time, update_by, update_time from bdgl_work_task_plan
  29. </sql>
  30. <select id="selectBdglWorkTaskPlanList" parameterType="BdglWorkTaskPlan" resultMap="BdglWorkTaskPlanResult">
  31. <include refid="selectBdglWorkTaskPlanVo"/>
  32. <where>
  33. <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
  34. <if test="createBy != null "> and create_by = #{createBy}</if>
  35. </where>
  36. </select>
  37. <select id="selectBdglWorkTaskPlanById" parameterType="Long" resultMap="BdglWorkTaskPlanBdglWorkTaskPlanAnnerResult">
  38. select a.id, a.task_name, a.start_time, a.end_time, a.remark_info, a.create_by, a.create_time, a.update_by, a.update_time,
  39. b.id as sub_id, b.name as sub_name, b.url as sub_url, b.task_plan_id as sub_task_plan_id,b.task_plan_detail_id as sub_task_plan_detail_id
  40. from bdgl_work_task_plan a
  41. left join bdgl_work_task_plan_anner b on b.task_plan_id = a.id
  42. where a.id = #{id}
  43. </select>
  44. <!--根据任务ID查询任务附件-->
  45. <select id="selectBdglWorkTaskPlanAnnerByTaskPlanId" parameterType="Long" resultType="com.supervision.workingArrangements.domain.BdglWorkTaskPlanAnner">
  46. select id,name,url,task_plan_id as taskPlanId from bdgl_work_task_plan_anner where task_plan_id = #{taskPlanId}
  47. </select>
  48. <!--根据任务详情ID查询任务反馈附件-->
  49. <select id="selectWorkTaskPlanAnnerByTaskPlanDetailId" parameterType="Long" resultType="com.supervision.workingArrangements.domain.BdglWorkTaskPlanAnner">
  50. select id,name,url,task_plan_detail_id as taskPlanDetailId from bdgl_work_task_plan_anner where task_plan_detail_id = #{taskPlanDetailId}
  51. </select>
  52. <insert id="insertBdglWorkTaskPlan" parameterType="BdglWorkTaskPlan" useGeneratedKeys="true" keyProperty="id">
  53. insert into bdgl_work_task_plan
  54. <trim prefix="(" suffix=")" suffixOverrides=",">
  55. <if test="taskName != null and taskName != ''">task_name,</if>
  56. <if test="startTime != null">start_time,</if>
  57. <if test="endTime != null">end_time,</if>
  58. <if test="remarkInfo != null">remark_info,</if>
  59. <if test="createBy != null">create_by,</if>
  60. <if test="createTime != null">create_time,</if>
  61. <if test="updateBy != null">update_by,</if>
  62. <if test="updateTime != null">update_time,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="taskName != null and taskName != ''">#{taskName},</if>
  66. <if test="startTime != null">#{startTime},</if>
  67. <if test="endTime != null">#{endTime},</if>
  68. <if test="remarkInfo != null">#{remarkInfo},</if>
  69. <if test="createBy != null">#{createBy},</if>
  70. <if test="createTime != null">#{createTime},</if>
  71. <if test="updateBy != null">#{updateBy},</if>
  72. <if test="updateTime != null">#{updateTime},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateBdglWorkTaskPlan" parameterType="BdglWorkTaskPlan">
  76. update bdgl_work_task_plan
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
  79. <if test="startTime != null">start_time = #{startTime},</if>
  80. <if test="endTime != null">end_time = #{endTime},</if>
  81. <if test="remarkInfo != null">remark_info = #{remarkInfo},</if>
  82. <if test="createBy != null">create_by = #{createBy},</if>
  83. <if test="createTime != null">create_time = #{createTime},</if>
  84. <if test="updateBy != null">update_by = #{updateBy},</if>
  85. <if test="updateTime != null">update_time = #{updateTime},</if>
  86. </trim>
  87. where id = #{id}
  88. </update>
  89. <delete id="deleteBdglWorkTaskPlanById" parameterType="Long">
  90. delete from bdgl_work_task_plan where id = #{id}
  91. </delete>
  92. <delete id="deleteBdglWorkTaskPlanByIds" parameterType="String">
  93. delete from bdgl_work_task_plan where id in
  94. <foreach item="id" collection="array" open="(" separator="," close=")">
  95. #{id}
  96. </foreach>
  97. </delete>
  98. <delete id="deleteBdglWorkTaskPlanAnnerByTaskPlanIds" parameterType="String">
  99. delete from bdgl_work_task_plan_anner where task_plan_id in
  100. <foreach item="taskPlanId" collection="array" open="(" separator="," close=")">
  101. #{taskPlanId}
  102. </foreach>
  103. </delete>
  104. <delete id="deleteBdglWorkTaskPlanAnnerByTaskPlanId" parameterType="Long">
  105. delete from bdgl_work_task_plan_anner where task_plan_id = #{taskPlanId}
  106. </delete>
  107. <insert id="batchBdglWorkTaskPlanAnner">
  108. insert into bdgl_work_task_plan_anner( id, name, url, task_plan_id) values
  109. <foreach item="item" index="index" collection="list" separator=",">
  110. ( #{item.id}, #{item.name}, #{item.url}, #{item.taskPlanId})
  111. </foreach>
  112. </insert>
  113. <!-- 批量新增任务详情附件-->
  114. <insert id="batchBdglWorkTaskPlanAnnerWithDetail">
  115. insert into bdgl_work_task_plan_anner( id, name, url, task_plan_detail_id) values
  116. <foreach item="item" index="index" collection="list" separator=",">
  117. ( #{item.id}, #{item.name}, #{item.url}, #{item.taskPlanDetailId})
  118. </foreach>
  119. </insert>
  120. </mapper>