AttWiuWatConsDao.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.goldenwater.dcproj.dao.AttWiuWatConsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttWiuWatCons" id="attWiuWatConsResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="wiuId" column="WIU_ID"/>
  7. <result property="year" column="YEAR"/>
  8. <result property="yearType" column="YEAR_TYPE"/>
  9. <result property="watCons" column="WAT_CONS"/>
  10. <result property="dataType" column="DATA_TYPE"/>
  11. <result property="inTm" column="IN_TM"/>
  12. <result property="upTm" column="UP_TM"/>
  13. </resultMap>
  14. <sql id="table_columns">
  15. ID,
  16. WIU_ID,
  17. YEAR,
  18. YEAR_TYPE,
  19. WAT_CONS,
  20. DATA_TYPE,
  21. IN_TM,
  22. UP_TM
  23. </sql>
  24. <sql id="entity_properties">
  25. #{id},
  26. #{wiuId},
  27. #{year},
  28. #{yearType},
  29. #{watCons},
  30. #{dataType},
  31. #{inTm},
  32. #{upTm}
  33. </sql>
  34. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  35. <sql id="page_where">
  36. <trim prefix="where" prefixOverrides="and | or ">
  37. <if test="wiuId != null and wiuId != ''">and WIU_ID = #{wiuId}</if>
  38. <if test="year != null and year != ''">and YEAR = #{year}</if>
  39. <if test="yearType != null and yearType != ''">and YEAR_TYPE = #{yearType}</if>
  40. <if test="watCons != null and watCons != ''">and WAT_CONS = #{watCons}</if>
  41. <if test="dataType != null and dataType != ''">and DATA_TYPE = #{dataType}</if>
  42. <if test="inTm != null">and IN_TM = #{inTm}</if>
  43. <if test="upTm != null">and UP_TM = #{upTm}</if>
  44. </trim>
  45. </sql>
  46. <select id="get" resultMap="attWiuWatConsResultMap" parameterType="String" >
  47. select <include refid="table_columns" /> from ATT_WIU_WAT_CONS where ID = #{id}
  48. </select>
  49. <select id="getBy" resultMap="attWiuWatConsResultMap">
  50. select <include refid="table_columns" /> from ATT_WIU_WAT_CONS <include refid="page_where" />
  51. </select>
  52. <select id="findAll" resultMap="attWiuWatConsResultMap">
  53. select <include refid="table_columns" /> from ATT_WIU_WAT_CONS
  54. </select>
  55. <select id="findList" resultMap="attWiuWatConsResultMap">
  56. select <include refid="table_columns" /> from ATT_WIU_WAT_CONS <include refid="page_where" />
  57. </select>
  58. <select id="selectCount" resultType="int" >
  59. select count(ID) from ATT_WIU_WAT_CONS <include refid="page_where" />
  60. </select>
  61. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
  62. insert into ATT_WIU_WAT_CONS( <include refid="table_columns" /> )
  63. values ( <include refid="entity_properties" /> )
  64. </insert>
  65. <delete id="delete" parameterType="java.lang.String">
  66. delete from ATT_WIU_WAT_CONS where ID = #{id}
  67. </delete>
  68. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
  69. delete from ATT_WIU_WAT_CONS <include refid="page_where" />
  70. </delete>
  71. <update id="deleteInFlag" parameterType="java.lang.String">
  72. update ATT_WIU_WAT_CONS set flag_valid = 0 where ID = #{id}
  73. </update>
  74. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
  75. update ATT_WIU_WAT_CONS
  76. <trim prefix="set" suffixOverrides=",">
  77. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  78. <if test="year != null and year != ''">YEAR = #{year},</if>
  79. <if test="yearType != null and yearType != ''">YEAR_TYPE = #{yearType},</if>
  80. <if test="watCons != null and watCons != ''">WAT_CONS = #{watCons},</if>
  81. <if test="dataType != null and dataType != ''">DATA_TYPE = #{dataType},</if>
  82. <if test="inTm != null">IN_TM = #{inTm},</if>
  83. <if test="upTm != null">UP_TM = #{upTm},</if>
  84. </trim>
  85. <where>ID = #{id}</where>
  86. </update>
  87. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuWatCons">
  88. update ATT_WIU_WAT_CONS
  89. <trim prefix="set" suffixOverrides=",">
  90. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  91. <if test="year != null and year != ''">YEAR = #{year},</if>
  92. <if test="yearType != null and yearType != ''">YEAR_TYPE = #{yearType},</if>
  93. <if test="watCons != null and watCons != ''">WAT_CONS = #{watCons},</if>
  94. <if test="dataType != null and dataType != ''">DATA_TYPE = #{dataType},</if>
  95. <if test="inTm != null">IN_TM = #{inTm},</if>
  96. <if test="upTm != null">UP_TM = #{upTm},</if>
  97. </trim>
  98. <include refid="page_where" />
  99. </update>
  100. <!-- 其他自定义SQL -->
  101. <select id="getConsList" parameterType="cn.com.goldenwater.dcproj.param.AttWiuWatConsParam" resultMap="attWiuWatConsResultMap">
  102. select * from (
  103. select <include refid="table_columns" /> from ATT_WIU_WAT_CONS T
  104. where 1 = 1
  105. <if test="wiuId != null and wiuId != ''" >
  106. AND T.WIU_ID = #{wiuId}
  107. </if>
  108. ) where rownum&lt;=3
  109. order by YEAR DESC
  110. </select>
  111. </mapper>