BisInspWtuntRgstrDao.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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.BisInspWtuntRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr" id="bisInspWtuntRgstrResultMap">
  5. <result property="id" column="ID" />
  6. <result property="objId" column="OBJ_ID" />
  7. <result property="wtuntId" column="WTUNT_ID" />
  8. <result property="utName" column="UT_NAME" />
  9. <result property="utCode" column="UT_CODE" />
  10. <result property="adName" column="AD_NAME" />
  11. <result property="adCode" column="AD_CODE" />
  12. <result property="utType" column="UT_TYPE" />
  13. <result property="utPpt" column="UT_PPT" />
  14. <result property="utLead" column="UT_LEAD" />
  15. <result property="utAttn" column="UT_ATTN" />
  16. <result property="utCont" column="UT_CONT" />
  17. <result property="signAddr" column="SIGN_ADDR" />
  18. <result property="utAddr" column="UT_ADDR" />
  19. <result property="centerX" column="CENTER_X" />
  20. <result property="centerY" column="CENTER_Y" />
  21. <result property="gdX" column="GD_X" />
  22. <result property="gdY" column="GD_Y" />
  23. <result property="chkUnit" column="CHK_UNIT" />
  24. <result property="chkPers" column="CHK_PERS" />
  25. <result property="chkTm" column="CHK_TM" />
  26. <result property="state" column="STATE" />
  27. <result property="wtuntStat" column="WTUNT_STAT" />
  28. <result property="persId" column="PERS_ID" />
  29. <result property="groupId" column="GROUP_ID" />
  30. <result property="intm" column="INTM" />
  31. <result property="uptm" column="UPTM" />
  32. <result property="intakeNo" column="INTAKE_NO" />
  33. <result property="intakeAmt" column="INTAKE_AMT" />
  34. </resultMap>
  35. <sql id="table_columns">
  36. ID,
  37. OBJ_ID,
  38. WTUNT_ID,
  39. UT_NAME,
  40. INTAKE_NO,
  41. INTAKE_AMT,
  42. UT_CODE,
  43. AD_NAME,
  44. AD_CODE,
  45. UT_TYPE,
  46. UT_PPT,
  47. UT_LEAD,
  48. UT_ATTN,
  49. UT_CONT,
  50. SIGN_ADDR,
  51. UT_ADDR,
  52. CENTER_X,
  53. CENTER_Y,
  54. GD_X,
  55. GD_Y,
  56. CHK_UNIT,
  57. CHK_PERS,
  58. CHK_TM,
  59. STATE,
  60. WTUNT_STAT,
  61. PERS_ID,
  62. GROUP_ID,
  63. INTM,
  64. UPTM
  65. </sql>
  66. <sql id="entity_properties">
  67. #{id},
  68. #{objId},
  69. #{wtuntId},
  70. #{utName},
  71. #{intakeNo},
  72. #{intakeAmt},
  73. #{utCode},
  74. #{adName},
  75. #{adCode},
  76. #{utType},
  77. #{utPpt},
  78. #{utLead},
  79. #{utAttn},
  80. #{utCont},
  81. #{signAddr},
  82. #{utAddr},
  83. #{centerX},
  84. #{centerY},
  85. #{gdX},
  86. #{gdY},
  87. #{chkUnit},
  88. #{chkPers},
  89. #{chkTm},
  90. #{state},
  91. #{wtuntStat},
  92. #{persId},
  93. #{groupId},
  94. #{intm},
  95. #{uptm}
  96. </sql>
  97. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  98. <sql id="page_where">
  99. <trim prefix="where" prefixOverrides="and | or ">
  100. <if test="intakeNo != null and intakeNo != ''">and INTAKE_NO = #{intakeNo}</if>
  101. <if test="intakeAmt != null and intakeAmt != ''">and INTAKE_AMT = #{intakeAmt}</if>
  102. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  103. <if test="wtuntId != null and wtuntId != ''">and WTUNT_ID = #{wtuntId}</if>
  104. <if test="utName != null and utName != ''">and UT_NAME = #{utName}</if>
  105. <if test="utCode != null and utCode != ''">and UT_CODE = #{utCode}</if>
  106. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  107. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  108. <if test="utType != null and utType != ''">and UT_TYPE = #{utType}</if>
  109. <if test="utPpt != null and utPpt != ''">and UT_PPT = #{utPpt}</if>
  110. <if test="utLead != null and utLead != ''">and UT_LEAD = #{utLead}</if>
  111. <if test="utAttn != null and utAttn != ''">and UT_ATTN = #{utAttn}</if>
  112. <if test="utCont != null and utCont != ''">and UT_CONT = #{utCont}</if>
  113. <if test="signAddr != null and signAddr != ''">and SIGN_ADDR = #{signAddr}</if>
  114. <if test="utAddr != null and utAddr != ''">and UT_ADDR = #{utAddr}</if>
  115. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  116. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  117. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  118. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  119. <if test="chkUnit != null and chkUnit != ''">and CHK_UNIT = #{chkUnit}</if>
  120. <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
  121. <if test="chkTm != null">and CHK_TM = #{chkTm}</if>
  122. <if test="state != null and state != ''">and STATE = #{state}</if>
  123. <if test="wtuntStat != null and wtuntStat != ''">and WTUNT_STAT = #{wtuntStat}</if>
  124. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  125. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  126. <if test="intm != null">and INTM = #{intm}</if>
  127. <if test="uptm != null">and UPTM = #{uptm}</if>
  128. </trim>
  129. </sql>
  130. <select id="get" resultMap="bisInspWtuntRgstrResultMap" parameterType="String" >
  131. select <include refid="table_columns" /> from BIS_INSP_WTUNT_RGSTR where ID = #{id}
  132. </select>
  133. <select id="getBy" resultMap="bisInspWtuntRgstrResultMap">
  134. select <include refid="table_columns" /> from BIS_INSP_WTUNT_RGSTR <include refid="page_where" />
  135. </select>
  136. <select id="findAll" resultMap="bisInspWtuntRgstrResultMap">
  137. select <include refid="table_columns" /> from BIS_INSP_WTUNT_RGSTR
  138. </select>
  139. <select id="findList" resultMap="bisInspWtuntRgstrResultMap">
  140. select <include refid="table_columns" /> from BIS_INSP_WTUNT_RGSTR <include refid="page_where" />
  141. </select>
  142. <select id="selectCount" resultType="int" >
  143. select count(ID) from BIS_INSP_WTUNT_RGSTR <include refid="page_where" />
  144. </select>
  145. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr">
  146. insert into BIS_INSP_WTUNT_RGSTR( <include refid="table_columns" /> )
  147. values ( <include refid="entity_properties" /> )
  148. </insert>
  149. <delete id="delete" parameterType="java.lang.String">
  150. delete from BIS_INSP_WTUNT_RGSTR where ID = #{id}
  151. </delete>
  152. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr">
  153. delete from BIS_INSP_WTUNT_RGSTR <include refid="page_where" />
  154. </delete>
  155. <update id="deleteInFlag" parameterType="java.lang.String">
  156. update BIS_INSP_WTUNT_RGSTR set flag_valid = 0 where>ID = #{id}
  157. </update>
  158. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr">
  159. update BIS_INSP_WTUNT_RGSTR
  160. <trim prefix="set" suffixOverrides=",">
  161. <if test="intakeNo != null and intakeNo != ''">INTAKE_NO = #{intakeNo},</if>
  162. <if test="intakeAmt != null and intakeAmt != ''">INTAKE_AMT = #{intakeAmt},</if>
  163. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  164. <if test="wtuntId != null and wtuntId != ''">WTUNT_ID = #{wtuntId},</if>
  165. <if test="utName != null and utName != ''">UT_NAME = #{utName},</if>
  166. <if test="utCode != null and utCode != ''">UT_CODE = #{utCode},</if>
  167. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  168. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  169. <if test="utType != null and utType != ''">UT_TYPE = #{utType},</if>
  170. <if test="utPpt != null and utPpt != ''">UT_PPT = #{utPpt},</if>
  171. <if test="utLead != null and utLead != ''">UT_LEAD = #{utLead},</if>
  172. <if test="utAttn != null and utAttn != ''">UT_ATTN = #{utAttn},</if>
  173. <if test="utCont != null and utCont != ''">UT_CONT = #{utCont},</if>
  174. <if test="signAddr != null and signAddr != ''">SIGN_ADDR = #{signAddr},</if>
  175. <if test="utAddr != null and utAddr != ''">UT_ADDR = #{utAddr},</if>
  176. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  177. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  178. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  179. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  180. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  181. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  182. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  183. <if test="state != null and state != ''">STATE = #{state},</if>
  184. <if test="wtuntStat != null and wtuntStat != ''">WTUNT_STAT = #{wtuntStat},</if>
  185. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  186. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  187. <if test="intm != null">INTM = #{intm},</if>
  188. <if test="uptm != null">UPTM = #{uptm},</if>
  189. </trim>
  190. <where>ID = #{id}</where>
  191. </update>
  192. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr">
  193. update BIS_INSP_WTUNT_RGSTR
  194. <trim prefix="set" suffixOverrides=",">
  195. <if test="intakeNo != null and intakeNo != ''">INTAKE_NO = #{intakeNo},</if>
  196. <if test="intakeAmt != null and intakeAmt != ''">INTAKE_AMT = #{intakeAmt},</if>
  197. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  198. <if test="wtuntId != null and wtuntId != ''">WTUNT_ID = #{wtuntId},</if>
  199. <if test="utName != null and utName != ''">UT_NAME = #{utName},</if>
  200. <if test="utCode != null and utCode != ''">UT_CODE = #{utCode},</if>
  201. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  202. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  203. <if test="utType != null and utType != ''">UT_TYPE = #{utType},</if>
  204. <if test="utPpt != null and utPpt != ''">UT_PPT = #{utPpt},</if>
  205. <if test="utLead != null and utLead != ''">UT_LEAD = #{utLead},</if>
  206. <if test="utAttn != null and utAttn != ''">UT_ATTN = #{utAttn},</if>
  207. <if test="utCont != null and utCont != ''">UT_CONT = #{utCont},</if>
  208. <if test="signAddr != null and signAddr != ''">SIGN_ADDR = #{signAddr},</if>
  209. <if test="utAddr != null and utAddr != ''">UT_ADDR = #{utAddr},</if>
  210. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  211. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  212. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  213. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  214. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  215. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  216. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  217. <if test="state != null and state != ''">STATE = #{state},</if>
  218. <if test="wtuntStat != null and wtuntStat != ''">WTUNT_STAT = #{wtuntStat},</if>
  219. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  220. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  221. <if test="intm != null">INTM = #{intm},</if>
  222. <if test="uptm != null">UPTM = #{uptm},</if>
  223. </trim>
  224. <include refid="page_where" />
  225. </update>
  226. <!-- 其他自定义SQL -->
  227. <select id="findWtuntPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  228. SELECT * FROM (
  229. select
  230. A.CODE,
  231. A.ID nodeId,
  232. A.NM,
  233. #{pType} pType,
  234. A.OBJ_ID,
  235. B.ID ID,
  236. b.id as rgstrId,
  237. aw.id as baseId,
  238. (case when b.State is null then '0' else b.state end) STATE,
  239. B.INTM,B.UPTM,
  240. b.AD_CODE,
  241. b.AD_NAME as adName,
  242. ia.pnm groupName,
  243. b.WTUNT_STAT as wtuntStat,
  244. b.ut_Type as type,
  245. b.INTAKE_NO,
  246. b.INTAKE_AMT
  247. from BIS_INSP_ALL_OBJ
  248. A LEFT JOIN BIS_INSP_WTUNT_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  249. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  250. LEFT JOIN ATT_WTUNT_BASE aw on B.WTUNT_ID = aw.id
  251. where A.ptype= #{pType}
  252. <if test="adCodes ==null or adCodes ==''">
  253. <choose>
  254. <when test='isAll =="1"'>
  255. </when>
  256. <otherwise>
  257. and
  258. A.Id in (
  259. select distinct id from (
  260. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  261. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  262. CONNECT BY P.PID = PRIOR P.ID
  263. union all
  264. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  265. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  266. )
  267. )
  268. </otherwise>
  269. </choose>
  270. </if>
  271. <if test="adCodes !=null and adCodes !=''">
  272. and
  273. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  274. b.ad_code like concat('${item}','%')
  275. </foreach>
  276. </if>
  277. ) A WHERE a.PTYPE=#{pType}
  278. <if test="adCode != null and adCode != '' ">
  279. and a.AD_CODE like '${adCode}%'
  280. </if>
  281. <if test="plnaId !=null and plnaId !=''">
  282. and a.nodeId like '${plnaId}%'
  283. </if>
  284. <if test="state !=null and state !=''">
  285. and STATE in (${state})
  286. </if>
  287. <if test="rsName !=null and rsName !=''">
  288. and a.nm like '%${rsName}%'
  289. </if>
  290. <if test="code !=null and code !=''">
  291. and a.code = #{code}
  292. </if>
  293. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  294. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  295. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  296. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  297. order by nodeId asc
  298. <if test="orderBy != null and orderBy != ''">
  299. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  300. </if>
  301. </select>
  302. </mapper>