|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 通用查询映射结果 --> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.DeviceError"> | 
|---|
|  |  |  | <id column="id" property="id" /> | 
|---|
|  |  |  | <result column="device" property="device" /> | 
|---|
|  |  |  | <result column="device_id" property="deviceId" /> | 
|---|
|  |  |  | <result column="create_time" property="createTime" /> | 
|---|
|  |  |  | <result column="msg" property="msg" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <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" /> | 
|---|
|  |  |  | </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> | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByDeviceAndDeviceId" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select top 1 * from wcs_device_error | 
|---|
|  |  |  | where device = #{device} | 
|---|
|  |  |  | and device_id = #{deviceId} | 
|---|
|  |  |  | select top 1 * from "SOURCE"."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 from "SOURCE"."wcs_device_error" | 
|---|
|  |  |  | where "DEVICE" = #{device} | 
|---|
|  |  |  | and "DEVICE_ID" = #{deviceId} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectDeviceErrorList" resultMap="BaseResultMap"> | 
|---|
|  |  |  | SELECT * FROM "SOURCE"."wcs_device_error" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | ORDER BY CREATE_TIME DESC | 
|---|
|  |  |  | LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize}); | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectDeviceErrorListTotal" resultType="Long"> | 
|---|
|  |  |  | SELECT count(1) FROM "SOURCE"."wcs_device_error" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|