123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.meas.system.mapper.MeasBatchMapper">
- <resultMap type="MeasBatch" id="MeasBatchResult">
- <result property="id" column="id"/>
- <result property="engineId" column="engine_id"/>
- <result property="engineModel" column="engine_model"/>
- <result property="measurementBatch" column="measurement_batch"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <sql id="selectMeasBatchVo">
- SELECT
- mb.id,
- mb.engine_id,
- mem.model engine_model,
- mb.measurement_batch,
- mb.create_by,
- mb.create_time,
- mb.update_by,
- mb.update_time
- FROM
- meas_batch mb
- LEFT JOIN meas_engine_model mem on mb.engine_id = mem.id
- </sql>
- <select id="selectMeasBatchList" parameterType="MeasBatch" resultMap="MeasBatchResult">
- <include refid="selectMeasBatchVo"/>
- <where>
- <if test="engineModel != null ">and mb.engine_id = #{engineModel}</if>
- <if test="measurementBatch != null and measurementBatch != ''">and mb.id = #{measurementBatch}
- </if>
- </where>
- order by mb.create_time desc
- </select>
- <select id="selectMeasBatchById" parameterType="Long" resultMap="MeasBatchResult">
- <include refid="selectMeasBatchVo"/>
- where mb.id = #{id}
- </select>
- <insert id="insertMeasBatch" parameterType="MeasBatch" useGeneratedKeys="true" keyProperty="id">
- insert into meas_batch
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="engineId != null">engine_id,</if>
- <if test="measurementBatch != null and measurementBatch != ''">measurement_batch,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="engineId != null">#{engineId},</if>
- <if test="measurementBatch != null and measurementBatch != ''">#{measurementBatch},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateMeasBatch" parameterType="MeasBatch">
- update meas_batch
- <trim prefix="SET" suffixOverrides=",">
- <if test="engineId != null">engine_id = #{engineId},</if>
- <if test="measurementBatch != null and measurementBatch != ''">measurement_batch = #{measurementBatch},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteMeasBatchById" parameterType="Long">
- delete from meas_batch where id = #{id}
- </delete>
- <delete id="deleteMeasBatchByIds" parameterType="String">
- delete from meas_batch where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="getOption" resultType="Map">
- select id,measurement_batch from meas_batch where engine_id = #{engineId} order by id asc
- </select>
- <select id="measurementBatchList" resultType="Map">
- select id,measurement_batch as label from meas_batch order by id asc
- </select>
- </mapper>
|