MeasBatchMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.meas.system.mapper.MeasBatchMapper">
  6. <resultMap type="MeasBatch" id="MeasBatchResult">
  7. <result property="id" column="id"/>
  8. <result property="engineId" column="engine_id"/>
  9. <result property="engineModel" column="engine_model"/>
  10. <result property="measurementBatch" column="measurement_batch"/>
  11. <result property="createBy" column="create_by"/>
  12. <result property="createTime" column="create_time"/>
  13. <result property="updateBy" column="update_by"/>
  14. <result property="updateTime" column="update_time"/>
  15. </resultMap>
  16. <sql id="selectMeasBatchVo">
  17. SELECT
  18. mb.id,
  19. mb.engine_id,
  20. mem.model engine_model,
  21. mb.measurement_batch,
  22. mb.create_by,
  23. mb.create_time,
  24. mb.update_by,
  25. mb.update_time
  26. FROM
  27. meas_batch mb
  28. LEFT JOIN meas_engine_model mem on mb.engine_id = mem.id
  29. </sql>
  30. <select id="selectMeasBatchList" parameterType="MeasBatch" resultMap="MeasBatchResult">
  31. <include refid="selectMeasBatchVo"/>
  32. <where>
  33. <if test="engineModel != null ">and mb.engine_id = #{engineModel}</if>
  34. <if test="measurementBatch != null and measurementBatch != ''">and mb.id = #{measurementBatch}
  35. </if>
  36. </where>
  37. order by mb.create_time desc
  38. </select>
  39. <select id="selectMeasBatchById" parameterType="Long" resultMap="MeasBatchResult">
  40. <include refid="selectMeasBatchVo"/>
  41. where mb.id = #{id}
  42. </select>
  43. <insert id="insertMeasBatch" parameterType="MeasBatch" useGeneratedKeys="true" keyProperty="id">
  44. insert into meas_batch
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="id != null">id,</if>
  47. <if test="engineId != null">engine_id,</if>
  48. <if test="measurementBatch != null and measurementBatch != ''">measurement_batch,</if>
  49. <if test="createBy != null">create_by,</if>
  50. <if test="createTime != null">create_time,</if>
  51. <if test="updateBy != null">update_by,</if>
  52. <if test="updateTime != null">update_time,</if>
  53. </trim>
  54. <trim prefix="values (" suffix=")" suffixOverrides=",">
  55. <if test="id != null">#{id},</if>
  56. <if test="engineId != null">#{engineId},</if>
  57. <if test="measurementBatch != null and measurementBatch != ''">#{measurementBatch},</if>
  58. <if test="createBy != null">#{createBy},</if>
  59. <if test="createTime != null">#{createTime},</if>
  60. <if test="updateBy != null">#{updateBy},</if>
  61. <if test="updateTime != null">#{updateTime},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateMeasBatch" parameterType="MeasBatch">
  65. update meas_batch
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="engineId != null">engine_id = #{engineId},</if>
  68. <if test="measurementBatch != null and measurementBatch != ''">measurement_batch = #{measurementBatch},</if>
  69. <if test="createBy != null">create_by = #{createBy},</if>
  70. <if test="createTime != null">create_time = #{createTime},</if>
  71. <if test="updateBy != null">update_by = #{updateBy},</if>
  72. <if test="updateTime != null">update_time = #{updateTime},</if>
  73. </trim>
  74. where id = #{id}
  75. </update>
  76. <delete id="deleteMeasBatchById" parameterType="Long">
  77. delete from meas_batch where id = #{id}
  78. </delete>
  79. <delete id="deleteMeasBatchByIds" parameterType="String">
  80. delete from meas_batch where id in
  81. <foreach item="id" collection="array" open="(" separator="," close=")">
  82. #{id}
  83. </foreach>
  84. </delete>
  85. <select id="getOption" resultType="Map">
  86. select id,measurement_batch from meas_batch where engine_id = #{engineId} order by id asc
  87. </select>
  88. <select id="measurementBatchList" resultType="Map">
  89. select id,measurement_batch as label from meas_batch order by id asc
  90. </select>
  91. </mapper>