grgw_old_java/heatsupply2/build/classes/mappings/ccqnsoft/water/DifferenceDao.xml

111 lines
3.0 KiB
XML

<?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.jeeplus.ccqnsoft.water.dao.DifferenceDao">
<sql id="differenceColumns">
a.id AS "id",
a.sources AS "sources",
b.source_name AS "sourceName",
a.view001_max AS "view001Max",
a.view001_min AS "view001Min",
a.view002_max AS "view002Max",
a.view002_min AS "view002Min",
a.create_date AS "createDate",
a.update_date AS "updateDate"
</sql>
<sql id="differenceJoins">
left join heatsource b on b.id = a.sources
</sql>
<!-- <select id="get" resultType="Difference" > -->
<!-- SELECT -->
<!-- <include refid="differenceColumns"/> -->
<!-- FROM tqd_difference a -->
<!-- <include refid="differenceJoins"/> -->
<!-- WHERE a.id = #{id} -->
<!-- </select> -->
<select id="findList" resultType="Difference" >
SELECT
<include refid="differenceColumns"/>
FROM tqd_difference a
<include refid="differenceJoins"/>
<where>
<if test="createDate != null and createDate != ''">
DATE_FORMAT(a.create_date,'%Y') >= DATE_FORMAT(#{createDate},'%Y')
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="Difference" >
SELECT
<include refid="differenceColumns"/>
FROM tqd_difference a
<include refid="differenceJoins"/>
<where>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<!-- <insert id="insert"> -->
<!-- INSERT INTO tqd_difference ( -->
<!-- id, -->
<!-- temperature_max, -->
<!-- temperature_min, -->
<!-- create_date, -->
<!-- update_date -->
<!-- ) VALUES ( -->
<!-- #{id}, -->
<!-- #{temperatureMax}, -->
<!-- #{temperatureMin}, -->
<!-- #{createDate}, -->
<!-- #{updateDate} -->
<!-- ) -->
<!-- </insert> -->
<!-- <update id="update"> -->
<!-- UPDATE tqd_difference SET -->
<!-- temperature_max = #{temperatureMax}, -->
<!-- temperature_min = #{temperatureMin}, -->
<!-- update_date = #{updateDate} -->
<!-- WHERE id = #{id} -->
<!-- </update> -->
<!--物理删除-->
<!-- <update id="delete"> -->
<!-- DELETE FROM tqd_difference -->
<!-- WHERE id = #{id} -->
<!-- </update> -->
<!--逻辑删除-->
<!-- <update id="deleteByLogic"> -->
<!-- UPDATE tqd_difference SET -->
<!-- del_flag = #{DEL_FLAG_DELETE} -->
<!-- WHERE id = #{id} -->
<!-- </update> -->
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="Difference" statementType="STATEMENT">
select * FROM tqd_difference where ${propertyName} = '${value}'
</select>
</mapper>