ThoughtPlanMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.thought.mapper.ThoughtPlanMapper">
  6. <resultMap type="ThoughtPlan" id="ThoughtPlanResult">
  7. <result property="id" column="id" />
  8. <result property="planName" column="plan_name" />
  9. <result property="planStartTime" column="plan_start_time" />
  10. <result property="planEndTime" column="plan_end_time" />
  11. <result property="planIntroduction" column="plan_introduction" />
  12. <result property="filePath" column="file_path" />
  13. <result property="fileName" column="file_name" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="createName" column="create_name" />
  17. <result property="createId" column="create_id" />
  18. <result property="remark" column="remark" />
  19. <result property="planNumber" column="plan_number" />
  20. <result property="responseNumber" column="response_number" />
  21. <result property="unitId" column="unit_id" />
  22. <result property="state" column="state" />
  23. </resultMap>
  24. <sql id="selectThoughtPlanVo">
  25. select id, plan_name, plan_start_time, plan_end_time, plan_introduction, file_path, file_name, create_time, update_time, create_name, create_id, remark, plan_number, response_number, unit_id, state from thought_plan
  26. </sql>
  27. <select id="selectThoughtPlanList" parameterType="ThoughtPlan" resultMap="ThoughtPlanResult">
  28. <include refid="selectThoughtPlanVo"/>
  29. <where>
  30. <if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
  31. <if test="planStartTime != null "> and plan_start_time = #{planStartTime}</if>
  32. <if test="planEndTime != null "> and plan_end_time = #{planEndTime}</if>
  33. <if test="planIntroduction != null and planIntroduction != ''"> and plan_introduction = #{planIntroduction}</if>
  34. <if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
  35. <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
  36. <if test="createName != null and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
  37. <if test="createId != null "> and create_id = #{createId}</if>
  38. <if test="planNumber != null "> and plan_number = #{planNumber}</if>
  39. <if test="responseNumber != null "> and response_number = #{responseNumber}</if>
  40. <if test="unitId != null "> and unit_id = #{unitId}</if>
  41. <if test="state != null and state != ''"> and state = #{state}</if>
  42. </where>
  43. order by id desc
  44. </select>
  45. <select id="selectThoughtPlanById" parameterType="Long" resultMap="ThoughtPlanResult">
  46. <include refid="selectThoughtPlanVo"/>
  47. where id = #{id}
  48. </select>
  49. <select id="selectNewPlan" resultMap="ThoughtPlanResult">
  50. select max(id) id
  51. from thought_plan group by kong
  52. </select>
  53. <insert id="insertThoughtPlan" parameterType="ThoughtPlan" useGeneratedKeys="true" keyProperty="id">
  54. insert into thought_plan
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="planName != null">plan_name,</if>
  57. <if test="planStartTime != null">plan_start_time,</if>
  58. <if test="planEndTime != null">plan_end_time,</if>
  59. <if test="planIntroduction != null">plan_introduction,</if>
  60. <if test="filePath != null">file_path,</if>
  61. <if test="fileName != null">file_name,</if>
  62. <if test="createTime != null">create_time,</if>
  63. <if test="updateTime != null">update_time,</if>
  64. <if test="createName != null">create_name,</if>
  65. <if test="createId != null">create_id,</if>
  66. <if test="remark != null">remark,</if>
  67. <if test="planNumber != null">plan_number,</if>
  68. <if test="responseNumber != null">response_number,</if>
  69. <if test="unitId != null">unit_id,</if>
  70. <if test="state != null">state,</if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="planName != null">#{planName},</if>
  74. <if test="planStartTime != null">#{planStartTime},</if>
  75. <if test="planEndTime != null">#{planEndTime},</if>
  76. <if test="planIntroduction != null">#{planIntroduction},</if>
  77. <if test="filePath != null">#{filePath},</if>
  78. <if test="fileName != null">#{fileName},</if>
  79. <if test="createTime != null">#{createTime},</if>
  80. <if test="updateTime != null">#{updateTime},</if>
  81. <if test="createName != null">#{createName},</if>
  82. <if test="createId != null">#{createId},</if>
  83. <if test="remark != null">#{remark},</if>
  84. <if test="planNumber != null">#{planNumber},</if>
  85. <if test="responseNumber != null">#{responseNumber},</if>
  86. <if test="unitId != null">#{unitId},</if>
  87. <if test="state != null">#{state},</if>
  88. </trim>
  89. </insert>
  90. <update id="updateThoughtPlan" parameterType="ThoughtPlan">
  91. update thought_plan
  92. <trim prefix="SET" suffixOverrides=",">
  93. <if test="planName != null">plan_name = #{planName},</if>
  94. <if test="planStartTime != null">plan_start_time = #{planStartTime},</if>
  95. <if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
  96. <if test="planIntroduction != null">plan_introduction = #{planIntroduction},</if>
  97. <if test="filePath != null">file_path = #{filePath},</if>
  98. <if test="fileName != null">file_name = #{fileName},</if>
  99. <if test="createTime != null">create_time = #{createTime},</if>
  100. <if test="updateTime != null">update_time = #{updateTime},</if>
  101. <if test="createName != null">create_name = #{createName},</if>
  102. <if test="createId != null">create_id = #{createId},</if>
  103. <if test="remark != null">remark = #{remark},</if>
  104. <if test="planNumber != null">plan_number = #{planNumber},</if>
  105. <if test="responseNumber != null">response_number = #{responseNumber},</if>
  106. <if test="unitId != null">unit_id = #{unitId},</if>
  107. <if test="state != null">state = #{state},</if>
  108. </trim>
  109. where id = #{id}
  110. </update>
  111. <delete id="deleteThoughtPlanById" parameterType="Long">
  112. delete from thought_plan where id = #{id}
  113. </delete>
  114. <delete id="deleteThoughtPlanByIds" parameterType="String">
  115. delete from thought_plan where id in
  116. <foreach item="id" collection="array" open="(" separator="," close=")">
  117. #{id}
  118. </foreach>
  119. </delete>
  120. </mapper>