TTaskInspectionPlanMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.ruoyi.project.task.mapper.TTaskInspectionPlanMapper">
  6. <resultMap type="TTaskInspectionPlan" id="TTaskInspectionPlanResult">
  7. <result property="id" column="id" />
  8. <result property="plantId" column="plant_id" />
  9. <result property="plantName" column="plant_name" />
  10. <result property="inspectionPlanNo" column="inspection_plan_no" />
  11. <result property="inspectionPlanName" column="inspection_plan_name" />
  12. <result property="detectionFrequency" column="detection_frequency" />
  13. <result property="startTime" column="start_time" />
  14. <result property="endTime" column="end_time" />
  15. <result property="pointNum" column="point_num" />
  16. <result property="remarks" column="remarks" />
  17. <result property="deptId" column="dept_id" />
  18. <result property="delFlag" column="del_flag" />
  19. <result property="createrCode" column="creater_code" />
  20. <result property="createdate" column="createdate" />
  21. <result property="updaterCode" column="updater_code" />
  22. <result property="updatedate" column="updatedate" />
  23. <result property="creater" column="creater" />
  24. </resultMap>
  25. <sql id="selectTTaskInspectionPlanVo">
  26. select id, plant_id, inspection_plan_no, inspection_plan_name, detection_frequency, start_time, end_time, point_num, remarks, dept_id, del_flag, creater_code, createdate, updater_code, updatedate from t_task_inspection_plan
  27. </sql>
  28. <select id="selectTTaskInspectionPlanList" parameterType="TTaskInspectionPlan" resultMap="TTaskInspectionPlanResult">
  29. select d.*,bp.plant_name,su.user_name creater from t_task_inspection_plan d
  30. left join t_base_plant bp on bp.id=d.plant_id
  31. left join sys_user su on su.user_id=d.creater_code
  32. <where>
  33. <if test="plantId != null "> and d.plant_id = #{plantId}</if>
  34. <if test="inspectionPlanNo != null and inspectionPlanNo != ''"> and d.inspection_plan_no = #{inspectionPlanNo}</if>
  35. <if test="inspectionPlanName != null and inspectionPlanName != ''"> and d.inspection_plan_name like concat('%', #{inspectionPlanName}, '%')</if>
  36. <if test="detectionFrequency != null and detectionFrequency != ''"> and d.detection_frequency = #{detectionFrequency}</if>
  37. <if test="startTime != null "> and d.start_time = #{startTime}</if>
  38. <if test="endTime != null "> and d.end_time = #{endTime}</if>
  39. <if test="pointNum != null and pointNum != ''"> and d.point_num = #{pointNum}</if>
  40. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  41. <if test="deptId != null "> and d.dept_id = #{deptId}</if>
  42. <if test="createrCode != null "> and d.creater_code = #{createrCode}</if>
  43. <if test="createdate != null "> and d.createdate = #{createdate}</if>
  44. <if test="updaterCode != null "> and d.updater_code = #{updaterCode}</if>
  45. <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
  46. and d.del_flag = 0
  47. </where>
  48. </select>
  49. <select id="selectAllPlan" resultMap="TTaskInspectionPlanResult">
  50. <include refid="selectTTaskInspectionPlanVo"/>
  51. </select>
  52. <select id="selectTTaskInspectionPlanById" parameterType="Long" resultMap="TTaskInspectionPlanResult">
  53. <include refid="selectTTaskInspectionPlanVo"/>
  54. where id = #{id}
  55. </select>
  56. <insert id="insertTTaskInspectionPlan" parameterType="TTaskInspectionPlan" useGeneratedKeys="true" keyProperty="id">
  57. insert into t_task_inspection_plan
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="plantId != null">plant_id,</if>
  60. <if test="inspectionPlanNo != null">inspection_plan_no,</if>
  61. <if test="inspectionPlanName != null">inspection_plan_name,</if>
  62. <if test="detectionFrequency != null">detection_frequency,</if>
  63. <if test="startTime != null">start_time,</if>
  64. <if test="endTime != null">end_time,</if>
  65. <if test="pointNum != null">point_num,</if>
  66. <if test="remarks != null">remarks,</if>
  67. <if test="deptId != null">dept_id,</if>
  68. <if test="delFlag != null">del_flag,</if>
  69. <if test="createrCode != null">creater_code,</if>
  70. <if test="createdate != null">createdate,</if>
  71. <if test="updaterCode != null">updater_code,</if>
  72. <if test="updatedate != null">updatedate,</if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="plantId != null">#{plantId},</if>
  76. <if test="inspectionPlanNo != null">#{inspectionPlanNo},</if>
  77. <if test="inspectionPlanName != null">#{inspectionPlanName},</if>
  78. <if test="detectionFrequency != null">#{detectionFrequency},</if>
  79. <if test="startTime != null">#{startTime},</if>
  80. <if test="endTime != null">#{endTime},</if>
  81. <if test="pointNum != null">#{pointNum},</if>
  82. <if test="remarks != null">#{remarks},</if>
  83. <if test="deptId != null">#{deptId},</if>
  84. <if test="delFlag != null">#{delFlag},</if>
  85. <if test="createrCode != null">#{createrCode},</if>
  86. <if test="createdate != null">#{createdate},</if>
  87. <if test="updaterCode != null">#{updaterCode},</if>
  88. <if test="updatedate != null">#{updatedate},</if>
  89. </trim>
  90. </insert>
  91. <update id="updateTTaskInspectionPlan" parameterType="TTaskInspectionPlan">
  92. update t_task_inspection_plan
  93. <trim prefix="SET" suffixOverrides=",">
  94. <if test="plantId != null">plant_id = #{plantId},</if>
  95. <if test="inspectionPlanNo != null">inspection_plan_no = #{inspectionPlanNo},</if>
  96. <if test="inspectionPlanName != null">inspection_plan_name = #{inspectionPlanName},</if>
  97. <if test="detectionFrequency != null">detection_frequency = #{detectionFrequency},</if>
  98. <if test="startTime != null">start_time = #{startTime},</if>
  99. <if test="endTime != null">end_time = #{endTime},</if>
  100. <if test="pointNum != null">point_num = #{pointNum},</if>
  101. <if test="remarks != null">remarks = #{remarks},</if>
  102. <if test="deptId != null">dept_id = #{deptId},</if>
  103. <if test="delFlag != null">del_flag = #{delFlag},</if>
  104. <if test="createrCode != null">creater_code = #{createrCode},</if>
  105. <if test="createdate != null">createdate = #{createdate},</if>
  106. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  107. <if test="updatedate != null">updatedate = #{updatedate},</if>
  108. </trim>
  109. where id = #{id}
  110. </update>
  111. <delete id="deleteTTaskInspectionPlanById" parameterType="Long">
  112. update t_task_inspection_plan set del_flag=1 where id = #{id}
  113. </delete>
  114. <delete id="deleteTTaskInspectionPlanByIds" parameterType="String">
  115. update t_task_inspection_plan set del_flag=1 where id in
  116. <foreach item="id" collection="array" open="(" separator="," close=")">
  117. #{id}
  118. </foreach>
  119. </delete>
  120. </mapper>