DzControlMapper.xml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.dz.mapper.DzControlMapper">
  6. <resultMap type="DzControl" id="DzControlResult">
  7. <result property="id" column="id" />
  8. <result property="location" column="location" />
  9. <result property="startDate" column="start_date" />
  10. <result property="endDate" column="end_date" />
  11. <result property="isValid" column="is_valid" />
  12. <result property="planYear" column="plan_year" />
  13. <result property="submitYear" column="submit_year" />
  14. <result property="examTypes" column="exam_types" />
  15. </resultMap>
  16. <sql id="selectDzControlVo">
  17. select id, location, start_date, end_date, is_valid, plan_year, submit_year, exam_types from dz_control
  18. </sql>
  19. <select id="selectDzControlList" parameterType="DzControl" resultMap="DzControlResult">
  20. <include refid="selectDzControlVo"/>
  21. <where>
  22. <if test="location != null and location != ''"> and location = #{location}</if>
  23. <if test="startDate != null and startDate != ''"> and start_date = #{startDate}</if>
  24. <if test="endDate != null and endDate != ''"> and end_date = #{endDate}</if>
  25. <if test="isValid != null "> and is_valid = #{isValid}</if>
  26. <if test="planYear != null and planYear != ''"> and plan_year = #{planYear}</if>
  27. <if test="submitYear != null and submitYear != ''"> and submit_year = #{submitYear}</if>
  28. <if test="examTypes != null and examTypes != ''"> and exam_types like concat ('%',#{examTypes},'%') </if>
  29. </where>
  30. </select>
  31. <select id="selectDzControlById" parameterType="Long" resultMap="DzControlResult">
  32. <include refid="selectDzControlVo"/>
  33. where id = #{id}
  34. </select>
  35. <insert id="insertDzControl" parameterType="DzControl" useGeneratedKeys="true" keyProperty="id">
  36. insert into dz_control
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="location != null">location,</if>
  39. <if test="startDate != null">start_date,</if>
  40. <if test="endDate != null">end_date,</if>
  41. <if test="isValid != null">is_valid,</if>
  42. <if test="planYear != null">plan_year,</if>
  43. <if test="submitYear != null">submit_year,</if>
  44. <if test="examTypes != null">exam_types,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="location != null">#{location},</if>
  48. <if test="startDate != null">#{startDate},</if>
  49. <if test="endDate != null">#{endDate},</if>
  50. <if test="isValid != null">#{isValid},</if>
  51. <if test="planYear != null">#{planYear},</if>
  52. <if test="submitYear != null">#{submitYear},</if>
  53. <if test="examTypes != null">#{examTypes},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateDzControl" parameterType="DzControl">
  57. update dz_control
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="location != null">location = #{location},</if>
  60. <if test="startDate != null">start_date = #{startDate},</if>
  61. <if test="endDate != null">end_date = #{endDate},</if>
  62. <if test="isValid != null">is_valid = #{isValid},</if>
  63. <if test="planYear != null">plan_year = #{planYear},</if>
  64. <if test="submitYear != null">submit_year = #{submitYear},</if>
  65. <if test="examTypes != null">exam_types = #{examTypes},</if>
  66. </trim>
  67. where id = #{id}
  68. </update>
  69. <delete id="deleteDzControlById" parameterType="Long">
  70. delete from dz_control where id = #{id}
  71. </delete>
  72. <delete id="deleteDzControlByIds" parameterType="String">
  73. delete from dz_control where id in
  74. <foreach item="id" collection="array" open="(" separator="," close=")">
  75. #{id}
  76. </foreach>
  77. </delete>
  78. </mapper>