<?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.zy.asrs.mapper.DeviceErrorMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.zy.asrs.entity.DeviceError">
|
<id column="id" property="id" />
|
<result column="device" property="device" />
|
<result column="msg" property="msg" />
|
<result column="device_id" property="deviceId" />
|
<result column="create_time" property="createTime" />
|
<result column="appe_time" property="appeTime" />
|
<result column="device_plc_id" property="devicePlcId" />
|
</resultMap>
|
|
<sql id="batchSeq">
|
<if test="id != null and id != 0">
|
and id = #{id}
|
</if>
|
<if test="device != null and device != ''">
|
and device = #{device}
|
</if>
|
<if test="deviceId != null and deviceId != 0">
|
and device_id = #{deviceId}
|
</if>
|
<if test="devicePlcId != null and devicePlcId != 0">
|
and device_plc_id = #{devicePlcId}
|
</if>
|
</sql>
|
|
<select id="selectByDeviceAndDeviceId" resultMap="BaseResultMap">
|
select top 1 * from wcs_device_error
|
where "device" = #{device}
|
and "device_id" = #{deviceId}
|
</select>
|
|
<delete id="deleteByDeviceAndDeviceId">
|
delete from wcs_device_error
|
where "device" = #{device}
|
and "device_id" = #{deviceId}
|
</delete>
|
|
<select id="selectDeviceErrorList" resultMap="BaseResultMap">
|
SELECT * FROM (
|
SELECT ROW_NUMBER() over(order by create_time DESC) as row,*
|
FROM ( SELECT * FROM wcs_device_error ) t
|
WHERE 1=1
|
<include refid="batchSeq"></include>
|
) a
|
WHERE a.row BETWEEN ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
|
</select>
|
|
<select id="selectDeviceErrorListTotal" resultType="Long">
|
SELECT count(1) FROM wcs_device_error
|
WHERE 1=1
|
<include refid="batchSeq"></include>
|
</select>
|
|
</mapper>
|