12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?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.bizmatics.persistence.mapper.DeviceMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.bizmatics.model.Device">
- <id column="id" property="id" />
- <result column="device_code" property="deviceCode" />
- <result column="device_name" property="deviceName" />
- <result column="site_id" property="siteId" />
- <result column="device_address" property="deviceAddress" />
- <result column="device_type" property="deviceType" />
- <result column="install_time" property="installTime" />
- <result column="creator" property="creator" />
- <result column="enable" property="enable" />
- </resultMap>
- <select id="selectCount" resultType="java.lang.Integer">
- select count(1)
- from user_site as us
- inner join device_status as ds
- on us.site_id = ds.site_id
- inner join device as d
- on us.site_id = d.site_Id
- <where>
- <if test="userId != null and userId != 0">
- and us.user_id = #{userId}
- </if>
- <if test="siteId != null and siteId != 0">
- and us.site_id = #{siteId}
- </if>
- <if test="deviceStatus != null">
- and ds.device_status = #{deviceStatus}
- </if>
- <if test="startTime != null">
- and ds.status_time >= #{startTime}
- </if>
- <if test="endTime != null">
- and ds.status_time <= #{endTime}
- </if>
- <if test="type != null">
- and d.device_type = #{type}
- </if>
- </where>
- </select>
- </mapper>
|