AttPkxBaseDao.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.AttPkxBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttPkxBase" id="attPkxBaseResultMap">
  5. <result property="code" column="CODE"/>
  6. <result property="name" column="NAME"/>
  7. <result property="lv" column="LV"/>
  8. <result property="pkfq" column="PKFQ"/>
  9. <result property="pw" column="PW"/>
  10. <result property="zdx" column="ZDX"/>
  11. <result property="sdpk" column="SDPK"/>
  12. <result property="sqsz" column="SQSZ"/>
  13. <result property="bjx" column="BJX"/>
  14. <result property="gblq" column="GBLQ"/>
  15. <result property="mzx" column="MZX"/>
  16. <result property="zysq" column="ZYSQ"/>
  17. <result property="tcx" column="TCX"/>
  18. <result property="ddfp" column="DDFP"/>
  19. </resultMap>
  20. <sql id="table_columns">
  21. CODE,
  22. NAME,
  23. LV,
  24. PKFQ,
  25. PW,
  26. ZDX,
  27. SDPK,
  28. SQSZ,
  29. BJX,
  30. GBLQ,
  31. MZX,
  32. ZYSQ,
  33. TCX,
  34. DDFP
  35. </sql>
  36. <sql id="entity_properties">
  37. #{code},
  38. #{name},
  39. #{lv},
  40. #{pkfq},
  41. #{pw},
  42. #{zdx},
  43. #{sdpk},
  44. #{sqsz},
  45. #{bjx},
  46. #{gblq},
  47. #{mzx},
  48. #{zysq},
  49. #{tcx},
  50. #{ddfp}
  51. </sql>
  52. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  53. <sql id="page_where">
  54. <trim prefix="where" prefixOverrides="and | or ">
  55. <if test="code != null and code != ''">and CODE like concat(#{code},'%')</if>
  56. <if test="name != null and name != ''">and NAME like concat('%',concat(#{name},'%'))</if>
  57. <if test="lv != null and lv != ''">and LV = #{lv}</if>
  58. <if test="pkfq != null and pkfq != ''">and PKFQ = #{pkfq}</if>
  59. <if test="pw != null and pw != ''">and PW = #{pw}</if>
  60. <if test="zdx != null and zdx != ''">and ZDX = #{zdx}</if>
  61. <if test="sdpk != null and sdpk != ''">and SDPK = #{sdpk}</if>
  62. <if test="sqsz != null and sqsz != ''">and SQSZ = #{sqsz}</if>
  63. <if test="bjx != null and bjx != ''">and BJX = #{bjx}</if>
  64. <if test="gblq != null and gblq != ''">and GBLQ = #{gblq}</if>
  65. <if test="mzx != null and mzx != ''">and MZX = #{mzx}</if>
  66. <if test="zysq != null and zysq != ''">and ZYSQ = #{zysq}</if>
  67. <if test="tcx != null and tcx != ''">and TCX = #{tcx}</if>
  68. <if test="ddfp != null and ddfp != ''">and DDFP = #{ddfp}</if>
  69. </trim>
  70. </sql>
  71. <select id="get" resultMap="attPkxBaseResultMap" parameterType="String">
  72. select
  73. <include refid="table_columns"/>
  74. from ATT_PKX_BASE where ID = #{id}
  75. </select>
  76. <select id="getBy" resultMap="attPkxBaseResultMap">
  77. select
  78. <include refid="table_columns"/>
  79. from ATT_PKX_BASE
  80. <include refid="page_where"/>
  81. </select>
  82. <select id="findAll" resultMap="attPkxBaseResultMap">
  83. select
  84. <include refid="table_columns"/>
  85. from ATT_PKX_BASE
  86. </select>
  87. <select id="findList" resultMap="attPkxBaseResultMap">
  88. select
  89. <include refid="table_columns"/>
  90. from ATT_PKX_BASE
  91. <include refid="page_where"/>
  92. </select>
  93. <select id="selectCount" resultType="int">
  94. select count(ID) from ATT_PKX_BASE
  95. <include refid="page_where"/>
  96. </select>
  97. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttPkxBase">
  98. insert into ATT_PKX_BASE(
  99. <include refid="table_columns"/>
  100. )
  101. values (
  102. <include refid="entity_properties"/>
  103. )
  104. </insert>
  105. <delete id="delete" parameterType="java.lang.String">
  106. delete from ATT_PKX_BASE where ID = #{id}
  107. </delete>
  108. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttPkxBase">
  109. delete from ATT_PKX_BASE
  110. <include refid="page_where"/>
  111. </delete>
  112. <update id="deleteInFlag" parameterType="java.lang.String">
  113. update ATT_PKX_BASE set flag_valid = 0 where ID = #{id}
  114. </update>
  115. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttPkxBase">
  116. update ATT_PKX_BASE
  117. <trim prefix="set" suffixOverrides=",">
  118. <if test="name != null and name != ''">NAME = #{name},</if>
  119. <if test="lv != null and lv != ''">LV = #{lv},</if>
  120. <if test="pkfq != null and pkfq != ''">PKFQ = #{pkfq},</if>
  121. <if test="pw != null and pw != ''">PW = #{pw},</if>
  122. <if test="zdx != null and zdx != ''">ZDX = #{zdx},</if>
  123. <if test="sdpk != null and sdpk != ''">SDPK = #{sdpk},</if>
  124. <if test="sqsz != null and sqsz != ''">SQSZ = #{sqsz},</if>
  125. <if test="bjx != null and bjx != ''">BJX = #{bjx},</if>
  126. <if test="gblq != null and gblq != ''">GBLQ = #{gblq},</if>
  127. <if test="mzx != null and mzx != ''">MZX = #{mzx},</if>
  128. <if test="zysq != null and zysq != ''">ZYSQ = #{zysq},</if>
  129. <if test="tcx != null and tcx != ''">TCX = #{tcx},</if>
  130. <if test="ddfp != null and ddfp != ''">DDFP = #{ddfp},</if>
  131. </trim>
  132. <where>ID = #{id}</where>
  133. </update>
  134. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttPkxBase">
  135. update ATT_PKX_BASE
  136. <trim prefix="set" suffixOverrides=",">
  137. <if test="name != null and name != ''">NAME = #{name},</if>
  138. <if test="lv != null and lv != ''">LV = #{lv},</if>
  139. <if test="pkfq != null and pkfq != ''">PKFQ = #{pkfq},</if>
  140. <if test="pw != null and pw != ''">PW = #{pw},</if>
  141. <if test="zdx != null and zdx != ''">ZDX = #{zdx},</if>
  142. <if test="sdpk != null and sdpk != ''">SDPK = #{sdpk},</if>
  143. <if test="sqsz != null and sqsz != ''">SQSZ = #{sqsz},</if>
  144. <if test="bjx != null and bjx != ''">BJX = #{bjx},</if>
  145. <if test="gblq != null and gblq != ''">GBLQ = #{gblq},</if>
  146. <if test="mzx != null and mzx != ''">MZX = #{mzx},</if>
  147. <if test="zysq != null and zysq != ''">ZYSQ = #{zysq},</if>
  148. <if test="tcx != null and tcx != ''">TCX = #{tcx},</if>
  149. <if test="ddfp != null and ddfp != ''">DDFP = #{ddfp},</if>
  150. </trim>
  151. <include refid="page_where"/>
  152. </update>
  153. <!-- 其他自定义SQL -->
  154. <select id="findListBy" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam"
  155. resultType="cn.com.goldenwater.dcproj.model.AttPkxBase">
  156. select f.CODE,
  157. f.NAME,
  158. f.LV,
  159. f.PKFQ,
  160. f.PW,
  161. f.ZDX,
  162. f.SDPK,
  163. f.SQSZ,
  164. f.BJX,
  165. f.GBLQ,
  166. f.MZX,
  167. f.ZYSQ,
  168. f.TCX,
  169. f.DDFP from (
  170. select t.CODE,
  171. t.NAME,
  172. t.LV,
  173. t.PKFQ,
  174. t.PW,
  175. t.ZDX,
  176. t.SDPK,
  177. t.SQSZ,
  178. t.BJX,
  179. t.GBLQ,
  180. t.MZX,
  181. t.ZYSQ,
  182. t.TCX,
  183. t.DDFP,x.lgtd,x.lttd from ATT_PKX_BASE t left join ATT_AD_X_BASE x on t.code = x.ad_code
  184. ) f where 1=1
  185. <if test="adName != null and adName != ''">
  186. and f.name like '%${adName}%'
  187. </if>
  188. <if test="adCode != null and adCode != ''">
  189. and f.CODE like '${adCode}%'
  190. </if>
  191. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and f.lgtd BETWEEN #{minLgtd}
  192. AND #{maxLgtd}
  193. </if>
  194. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and f.lttd BETWEEN #{minLttd}
  195. AND #{maxLttd}
  196. </if>
  197. <if test="lv != null and lv != ''">
  198. and f.LV = #{lv}
  199. </if>
  200. </select>
  201. </mapper>