| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <?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="cn.com.goldenwater.dcproj.dao.AttWiuWatConsDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttWiuWatCons" id="attWiuWatConsResultMap">
- <result property="id" column="ID"/>
- <result property="wiuId" column="WIU_ID"/>
- <result property="year" column="YEAR"/>
- <result property="yearType" column="YEAR_TYPE"/>
- <result property="watCons" column="WAT_CONS"/>
- <result property="dataType" column="DATA_TYPE"/>
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- WIU_ID,
- YEAR,
- YEAR_TYPE,
- WAT_CONS,
- DATA_TYPE,
- IN_TM,
- UP_TM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{wiuId},
- #{year},
- #{yearType},
- #{watCons},
- #{dataType},
- #{inTm},
- #{upTm}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="wiuId != null and wiuId != ''">and WIU_ID = #{wiuId}</if>
- <if test="year != null and year != ''">and YEAR = #{year}</if>
- <if test="yearType != null and yearType != ''">and YEAR_TYPE = #{yearType}</if>
- <if test="watCons != null and watCons != ''">and WAT_CONS = #{watCons}</if>
- <if test="dataType != null and dataType != ''">and DATA_TYPE = #{dataType}</if>
- <if test="inTm != null">and IN_TM = #{inTm}</if>
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attWiuWatConsResultMap" parameterType="String" >
- select <include refid="table_columns" /> from ATT_WIU_WAT_CONS where ID = #{id}
- </select>
- <select id="getBy" resultMap="attWiuWatConsResultMap">
- select <include refid="table_columns" /> from ATT_WIU_WAT_CONS <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="attWiuWatConsResultMap">
- select <include refid="table_columns" /> from ATT_WIU_WAT_CONS
- </select>
- <select id="findList" resultMap="attWiuWatConsResultMap">
- select <include refid="table_columns" /> from ATT_WIU_WAT_CONS <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from ATT_WIU_WAT_CONS <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
- insert into ATT_WIU_WAT_CONS( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from ATT_WIU_WAT_CONS where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
- delete from ATT_WIU_WAT_CONS <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update ATT_WIU_WAT_CONS set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
- update ATT_WIU_WAT_CONS
- <trim prefix="set" suffixOverrides=",">
- <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="yearType != null and yearType != ''">YEAR_TYPE = #{yearType},</if>
- <if test="watCons != null and watCons != ''">WAT_CONS = #{watCons},</if>
- <if test="dataType != null and dataType != ''">DATA_TYPE = #{dataType},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
- update ATT_WIU_WAT_CONS
- <trim prefix="set" suffixOverrides=",">
- <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="yearType != null and yearType != ''">YEAR_TYPE = #{yearType},</if>
- <if test="watCons != null and watCons != ''">WAT_CONS = #{watCons},</if>
- <if test="dataType != null and dataType != ''">DATA_TYPE = #{dataType},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getConsList" parameterType="cn.com.goldenwater.dcproj.param.AttWiuWatConsParam" resultMap="attWiuWatConsResultMap">
- select * from (
- select <include refid="table_columns" /> from ATT_WIU_WAT_CONS T
- where 1 = 1
- <if test="wiuId != null and wiuId != ''" >
- AND T.WIU_ID = #{wiuId}
- </if>
- ) a
- order by YEAR DESC
- limit 0, 3
- </select>
- </mapper>
|