GwNtcAnnsmntDao.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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.GwNtcAnnsmntDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt" id="gwNtcAnnsmntResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="type" column="TYPE"/>
  7. <result property="title" column="TITLE"/>
  8. <result property="content" column="CONTENT"/>
  9. <result property="url" column="URL"/>
  10. <result property="note" column="NOTE"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="persNm" column="PERS_NM"/>
  13. <result property="orgId" column="ORG_ID"/>
  14. <result property="orgNm" column="ORG_NM"/>
  15. <result property="pubState" column="PUB_STATE"/>
  16. <result property="pubTm" column="PUB_TM"/>
  17. <result property="intm" column="INTM"/>
  18. <result property="uptm" column="UPTM"/>
  19. <result property="disLevel" column="DIS_LEVEL"/>
  20. </resultMap>
  21. <sql id="table_columns2">
  22. ID,
  23. TYPE,
  24. TITLE,
  25. CONTENT,
  26. URL,
  27. NOTE,
  28. PERS_NM,
  29. ORG_ID,
  30. ORG_NM,
  31. PUB_STATE,
  32. PUB_TM,
  33. INTM,
  34. UPTM,
  35. DIS_LEVEL
  36. </sql>
  37. <sql id="table_columns">
  38. ID,
  39. TYPE,
  40. TITLE,
  41. CONTENT,
  42. URL,
  43. NOTE,
  44. PERS_ID,
  45. PERS_NM,
  46. ORG_ID,
  47. ORG_NM,
  48. PUB_STATE,
  49. PUB_TM,
  50. INTM,
  51. UPTM,
  52. DIS_LEVEL
  53. </sql>
  54. <sql id="entity_properties">
  55. #{id},
  56. #{type},
  57. #{title},
  58. #{content},
  59. #{url},
  60. #{note},
  61. #{persId},
  62. #{persNm},
  63. #{orgId},
  64. #{orgNm},
  65. #{pubState},
  66. #{pubTm},
  67. #{intm},
  68. #{uptm},
  69. #{disLevel}
  70. </sql>
  71. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  72. <sql id="page_where">
  73. <trim prefix="where" prefixOverrides="and | or ">
  74. <if test="type != null and type != ''">and TYPE = #{type}</if>
  75. <if test="title != null and title != ''">and TITLE = #{title}</if>
  76. <if test="content != null and content != ''">and CONTENT = #{content}</if>
  77. <if test="url != null and url != ''">and URL = #{url}</if>
  78. <if test="note != null and note != ''">and NOTE = #{note}</if>
  79. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  80. <if test="persNm != null and persNm != ''">and PERS_NM = #{persNm}</if>
  81. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  82. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  83. <if test="pubState != null and pubState != ''">and PUB_STATE = #{pubState}</if>
  84. <if test="disLevel != null and disLevel != ''">and DIS_LEVEL = #{disLevel}</if>
  85. </trim>
  86. </sql>
  87. <select id="get" resultMap="gwNtcAnnsmntResultMap" parameterType="String">
  88. select
  89. <include refid="table_columns"/>
  90. from GW_NTC_ANNSMNT where ID = #{id}
  91. </select>
  92. <select id="getBy" resultMap="gwNtcAnnsmntResultMap">
  93. select
  94. <include refid="table_columns"/>
  95. from GW_NTC_ANNSMNT
  96. <include refid="page_where"/>
  97. </select>
  98. <select id="findAll" resultMap="gwNtcAnnsmntResultMap">
  99. select
  100. <include refid="table_columns"/>
  101. from GW_NTC_ANNSMNT
  102. </select>
  103. <select id="findList" resultMap="gwNtcAnnsmntResultMap">
  104. select
  105. <include refid="table_columns"/>
  106. from GW_NTC_ANNSMNT
  107. <include refid="page_where"/>
  108. order by DIS_LEVEL
  109. </select>
  110. <select id="selectCount" resultType="int">
  111. select count(ID) from GW_NTC_ANNSMNT
  112. <include refid="page_where"/>
  113. </select>
  114. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt">
  115. insert into GW_NTC_ANNSMNT(
  116. <include refid="table_columns"/>
  117. )
  118. values (
  119. <include refid="entity_properties"/>
  120. )
  121. </insert>
  122. <delete id="delete" parameterType="java.lang.String">
  123. delete from GW_NTC_ANNSMNT where ID = #{id}
  124. </delete>
  125. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt">
  126. delete from GW_NTC_ANNSMNT
  127. <include refid="page_where"/>
  128. </delete>
  129. <update id="deleteInFlag" parameterType="java.lang.String">
  130. update GW_NTC_ANNSMNT set flag_valid = 0 where ID = #{id}
  131. </update>
  132. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt">
  133. update GW_NTC_ANNSMNT
  134. <trim prefix="set" suffixOverrides=",">
  135. <if test="type != null and type != ''">TYPE = #{type},</if>
  136. <if test="title != null and title != ''">TITLE = #{title},</if>
  137. <if test="content != null and content != ''">CONTENT = #{content},</if>
  138. <if test="url != null and url != ''">URL = #{url},</if>
  139. <if test="note != null and note != ''">NOTE = #{note},</if>
  140. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  141. <if test="persNm != null and persNm != ''">PERS_NM = #{persNm},</if>
  142. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  143. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  144. <if test="pubState != null and pubState != ''">PUB_STATE = #{pubState},</if>
  145. <if test="pubTm != null">PUB_TM = #{pubTm},</if>
  146. <if test="intm != null">INTM = #{intm},</if>
  147. <if test="uptm != null">UPTM = #{uptm},</if>
  148. <if test="disLevel != null and disLevel != ''">DIS_LEVEL = #{disLevel},</if>
  149. </trim>
  150. <where>ID = #{id}</where>
  151. </update>
  152. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt">
  153. update GW_NTC_ANNSMNT
  154. <trim prefix="set" suffixOverrides=",">
  155. <if test="type != null and type != ''">TYPE = #{type},</if>
  156. <if test="title != null and title != ''">TITLE = #{title},</if>
  157. <if test="content != null and content != ''">CONTENT = #{content},</if>
  158. <if test="url != null and url != ''">URL = #{url},</if>
  159. <if test="note != null and note != ''">NOTE = #{note},</if>
  160. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  161. <if test="persNm != null and persNm != ''">PERS_NM = #{persNm},</if>
  162. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  163. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  164. <if test="pubState != null and pubState != ''">PUB_STATE = #{pubState},</if>
  165. <if test="pubTm != null">PUB_TM = #{pubTm},</if>
  166. <if test="intm != null">INTM = #{intm},</if>
  167. <if test="uptm != null">UPTM = #{uptm},</if>
  168. <if test="disLevel != null and disLevel != ''">DIS_LEVEL = #{disLevel},</if>
  169. </trim>
  170. <include refid="page_where"/>
  171. </update>
  172. <!-- 其他自定义SQL -->
  173. <select id="findPagePcInfo" parameterType="cn.com.goldenwater.dcproj.param.GwNtcAnnsmntParam"
  174. resultType="cn.com.goldenwater.dcproj.model.GwNtcAnnsmnt">
  175. select
  176. <include refid="table_columns2"/>
  177. from GW_NTC_ANNSMNT
  178. where 1 = 1
  179. <if test="type != null and type != ''">
  180. AND type = #{type}
  181. </if>
  182. <if test="persNm != null and persNm != ''">
  183. AND pers_nm like CONCAT('%',CONCAT(#{persNm},'%'))
  184. </if>
  185. <if test="intm != null and intm != ''">
  186. AND intm &gt;= TO_DATE(#{intm},'YYYY-MM-DD')
  187. </if>
  188. <if test="uptm != null and uptm != ''">
  189. AND uptm &lt;= TO_DATE(#{uptm},'YYYY-MM-DD')+1
  190. </if>
  191. <if test="title != null and title != ''">
  192. AND title like CONCAT('%',CONCAT(#{title},'%'))
  193. </if>
  194. <if test="pubState != null and pubState != ''">
  195. AND pub_state = #{pubState}
  196. </if>
  197. <if test="orgId != null and orgId != ''">
  198. AND ORG_ID IN (${orgId})
  199. </if>
  200. order by DIS_LEVEL
  201. </select>
  202. </mapper>