BisInspXjvillDao.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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.BisInspXjvillDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspXjvill" id="bisInspXjvillResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="state" column="STATE"/>
  11. <result property="dutyState" column="DUTY_STATE"/>
  12. <result property="persId" column="PERS_ID"/>
  13. <result property="intm" column="INTM"/>
  14. <result property="uptm" column="UPTM"/>
  15. <result property="note" column="NOTE"/>
  16. <result property="dataStat" column="DATA_STAT"/>
  17. </resultMap>
  18. <sql id="table_columns">
  19. ID,
  20. OBJ_ID,
  21. NM,
  22. AD_CODE,
  23. AD_NAME,
  24. STATE,
  25. DUTY_STATE,
  26. PERS_ID,
  27. INTM,
  28. UPTM,
  29. NOTE,
  30. DATA_STAT
  31. </sql>
  32. <sql id="entity_properties">
  33. #{id},
  34. #{objId},
  35. #{nm},
  36. #{adCode},
  37. #{adName},
  38. #{state},
  39. #{dutyState},
  40. #{persId},
  41. #{intm},
  42. #{uptm},
  43. #{note},
  44. #{dataStat}
  45. </sql>
  46. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  47. <sql id="page_where">
  48. <trim prefix="where" prefixOverrides="and | or ">
  49. <if test="objId != null and objId != ''">
  50. and OBJ_ID = #{objId}
  51. </if>
  52. <if test="nm != null and nm != ''">
  53. and NM = #{nm}
  54. </if>
  55. <if test="adCode != null and adCode != ''">
  56. and AD_CODE = #{adCode}
  57. </if>
  58. <if test="adName != null and adName != ''">
  59. and AD_NAME = #{adName}
  60. </if>
  61. <if test="state != null and state != ''">
  62. and STATE = #{state}
  63. </if>
  64. <if test="dutyState != null and dutyState != ''">
  65. and DUTY_STATE = #{dutyState}
  66. </if>
  67. <if test="persId != null and persId != ''">
  68. and PERS_ID = #{persId}
  69. </if>
  70. <if test="intm != null">
  71. and INTM = #{intm}
  72. </if>
  73. <if test="uptm != null">
  74. and UPTM = #{uptm}
  75. </if>
  76. <if test="note != null and note != ''">
  77. and NOTE = #{note}
  78. </if>
  79. <if test="dataStat != null and dataStat != ''">
  80. and DATA_STAT = #{dataStat}
  81. </if>
  82. and DATA_STAT='0'
  83. </trim>
  84. </sql>
  85. <select id="get" resultMap="bisInspXjvillResultMap" parameterType="String">
  86. select
  87. <include refid="table_columns"/>
  88. from BIS_INSP_XJVILL where ID = #{id}
  89. </select>
  90. <select id="getBy" resultMap="bisInspXjvillResultMap">
  91. select
  92. <include refid="table_columns"/>
  93. from BIS_INSP_XJVILL
  94. <include refid="page_where"/>
  95. </select>
  96. <select id="findAll" resultMap="bisInspXjvillResultMap">
  97. select
  98. <include refid="table_columns"/>
  99. from BIS_INSP_XJVILL
  100. </select>
  101. <select id="findList" resultMap="bisInspXjvillResultMap">
  102. select
  103. <include refid="table_columns"/>
  104. from BIS_INSP_XJVILL
  105. <include refid="page_where"/>
  106. </select>
  107. <select id="selectCount" resultType="int">
  108. select count(ID) from BIS_INSP_XJVILL
  109. <include refid="page_where"/>
  110. </select>
  111. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspXjvill">
  112. insert into BIS_INSP_XJVILL(
  113. <include refid="table_columns"/>
  114. )
  115. values (
  116. <include refid="entity_properties"/>
  117. )
  118. </insert>
  119. <delete id="delete" parameterType="java.lang.String">
  120. update BIS_INSP_XJVILL set DATA_STAT='9' where ID = #{id}
  121. </delete>
  122. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspXjvill">
  123. update BIS_INSP_XJVILL set DATA_STAT='9'
  124. <include refid="page_where"/>
  125. </delete>
  126. <update id="deleteInFlag" parameterType="java.lang.String">
  127. update BIS_INSP_XJVILL set DATA_STAT = '9' where ID = #{id}
  128. </update>
  129. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspXjvill">
  130. update BIS_INSP_XJVILL
  131. <trim prefix="set" suffixOverrides=",">
  132. <if test="objId != null and objId != ''">OBJ_ID
  133. = #{objId},
  134. </if>
  135. <if test="nm != null and nm != ''">NM
  136. = #{nm},
  137. </if>
  138. <if test="adCode != null and adCode != ''">AD_CODE
  139. = #{adCode},
  140. </if>
  141. <if test="adName != null and adName != ''">AD_NAME
  142. = #{adName},
  143. </if>
  144. <if test="state != null and state != ''">STATE
  145. = #{state},
  146. </if>
  147. <if test="dutyState != null and dutyState != ''">DUTY_STATE
  148. = #{dutyState},
  149. </if>
  150. <if test="persId != null and persId != ''">PERS_ID
  151. = #{persId},
  152. </if>
  153. <if test="intm != null">INTM
  154. = #{intm},
  155. </if>
  156. <if test="uptm != null">UPTM
  157. = #{uptm},
  158. </if>
  159. <if test="note != null and note != ''">NOTE
  160. = #{note},
  161. </if>
  162. <if test="dataStat != null and dataStat != ''">DATA_STAT
  163. = #{dataStat},
  164. </if>
  165. </trim>
  166. <where>ID = #{id}</where>
  167. </update>
  168. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspXjvill">
  169. update BIS_INSP_XJVILL
  170. <trim prefix="set" suffixOverrides=",">
  171. <if test="objId != null and objId != ''">OBJ_ID
  172. = #{objId},
  173. </if>
  174. <if test="nm != null and nm != ''">NM
  175. = #{nm},
  176. </if>
  177. <if test="adCode != null and adCode != ''">AD_CODE
  178. = #{adCode},
  179. </if>
  180. <if test="adName != null and adName != ''">AD_NAME
  181. = #{adName},
  182. </if>
  183. <if test="state != null and state != ''">STATE
  184. = #{state},
  185. </if>
  186. <if test="dutyState != null and dutyState != ''">DUTY_STATE
  187. = #{dutyState},
  188. </if>
  189. <if test="persId != null and persId != ''">PERS_ID
  190. = #{persId},
  191. </if>
  192. <if test="intm != null">INTM
  193. = #{intm},
  194. </if>
  195. <if test="uptm != null">UPTM
  196. = #{uptm},
  197. </if>
  198. <if test="note != null and note != ''">NOTE
  199. = #{note},
  200. </if>
  201. <if test="dataStat != null and dataStat != ''">DATA_STAT
  202. = #{dataStat},
  203. </if>
  204. </trim>
  205. <include refid="page_where"/>
  206. </update>
  207. <!-- 其他自定义SQL -->
  208. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspXjvillDto">
  209. SELECT * FROM (
  210. select
  211. A.CODE, A.ptype, A.ID nodeId, ia.pnm groupName,
  212. B.ID as rgstrId,
  213. B.ID,
  214. B.OBJ_ID,
  215. B.NM,
  216. B.AD_CODE,
  217. B.AD_NAME,
  218. B.STATE,
  219. B.DUTY_STATE,
  220. B.PERS_ID,
  221. B.INTM,
  222. B.UPTM,
  223. B.NOTE
  224. FROM BIS_INSP_ALL_OBJ A
  225. JOIN BIS_INSP_XJVILL B ON A.OBJ_ID=B.OBJ_ID
  226. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  227. LEFT JOIN ATT_AD_X_BASE AW ON B.AD_CODE = AW.AD_CODE
  228. <where>
  229. <if test="adCodes ==null or adCodes ==''">
  230. <choose>
  231. <when test='isAll =="1"'>
  232. </when>
  233. <otherwise>
  234. <if test="groupIds != null and groupIds.length &gt; 0">
  235. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and ("
  236. close=")">
  237. A.id like '${gId}%'
  238. </foreach>
  239. </if>
  240. </otherwise>
  241. </choose>
  242. </if>
  243. <if test="adCodes !=null and adCodes !=''">
  244. and
  245. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  246. b.ad_code like concat('${item}','%')
  247. </foreach>
  248. </if>
  249. </where>
  250. ) A
  251. <where>
  252. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  253. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  254. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  255. <if test="code !=null and code !=''">and code = #{code}</if>
  256. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  257. <if test="state !=null and state !=''">and STATE in (${state})</if>
  258. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  259. <if test="sttm != null and sttm != ''">and Intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  260. <if test="entm != null and entm != ''">and Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  261. </where>
  262. order by nodeId asc
  263. <if test="orderBy != null and orderBy != ''">
  264. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  265. </if>
  266. </select>
  267. </mapper>