12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?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.xy.mapper.DeviceChargingMapper">
- <resultMap id="queryPageMap" type="com.xy.dto.DeviceChargingDto$PageVo">
- <association property="deviceInfo" javaType="com.xy.dto.DeviceInfoDto$Vo">
- <id column="device_id" property="deviceId"/>
- <result column="device_name" property="deviceName"/>
- <result column="lon" property="lon"/>
- <result column="lat" property="lat"/>
- <result column="device_type" property="deviceType"/>
- <result column="merc_device_code" property="mercDeviceCode"/>
- <result column="merc_id" property="mercId"/>
- <result column="merc_code" property="mercCode"/>
- <result column="place_id" property="placeId"/>
- <result column="place_line_id" property="placeLineId"/>
- <result column="district_id" property="districtId"/>
- <result column="active_state" property="activeState"/>
- <result column="active_time" property="activeTime"/>
- <result column="busy_state" property="busyState"/>
- <result column="show_status" property="showStatus"/>
- <result column="freeze_status" property="freezeStatus"/>
- <result column="device_img" property="deviceImg"/>
- <result column="update_time" property="updateTime"/>
- <result column="merc_name" property="mercName"/>
- <result column="create_time" property="createTime"/>
- <association property="deviceStatus" javaType="com.xy.dto.DeviceStatusDto$Vo">
- <result column="net_state" property="netState"/>
- </association>
- </association>
- <association property="deviceCharging" javaType="com.xy.dto.DeviceChargingDto$Vo">
- <result column="charging_sum_money" property="chargingSumMoney" />
- <result column="charging_x" property="chargingX" />
- <result column="timeout" property="timeout" />
- <result column="last_charging_time" property="lastChargingTime" />
- <result column="charging_create_time" property="createTime" />
- </association>
- </resultMap>
- <select id="page" resultMap="queryPageMap">
- select di.*,
- ds.net_state,
- dc.charging_sum_money, dc.charging_x, dc.timeout, dc.last_charging_time, dc.create_time as charging_create_time
- from device_info di
- join device_status ds on (di.device_id = ds.device_id)
- join device_charging dc on(di.device_id = dc.device_id)
- where
- 1 = 1
- <if test="queryPage.mercId != null">
- and di.merc_id = #{queryPage.mercId}
- </if>
- <if test="queryPage.deviceId != null">
- and di.device_id = #{queryPage.deviceId}
- </if>
- <if test="queryPage.chargingStatus != null and queryPage.chargingStatus != ''">
- <!-- 即将过期 -->
- <if test="queryPage.chargingStatus == 1">
- and dc.timeout >= #{queryPage.thisTime} and dc.timeout <= #{queryPage.theTime}
- </if>
- <!-- 已过期 -->
- <if test="queryPage.chargingStatus == 2">
- and dc.timeout <= #{queryPage.thisTime}
- </if>
- </if>
- order by dc.timeout asc
- </select>
- </mapper>
|