BisInspChmclsRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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.BisInspChmclsRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr" id="bisInspChmclsRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="depName" column="DEP_NAME"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="adGrad" column="AD_GRAD"/>
  11. <result property="loc" column="LOC"/>
  12. <result property="depPers" column="DEP_PERS"/>
  13. <result property="depPersTel" column="DEP_PERS_TEL"/>
  14. <result property="utLead" column="UT_LEAD"/>
  15. <result property="principalTel" column="PRINCIPAL_TEL"/>
  16. <result property="note" column="NOTE"/>
  17. <result property="state" column="STATE"/>
  18. <result property="depwkState" column="DEPWK_STATE"/>
  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="intm" column="INTM"/>
  24. <result property="uptm" column="UPTM"/>
  25. <result property="dataStat" column="DATA_STAT"/>
  26. </resultMap>
  27. <sql id="table_columns">
  28. ID,
  29. OBJ_ID,
  30. DEP_NAME,
  31. AD_CODE,
  32. AD_NAME,
  33. AD_GRAD,
  34. LOC,
  35. DEP_PERS,
  36. DEP_PERS_TEL,
  37. UT_LEAD,
  38. PRINCIPAL_TEL,
  39. NOTE,
  40. STATE,
  41. DEPWK_STATE,
  42. CENTER_X,
  43. CENTER_Y,
  44. GD_X,
  45. GD_Y,
  46. INTM,
  47. UPTM,
  48. DATA_STAT
  49. </sql>
  50. <sql id="entity_properties">
  51. #{id},
  52. #{objId},
  53. #{depName},
  54. #{adCode},
  55. #{adName},
  56. #{adGrad},
  57. #{loc},
  58. #{depPers},
  59. #{depPersTel},
  60. #{utLead},
  61. #{principalTel},
  62. #{note},
  63. #{state},
  64. #{depwkState},
  65. #{centerX},
  66. #{centerY},
  67. #{gdX},
  68. #{gdY},
  69. #{intm},
  70. #{uptm},
  71. #{dataStat}
  72. </sql>
  73. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  74. <sql id="page_where">
  75. <trim prefix="where" prefixOverrides="and | or ">
  76. <if test="objId != null and objId != ''">
  77. and OBJ_ID = #{objId}
  78. </if>
  79. <if test="depName != null and depName != ''">
  80. and DEP_NAME = #{depName}
  81. </if>
  82. <if test="adCode != null and adCode != ''">
  83. and AD_CODE = #{adCode}
  84. </if>
  85. <if test="adName != null and adName != ''">
  86. and AD_NAME = #{adName}
  87. </if>
  88. <if test="adGrad != null and adGrad != ''">
  89. and AD_GRAD = #{adGrad}
  90. </if>
  91. <if test="loc != null and loc != ''">
  92. and LOC = #{loc}
  93. </if>
  94. <if test="depPers != null and depPers != ''">
  95. and DEP_PERS = #{depPers}
  96. </if>
  97. <if test="depPersTel != null and depPersTel != ''">
  98. and DEP_PERS_TEL = #{depPersTel}
  99. </if>
  100. <if test="utLead != null and utLead != ''">
  101. and UT_LEAD = #{utLead}
  102. </if>
  103. <if test="principalTel != null and principalTel != ''">
  104. and PRINCIPAL_TEL = #{principalTel}
  105. </if>
  106. <if test="note != null and note != ''">
  107. and NOTE = #{note}
  108. </if>
  109. <if test="state != null and state != ''">
  110. and STATE = #{state}
  111. </if>
  112. <if test="depwkState != null and depwkState != ''">
  113. and DEPWK_STATE = #{depwkState}
  114. </if>
  115. <if test="centerX != null and centerX != ''">
  116. and CENTER_X = #{centerX}
  117. </if>
  118. <if test="centerY != null and centerY != ''">
  119. and CENTER_Y = #{centerY}
  120. </if>
  121. <if test="gdX != null and gdX != ''">
  122. and GD_X = #{gdX}
  123. </if>
  124. <if test="gdY != null and gdY != ''">
  125. and GD_Y = #{gdY}
  126. </if>
  127. <if test="intm != null">
  128. and INTM = #{intm}
  129. </if>
  130. <if test="uptm != null">
  131. and UPTM = #{uptm}
  132. </if>
  133. <if test="dataStat != null and dataStat != ''">
  134. and DATA_STAT = #{dataStat}
  135. </if>
  136. and DATA_STAT='0'
  137. </trim>
  138. </sql>
  139. <select id="get" resultMap="bisInspChmclsRgstrResultMap" parameterType="String">
  140. select
  141. <include refid="table_columns"/>
  142. from BIS_INSP_CHMCLS_RGSTR where ID = #{id}
  143. </select>
  144. <select id="getBy" resultMap="bisInspChmclsRgstrResultMap">
  145. select
  146. <include refid="table_columns"/>
  147. from BIS_INSP_CHMCLS_RGSTR
  148. <include refid="page_where"/>
  149. </select>
  150. <select id="findAll" resultMap="bisInspChmclsRgstrResultMap">
  151. select
  152. <include refid="table_columns"/>
  153. from BIS_INSP_CHMCLS_RGSTR
  154. </select>
  155. <select id="findList" resultMap="bisInspChmclsRgstrResultMap">
  156. select
  157. <include refid="table_columns"/>
  158. from BIS_INSP_CHMCLS_RGSTR
  159. <include refid="page_where"/>
  160. </select>
  161. <select id="selectCount" resultType="int">
  162. select count(ID) from BIS_INSP_CHMCLS_RGSTR
  163. <include refid="page_where"/>
  164. </select>
  165. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr">
  166. insert into BIS_INSP_CHMCLS_RGSTR(
  167. <include refid="table_columns"/>
  168. )
  169. values (
  170. <include refid="entity_properties"/>
  171. )
  172. </insert>
  173. <delete id="delete" parameterType="java.lang.String">
  174. update BIS_INSP_CHMCLS_RGSTR set DATA_STAT='9' where ID = #{id}
  175. </delete>
  176. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr">
  177. update BIS_INSP_CHMCLS_RGSTR set DATA_STAT='9'
  178. <include refid="page_where"/>
  179. </delete>
  180. <update id="deleteInFlag" parameterType="java.lang.String">
  181. update BIS_INSP_CHMCLS_RGSTR set DATA_STAT = '9' where ID = #{id}
  182. </update>
  183. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr">
  184. update BIS_INSP_CHMCLS_RGSTR
  185. <trim prefix="set" suffixOverrides=",">
  186. <if test="objId != null and objId != ''">OBJ_ID
  187. = #{objId},
  188. </if>
  189. <if test="depName != null and depName != ''">DEP_NAME
  190. = #{depName},
  191. </if>
  192. <if test="adCode != null and adCode != ''">AD_CODE
  193. = #{adCode},
  194. </if>
  195. <if test="adName != null and adName != ''">AD_NAME
  196. = #{adName},
  197. </if>
  198. <if test="adGrad != null and adGrad != ''">AD_GRAD
  199. = #{adGrad},
  200. </if>
  201. <if test="loc != null and loc != ''">LOC
  202. = #{loc},
  203. </if>
  204. <if test="depPers != null and depPers != ''">DEP_PERS
  205. = #{depPers},
  206. </if>
  207. <if test="depPersTel != null and depPersTel != ''">DEP_PERS_TEL
  208. = #{depPersTel},
  209. </if>
  210. <if test="utLead != null and utLead != ''">UT_LEAD
  211. = #{utLead},
  212. </if>
  213. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL
  214. = #{principalTel},
  215. </if>
  216. <if test="note != null and note != ''">NOTE
  217. = #{note},
  218. </if>
  219. <if test="state != null and state != ''">STATE
  220. = #{state},
  221. </if>
  222. <if test="depwkState != null and depwkState != ''">DEPWK_STATE
  223. = #{depwkState},
  224. </if>
  225. <if test="centerX != null and centerX != ''">CENTER_X
  226. = #{centerX},
  227. </if>
  228. <if test="centerY != null and centerY != ''">CENTER_Y
  229. = #{centerY},
  230. </if>
  231. <if test="gdX != null and gdX != ''">GD_X
  232. = #{gdX},
  233. </if>
  234. <if test="gdY != null and gdY != ''">GD_Y
  235. = #{gdY},
  236. </if>
  237. <if test="intm != null">INTM
  238. = #{intm},
  239. </if>
  240. <if test="uptm != null">UPTM
  241. = #{uptm},
  242. </if>
  243. <if test="dataStat != null and dataStat != ''">DATA_STAT
  244. = #{dataStat},
  245. </if>
  246. </trim>
  247. <where>ID = #{id}</where>
  248. </update>
  249. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr">
  250. update BIS_INSP_CHMCLS_RGSTR
  251. <trim prefix="set" suffixOverrides=",">
  252. <if test="objId != null and objId != ''">OBJ_ID
  253. = #{objId},
  254. </if>
  255. <if test="depName != null and depName != ''">DEP_NAME
  256. = #{depName},
  257. </if>
  258. <if test="adCode != null and adCode != ''">AD_CODE
  259. = #{adCode},
  260. </if>
  261. <if test="adName != null and adName != ''">AD_NAME
  262. = #{adName},
  263. </if>
  264. <if test="adGrad != null and adGrad != ''">AD_GRAD
  265. = #{adGrad},
  266. </if>
  267. <if test="loc != null and loc != ''">LOC
  268. = #{loc},
  269. </if>
  270. <if test="depPers != null and depPers != ''">DEP_PERS
  271. = #{depPers},
  272. </if>
  273. <if test="depPersTel != null and depPersTel != ''">DEP_PERS_TEL
  274. = #{depPersTel},
  275. </if>
  276. <if test="utLead != null and utLead != ''">UT_LEAD
  277. = #{utLead},
  278. </if>
  279. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL
  280. = #{principalTel},
  281. </if>
  282. <if test="note != null and note != ''">NOTE
  283. = #{note},
  284. </if>
  285. <if test="state != null and state != ''">STATE
  286. = #{state},
  287. </if>
  288. <if test="depwkState != null and depwkState != ''">DEPWK_STATE
  289. = #{depwkState},
  290. </if>
  291. <if test="centerX != null and centerX != ''">CENTER_X
  292. = #{centerX},
  293. </if>
  294. <if test="centerY != null and centerY != ''">CENTER_Y
  295. = #{centerY},
  296. </if>
  297. <if test="gdX != null and gdX != ''">GD_X
  298. = #{gdX},
  299. </if>
  300. <if test="gdY != null and gdY != ''">GD_Y
  301. = #{gdY},
  302. </if>
  303. <if test="intm != null">INTM
  304. = #{intm},
  305. </if>
  306. <if test="uptm != null">UPTM
  307. = #{uptm},
  308. </if>
  309. <if test="dataStat != null and dataStat != ''">DATA_STAT
  310. = #{dataStat},
  311. </if>
  312. </trim>
  313. <include refid="page_where"/>
  314. </update>
  315. <!-- 其他自定义SQL -->
  316. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspChmclsRgstrDto">
  317. SELECT * FROM (
  318. select
  319. A.CODE, A.ID nodeId, A.NM, A.ptype, ia.pnm groupName,
  320. B.id as rgstrId, AW.AD_FULL_NAME,
  321. B.ID,
  322. B.OBJ_ID,
  323. B.DEP_NAME,
  324. B.AD_CODE,
  325. B.AD_NAME,
  326. B.AD_GRAD,
  327. B.LOC,
  328. B.DEP_PERS,
  329. B.DEP_PERS_TEL,
  330. B.UT_LEAD,
  331. B.PRINCIPAL_TEL,
  332. B.NOTE,
  333. B.STATE,
  334. B.DEPWK_STATE,
  335. B.CENTER_X,
  336. B.CENTER_Y,
  337. B.GD_X,
  338. B.GD_Y,
  339. B.INTM,
  340. B.UPTM,
  341. B.DATA_STAT
  342. FROM BIS_INSP_ALL_OBJ A
  343. JOIN BIS_INSP_CHMCLS_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  344. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  345. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  346. where A.ptype = #{pType}
  347. and B.DATA_STAT= '0'
  348. <if test="adCodes ==null or adCodes ==''">
  349. <choose>
  350. <when test='isAll =="1"'>
  351. </when>
  352. <otherwise>
  353. and
  354. A.Id in (
  355. select distinct id from (
  356. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  357. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  358. CONNECT BY P.PID = PRIOR P.ID
  359. union all
  360. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  361. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  362. )
  363. )
  364. </otherwise>
  365. </choose>
  366. </if>
  367. <if test="adCodes !=null and adCodes !=''">
  368. and
  369. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  370. b.ad_code like concat('${item}','%')
  371. </foreach>
  372. </if>
  373. ) A
  374. <where>
  375. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  376. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  377. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  378. <if test="code !=null and code !=''">and code = #{code}</if>
  379. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  380. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  381. <if test="engScal !=null and engScal !=''">and ENG_SCAL IN (${engScal})</if>
  382. <if test="state !=null and state !=''">and STATE in (${state})</if>
  383. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  384. <if test="sttm != null and sttm != ''">and INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  385. <if test="entm != null and entm != ''">and INTM &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  386. </where>
  387. order by nodeId asc
  388. <if test="orderBy != null and orderBy != ''">
  389. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  390. </if>
  391. </select>
  392. </mapper>