79 lines
3.6 KiB
XML
79 lines
3.6 KiB
XML
<?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.luqj.ec.mapper.EcCommandResultMapper">
|
|
|
|
<resultMap type="EcCommandResult" id="EcCommandResultResult">
|
|
<result property="id" column="id" />
|
|
<result property="commandId" column="command_id" />
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="result" column="result" />
|
|
<result property="errorMsg" column="error_msg" />
|
|
<result property="responseData" column="response_data" />
|
|
<result property="createdAt" column="created_at" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEcCommandResultVo">
|
|
select id, command_id, device_id, result, error_msg, response_data, created_at from ec_command_result
|
|
</sql>
|
|
|
|
<select id="selectEcCommandResultList" parameterType="EcCommandResult" resultMap="EcCommandResultResult">
|
|
<include refid="selectEcCommandResultVo"/>
|
|
<where>
|
|
<if test="commandId != null "> and command_id = #{commandId}</if>
|
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
|
<if test="result != null "> and result = #{result}</if>
|
|
<if test="errorMsg != null and errorMsg != ''"> and error_msg like concat('%', #{errorMsg}, '%')</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectEcCommandResultById" parameterType="Long" resultMap="EcCommandResultResult">
|
|
<include refid="selectEcCommandResultVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEcCommandResult" parameterType="EcCommandResult" useGeneratedKeys="true" keyProperty="id">
|
|
insert into ec_command_result
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="commandId != null">command_id,</if>
|
|
<if test="deviceId != null">device_id,</if>
|
|
<if test="result != null">result,</if>
|
|
<if test="errorMsg != null">error_msg,</if>
|
|
<if test="responseData != null">response_data,</if>
|
|
<if test="createdAt != null">created_at,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="commandId != null">#{commandId},</if>
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
<if test="result != null">#{result},</if>
|
|
<if test="errorMsg != null">#{errorMsg},</if>
|
|
<if test="responseData != null">#{responseData},</if>
|
|
<if test="createdAt != null">#{createdAt},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEcCommandResult" parameterType="EcCommandResult">
|
|
update ec_command_result
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="commandId != null">command_id = #{commandId},</if>
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
<if test="result != null">result = #{result},</if>
|
|
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
|
|
<if test="responseData != null">response_data = #{responseData},</if>
|
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEcCommandResultById" parameterType="Long">
|
|
delete from ec_command_result where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEcCommandResultByIds" parameterType="String">
|
|
delete from ec_command_result where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |