|
@@ -0,0 +1,93 @@
|
|
|
+<?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.jjt.biz.mapper.DeviceUpgradeMapper">
|
|
|
+
|
|
|
+ <resultMap type="DeviceUpgrade" id="DeviceUpgradeResult">
|
|
|
+ <result property="upId" column="UP_ID"/>
|
|
|
+ <result property="versionName" column="VERSION_NAME"/>
|
|
|
+ <result property="version" column="VERSION"/>
|
|
|
+ <result property="path" column="PATH"/>
|
|
|
+ <result property="desc" column="DESC"/>
|
|
|
+ <result property="md5" column="MD5"/>
|
|
|
+ <result property="createdTime" column="CREATED_TIME"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectDeviceUpgradeVo">
|
|
|
+ select UP_ID, VERSION_NAME, VERSION, PATH, `DESC`,MD5, CREATED_TIME
|
|
|
+ from device_upgrade
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectDeviceUpgradeList" parameterType="DeviceUpgrade" resultMap="DeviceUpgradeResult">
|
|
|
+ <include refid="selectDeviceUpgradeVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="versionName != null and versionName != ''">and VERSION_NAME like concat('%', #{versionName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="version != null ">and VERSION = #{version}</if>
|
|
|
+ <if test="path != null and path != ''">and PATH = #{path}</if>
|
|
|
+ <if test="desc != null and desc != ''">and `DESC` like concat('%', #{desc}, '%')</if>
|
|
|
+ <if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''">
|
|
|
+ and CREATED_TIME between #{params.beginCreatedTime} and #{params.endCreatedTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDeviceUpgradeByUpId" parameterType="Long" resultMap="DeviceUpgradeResult">
|
|
|
+ <include refid="selectDeviceUpgradeVo"/>
|
|
|
+ where UP_ID = #{upId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDeviceUpgradeLastOne" resultMap="DeviceUpgradeResult">
|
|
|
+ <include refid="selectDeviceUpgradeVo"/>
|
|
|
+ order by CREATED_TIME desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertDeviceUpgrade" parameterType="DeviceUpgrade">
|
|
|
+ insert into device_upgrade
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="upId != null">UP_ID,</if>
|
|
|
+ <if test="versionName != null">VERSION_NAME,</if>
|
|
|
+ <if test="version != null">VERSION,</if>
|
|
|
+ <if test="path != null">PATH,</if>
|
|
|
+ <if test="desc != null">`DESC`,</if>
|
|
|
+ <if test="md5 != null">`MD5`,</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="upId != null">#{upId},</if>
|
|
|
+ <if test="versionName != null">#{versionName},</if>
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
+ <if test="path != null">#{path},</if>
|
|
|
+ <if test="desc != null">#{desc},</if>
|
|
|
+ <if test="md5 != null">#{md5},</if>
|
|
|
+ <if test="createdTime != null">#{createdTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateDeviceUpgrade" parameterType="DeviceUpgrade">
|
|
|
+ update device_upgrade
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="versionName != null">VERSION_NAME = #{versionName},</if>
|
|
|
+ <if test="version != null">VERSION = #{version},</if>
|
|
|
+ <if test="path != null">PATH = #{path},</if>
|
|
|
+ <if test="desc != null">`DESC` = #{desc},</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
|
|
|
+ </trim>
|
|
|
+ where UP_ID = #{upId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceUpgradeByUpId" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from device_upgrade
|
|
|
+ where UP_ID = #{upId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceUpgradeByUpIds" parameterType="String">
|
|
|
+ delete from device_upgrade where UP_ID in
|
|
|
+ <foreach item="upId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{upId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|