JfktpInfoMapper.xml 3.07 KB
Newer Older
co_dengxiongwen's avatar
co_dengxiongwen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?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.devplatform.admin.modules.eq.dao.JfktpInfoDao">
	<!-- Result Map -->
	<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.eq.bean.JfktpInfo">
	    <result column="id" property="id"/>
	    <result column="resource_id" property="resourceId"/>
	    <result column="voltage" property="voltage"/>
	    <result column="current" property="current"/>
	    <result column="power_factor" property="powerFactor"/>
	    <result column="power" property="power"/>
	    <result column="electric_energy" property="electricEnergy"/>
	    <result column="communication_failure" property="communicationFailure"/>
	    <result column="type" property="type"/>
	    <result column="station_id" property="stationId"/>
	    <result column="create_time" property="createTime"/>
	</resultMap>

	<!-- jfktp_info table all fields -->
	<sql id="Base_Column_List">
co_dengxiongwen's avatar
co_dengxiongwen committed
21
		id,resource_id,voltage,current,power_factor,power,electric_energy,communication_failure,type,station_id,create_time
co_dengxiongwen's avatar
co_dengxiongwen committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	</sql>

	<!-- 公共查询条件 -->
	<sql id="Example_Where_Clause">
		where t.deleted=0
		<if test="id!=null and id!=''">and t.id = #{id}</if>
		<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
		<if test="voltage!=null and voltage!=''">and t.voltage = #{voltage}</if>
		<if test="current!=null and current!=''">and t.current = #{current}</if>
		<if test="powerFactor!=null and powerFactor!=''">and t.power_factor = #{powerFactor}</if>
		<if test="power!=null and power!=''">and t.power = #{power}</if>
		<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
		<if test="communicationFailure!=null and communicationFailure!=''">and t.communication_failure = #{communicationFailure}</if>
		<if test="type!=null ">and t.type = #{type}</if>
		<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
		<if test="createTime!=null ">and t.create_time = #{createTime}</if>
	</sql>

	<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
	select count(1) from jfktp_info t
	<include refid="Example_Where_Clause"/>
	</select>

	<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
	select t.* from jfktp_info t
	<include refid="Example_Where_Clause"/>
	<if test="pager.orderCondition != null and pager.orderCondition != ''">
		${pager.orderCondition}
	</if>
	<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
		${pager.mysqlQueryCondition}
	</if>
	</select>
co_dengxiongwen's avatar
co_dengxiongwen committed
55
    <select id="getList" resultType="java.util.Map">
co_dengxiongwen's avatar
co_dengxiongwen committed
56
		SELECT t1.*,li.name as resourceName,li.remark as remark,li.deploy_location as deployLocation,li.status as status
co_dengxiongwen's avatar
co_dengxiongwen committed
57 58 59 60
		FROM jfktp_info AS t1
		INNER JOIN
		(SELECT t2.resource_id, MAX(t2.create_time) AS maxdate
		FROM jfktp_info AS t2
co_dengxiongwen's avatar
co_dengxiongwen committed
61 62
		GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
		left join li_resource li on li.id = resource_id
co_dengxiongwen's avatar
co_dengxiongwen committed
63
	</select>
co_dengxiongwen's avatar
co_dengxiongwen committed
64 65 66 67

</mapper>