BisInspMfdpRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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.BisInspMfdpRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr" id="bisInspMfdpRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="poorCountry" column="POOR_COUNTRY"/>
  10. <result property="inspType" column="INSP_TYPE"/>
  11. <result property="sitroTownNum" column="SITRO_TOWN_NUM"/>
  12. <result property="sitroVlgNum" column="SITRO_VLG_NUM"/>
  13. <result property="sitroRxNum" column="SITRO_RX_NUM"/>
  14. <result property="sitroMsNum" column="SITRO_MS_NUM"/>
  15. <result property="state" column="STATE"/>
  16. <result property="groupLeader" column="GROUP_LEADER"/>
  17. <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
  18. <result property="recPersId" column="REC_PERS_ID"/>
  19. <result property="recPers" column="REC_PERS"/>
  20. <result property="recPersTel" column="REC_PERS_TEL"/>
  21. <result property="intm" column="INTM"/>
  22. <result property="uptm" column="UPTM"/>
  23. <result property="note" column="NOTE"/>
  24. </resultMap>
  25. <sql id="table_columns">
  26. ID,
  27. OBJ_ID,
  28. AD_CODE,
  29. AD_NAME,
  30. POOR_COUNTRY,
  31. INSP_TYPE,
  32. SITRO_TOWN_NUM,
  33. SITRO_VLG_NUM,
  34. SITRO_RX_NUM,
  35. SITRO_MS_NUM,
  36. STATE,
  37. GROUP_LEADER,
  38. GROUP_LEADER_TEL,
  39. REC_PERS_ID,
  40. REC_PERS,
  41. REC_PERS_TEL,
  42. INTM,
  43. UPTM,
  44. NOTE
  45. </sql>
  46. <sql id="entity_properties">
  47. #{id},
  48. #{objId},
  49. #{adCode},
  50. #{adName},
  51. #{poorCountry},
  52. #{inspType},
  53. #{sitroTownNum},
  54. #{sitroVlgNum},
  55. #{sitroRxNum},
  56. #{sitroMsNum},
  57. #{state},
  58. #{groupLeader},
  59. #{groupLeaderTel},
  60. #{recPersId},
  61. #{recPers},
  62. #{recPersTel},
  63. #{intm},
  64. #{uptm},
  65. #{note}
  66. </sql>
  67. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  68. <sql id="page_where">
  69. <trim prefix="where" prefixOverrides="and | or ">
  70. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  71. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  72. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  73. <if test="poorCountry != null and poorCountry != ''">and POOR_COUNTRY = #{poorCountry}</if>
  74. <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
  75. <if test="sitroTownNum != null and sitroTownNum != ''">and SITRO_TOWN_NUM = #{sitroTownNum}</if>
  76. <if test="sitroVlgNum != null and sitroVlgNum != ''">and SITRO_VLG_NUM = #{sitroVlgNum}</if>
  77. <if test="sitroRxNum != null and sitroRxNum != ''">and SITRO_RX_NUM = #{sitroRxNum}</if>
  78. <if test="sitroMsNum != null and sitroMsNum != ''">and SITRO_MS_NUM = #{sitroMsNum}</if>
  79. <if test="state != null and state != ''">and STATE = #{state}</if>
  80. <if test="groupLeader != null and groupLeader != ''">and GROUP_LEADER = #{groupLeader}</if>
  81. <if test="groupLeaderTel != null and groupLeaderTel != ''">and GROUP_LEADER_TEL = #{groupLeaderTel}</if>
  82. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  83. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  84. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  85. <if test="intm != null">and INTM = #{intm}</if>
  86. <if test="uptm != null">and UPTM = #{uptm}</if>
  87. <if test="note != null and note != ''">and NOTE = #{note}</if>
  88. </trim>
  89. </sql>
  90. <select id="get" resultMap="bisInspMfdpRgstrResultMap" parameterType="String" >
  91. select <include refid="table_columns" /> from BIS_INSP_MFDP_RGSTR where ID = #{id}
  92. </select>
  93. <select id="getBy" resultMap="bisInspMfdpRgstrResultMap">
  94. select <include refid="table_columns" /> from BIS_INSP_MFDP_RGSTR <include refid="page_where" />
  95. </select>
  96. <select id="findAll" resultMap="bisInspMfdpRgstrResultMap">
  97. select <include refid="table_columns" /> from BIS_INSP_MFDP_RGSTR
  98. </select>
  99. <select id="findList" resultMap="bisInspMfdpRgstrResultMap">
  100. select <include refid="table_columns" /> from BIS_INSP_MFDP_RGSTR <include refid="page_where" />
  101. </select>
  102. <select id="selectCount" resultType="int" >
  103. select count(ID) from BIS_INSP_MFDP_RGSTR <include refid="page_where" />
  104. </select>
  105. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
  106. insert into BIS_INSP_MFDP_RGSTR( <include refid="table_columns" /> )
  107. values ( <include refid="entity_properties" /> )
  108. </insert>
  109. <delete id="delete" parameterType="java.lang.String">
  110. delete from BIS_INSP_MFDP_RGSTR where ID = #{id}
  111. </delete>
  112. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
  113. delete from BIS_INSP_MFDP_RGSTR <include refid="page_where" />
  114. </delete>
  115. <update id="deleteInFlag" parameterType="java.lang.String">
  116. update BIS_INSP_MFDP_RGSTR set flag_valid = 0 where ID = #{id}
  117. </update>
  118. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
  119. update BIS_INSP_MFDP_RGSTR
  120. <trim prefix="set" suffixOverrides=",">
  121. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  122. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  123. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  124. <if test="poorCountry != null and poorCountry != ''">POOR_COUNTRY = #{poorCountry},</if>
  125. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  126. <if test="sitroTownNum != null and sitroTownNum != ''">SITRO_TOWN_NUM = #{sitroTownNum},</if>
  127. <if test="sitroVlgNum != null and sitroVlgNum != ''">SITRO_VLG_NUM = #{sitroVlgNum},</if>
  128. <if test="sitroRxNum != null and sitroRxNum != ''">SITRO_RX_NUM = #{sitroRxNum},</if>
  129. <if test="sitroMsNum != null and sitroMsNum != ''">SITRO_MS_NUM = #{sitroMsNum},</if>
  130. <if test="state != null and state != ''">STATE = #{state},</if>
  131. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  132. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  133. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  134. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  135. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  136. <if test="intm != null">INTM = #{intm},</if>
  137. <if test="uptm != null">UPTM = #{uptm},</if>
  138. <if test="note != null and note != ''">NOTE = #{note},</if>
  139. </trim>
  140. <where>ID = #{id}</where>
  141. </update>
  142. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
  143. update BIS_INSP_MFDP_RGSTR
  144. <trim prefix="set" suffixOverrides=",">
  145. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  146. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  147. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  148. <if test="poorCountry != null and poorCountry != ''">POOR_COUNTRY = #{poorCountry},</if>
  149. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  150. <if test="sitroTownNum != null and sitroTownNum != ''">SITRO_TOWN_NUM = #{sitroTownNum},</if>
  151. <if test="sitroVlgNum != null and sitroVlgNum != ''">SITRO_VLG_NUM = #{sitroVlgNum},</if>
  152. <if test="sitroRxNum != null and sitroRxNum != ''">SITRO_RX_NUM = #{sitroRxNum},</if>
  153. <if test="sitroMsNum != null and sitroMsNum != ''">SITRO_MS_NUM = #{sitroMsNum},</if>
  154. <if test="state != null and state != ''">STATE = #{state},</if>
  155. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  156. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  157. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  158. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  159. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  160. <if test="intm != null">INTM = #{intm},</if>
  161. <if test="uptm != null">UPTM = #{uptm},</if>
  162. <if test="note != null and note != ''">NOTE = #{note},</if>
  163. </trim>
  164. <include refid="page_where" />
  165. </update>
  166. <!-- 其他自定义SQL -->
  167. <select id="findMfdpList" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  168. resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  169. SELECT * FROM (
  170. select A.CODE,A.ID nodeId,
  171. A.NM,
  172. #{pType} PTYPE,
  173. b.SITRO_TOWN_NUM,
  174. b.SITRO_VLG_NUM,
  175. b.SITRO_RX_NUM,
  176. b.SITRO_MS_NUM,
  177. C.LGTDPC pc_x,
  178. c.LTTDPC pc_y,
  179. C.LGTD GD_X,
  180. C.LTTD GD_y,
  181. A.OBJ_ID,B.ID ID,b.id as rgstrId,
  182. (case when b.State is null then '0' else b.state end)STATE
  183. ,B.INTM,
  184. c.ad_full_name as adName,
  185. ia.pnm groupName,b.ad_code
  186. from BIS_INSP_ALL_OBJ
  187. A LEFT JOIN BIS_INSP_MFDP_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  188. LEFT JOIN ATT_AD_X_BASE C ON B.Ad_CODE=C.AD_CODE
  189. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  190. where A.ptype= #{pType}
  191. <if test="tabType =='2'.toString()">
  192. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  193. </if>
  194. <if test="tabType =='1'.toString()">
  195. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  196. </if>
  197. <if test="adCodes ==null or adCodes ==''">
  198. and REGEXP_LIKE(
  199. A.Id,'^('||
  200. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId})>0 then
  201. (SELECT LISTAGG(id, '|') as id FROM (select distinct substr(o.id,0,6) as id,o.persid,o.pertype
  202. from BIS_INSP_ALL_RLATION o WHERE PERSID =#{presId} and o.id like '${pType}%' ) e group by persid)
  203. else (select 'non' from dual) end)
  204. ||')')
  205. </if>
  206. <if test="poorCountry != null and poorCountry != ''">
  207. and (case when b.POOR_COUNTRY is null then c.IS_REPORT else b.POOR_COUNTRY end ) = #{poorCountry}
  208. </if>
  209. <if test="adCode != null and adCode != ''">
  210. and b.ad_code like '${adCode}%'
  211. </if>
  212. <choose>
  213. <when test="province !=null and province !=''">
  214. and A.AD_CODE like '${province}%'
  215. </when>
  216. <otherwise>
  217. and A.AD_CODE is null
  218. </otherwise>
  219. </choose>
  220. ) A WHERE a.PTYPE=#{pType}
  221. <if test="plnaId !=null and plnaId !=''">
  222. and a.nodeId like '${plnaId}%'
  223. </if>
  224. <if test="state !=null and state !=''">
  225. and STATE in (${state})
  226. </if>
  227. <if test="rsName !=null and rsName !=''">
  228. and a.nm like '%${rsName}%'
  229. </if>
  230. <if test="name !=null and name !=''">
  231. and a.nm like '%${name}%'
  232. </if>
  233. <if test="code !=null and code !=''">
  234. and a.code = #{code}
  235. </if>
  236. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  237. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  238. <if test="adCodes !=null and adCodes !=''">
  239. and
  240. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  241. ad_code like concat('${item}','%')
  242. </foreach>
  243. </if>
  244. order by nodeId asc
  245. <if test="orderBy != null and orderBy != ''">
  246. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  247. </if>
  248. </select>
  249. <select id="findPblmList" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm" parameterType="cn.com.goldenwater.dcproj.param.PlbmParam">
  250. select w.* from (
  251. select j.id as oid,j.obj_id,m.pblm_id,m.obj_type,m.insp_pblm_name ,m.insp_pblm_desc,m.pblm_long,m.pblm_lat,s.check_point,m.INSP_PBLM_CATE,
  252. m.new_vill_name,j.nm,m.vill_type,m.has_vedio,m.quote,m.rec_pers,
  253. m.regid,j.code as ad_code,ba.ad_full_name,s.sn_num,p.pers_name,al.sttm,al.entm,
  254. m.insp_add_desc,m.coll_time,(select l.pnm from bis_insp_all l where l.id=substr(al.id,0,6)) as pnm,
  255. (select org_nm from bis_insp_org where org_id=substr(al.id,4,3)) as org_nm
  256. from (select m.* from BIS_INSP_PBLM m where m.obj_type='27'
  257. ) m
  258. join (select * from BIS_INSP_ALL_OBJ j where j.pType='27') j on m.obj_id=j.obj_id
  259. join obj_insp_pblms s on m.pblms_type_id=s.guid
  260. left join bis_insp_all al on al.id=j.id
  261. left join bis_insp_all_rlation_pers p on m.rec_pers=p.guid
  262. left join att_ad_x_base ba on j.code=ba.ad_code
  263. ) w
  264. where 1=1
  265. <if test="tabType =='2'.toString()">
  266. and w.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  267. </if>
  268. <if test="tabType =='1'.toString()">
  269. and w.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd') and w.sttm &lt; to_date(#{nowTime},'yyyy-MM-dd')+1
  270. </if>
  271. <if test="timeType =='1'.toString()">
  272. and w.COLL_TIME >=to_date(#{nowTime},'yyyy-MM-dd')
  273. </if>
  274. <if test="timeType =='2'.toString()">
  275. and w.COLL_TIME &gt;=to_date(#{nowMonth},'yyyy-MM')
  276. </if>
  277. <if test="timeType =='3'.toString()">
  278. and w.COLL_TIME &gt;=to_date(#{nowYear},'yyyy')
  279. </if>
  280. and
  281. REGEXP_LIKE(
  282. W.OID,'^('||
  283. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId})>0 then
  284. (SELECT LISTAGG(id, '|') as id FROM (select distinct substr(o.id,0,6) as id,o.persid,o.pertype
  285. from BIS_INSP_ALL_RLATION o WHERE PERSID =#{presId} AND o.id like '027%' ) e group by persid)
  286. else (select 'non' from dual) end)
  287. ||')')
  288. <if test="inspPblmName !=null and inspPblmName !=''">
  289. and w.insp_pblm_name in (${inspPblmName})
  290. </if>
  291. <if test="checkPoint !=null and checkPoint !=''">
  292. and w.check_point in (${checkPoint})
  293. </if>
  294. <if test="inspPblmCate !=null and inspPblmCate !=''">
  295. and w.INSP_PBLM_CATE in (${inspPblmCate})
  296. </if>
  297. <if test="pblmName != null and pblmName != ''">
  298. and INSP_PBLM_NAME like concat(concat('%',#{pblmName}),'%')
  299. </if>
  300. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= TO_DATE(#{startTime},'YYYY-MM-DD')</if>
  301. <if test="findTime != null and findTime != ''">and COLL_TIME=TO_DATE(#{findTime},'YYYY-MM-DD')</if>
  302. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; TO_DATE(#{endTime},'YYYY-MM-DD')+1</if>
  303. <if test="oides != null and oides != ''">and oid in (${oides})</if>
  304. <if test="regid !=null and regid !=''">
  305. and w.regid=#{regid}
  306. </if>
  307. <if test="recPers !=null and recPers !=''">
  308. and w.rec_Pers=#{recPers}
  309. </if>
  310. <if test="objId !=null and objId !=''">
  311. and w.obj_id=#{objId}
  312. </if>
  313. <if test="groupId !=null and groupId !=''">
  314. and oid like '${groupId}%'
  315. </if>
  316. <if test="adFullName !=null and adFullName !=''">
  317. and w.AD_FULL_NAMe like '%${adFullName}%'
  318. </if>
  319. <if test="persName !=null and persName !=''">
  320. and w.PERS_NAME like '%${persName}%'
  321. </if>
  322. <if test="nm !=null and nm !=''">
  323. and w.NM like '%${nm}%'
  324. </if>
  325. <if test="orgNm !=null and orgNm !=''">
  326. and w.ORG_NM like '%${orgNm}%'
  327. </if>
  328. <if test="hasVedio !=null and hasVedio !=''">
  329. and w.HAS_VEDIO=#{hasVedio}
  330. </if>
  331. <if test="adCode !=null and adCode !=''">
  332. and w.AD_CODE like '${adCode}%'
  333. </if>
  334. order by w.AD_CODE
  335. <if test="orderBy !=null and orderBy !=''">
  336. ,${orderBy}
  337. </if>
  338. </select>
  339. </mapper>