aa34b81c6d9cbb76aa2cc115d122321ff7bc0138.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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.BisNewVillRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisNewVillRgstr" id="bisNewVillRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="regsNm" column="REGS_NM"/>
  8. <result property="waterPriceIsMade" column="WATER_PRICE_IS_MADE"/>
  9. <result property="waterSafeOrPay" column="WATER_SAFE_OR_PAY"/>
  10. <result property="adCode" column="AD_CODE"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="intm" column="INTM"/>
  13. <result property="uptm" column="UPTM"/>
  14. <result property="note" column="NOTE"/>
  15. <result property="dataStat" column="DATA_STAT"/>
  16. <result property="state" column="STATE"/>
  17. <result property="adFullName" column="AD_FULL_NAME"/>
  18. <result property="isPkx" column="IS_PKX"/>
  19. <result property="isFoOver" column="IS_FO_OVER"/>
  20. <result property="lgtd" column="LGTD"/>
  21. <result property="lttd" column="LTTD"/>
  22. <result property="lgtdpc" column="LGTDPC"/>
  23. <result property="lttdpc" column="LTTDPC"/>
  24. <result property="villNum" column="VILL_NUM"/>
  25. <result property="proNum" column="PRO_NUM"/>
  26. <result property="waterNum" column="WATER_NUM"/>
  27. </resultMap>
  28. <sql id="table_columns">
  29. ID,VILL_NUM,PRO_NUM,WATER_NUM,
  30. LGTD ,
  31. LTTD ,
  32. LGTDPC ,
  33. LTTDPC ,
  34. OBJ_ID,
  35. REGS_NM,
  36. WATER_PRICE_IS_MADE,
  37. WATER_SAFE_OR_PAY,
  38. AD_CODE,
  39. PERS_ID,
  40. INTM,
  41. UPTM,
  42. NOTE,
  43. DATA_STAT,
  44. STATE,
  45. AD_FULL_NAME,
  46. IS_PKX,
  47. IS_FO_OVER
  48. </sql>
  49. <sql id="entity_properties">
  50. #{id},#{villNum},#{proNum},#{waterNum},
  51. #{lgtd},
  52. #{lttd},
  53. #{lgtdpc},
  54. #{lttdpc},
  55. #{objId},
  56. #{regsNm},
  57. #{waterPriceIsMade},
  58. #{waterSafeOrPay},
  59. #{adCode},
  60. #{persId},
  61. #{intm},
  62. #{uptm},
  63. #{note},
  64. #{dataStat},
  65. #{state},
  66. #{adFullName},
  67. #{isPkx},
  68. #{isFoOver}
  69. </sql>
  70. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  71. <sql id="page_where">
  72. <trim prefix="where" prefixOverrides="and | or ">
  73. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  74. <if test="waterNum != null and waterNum != ''">and WATER_NUM = #{waterNum}</if>
  75. <if test="proNum != null and proNum != ''">and PRO_NUM = #{proNum}</if>
  76. <if test="villNum != null and villNum != ''">and VILL_NUM = #{villNum}</if>
  77. <if test="regsNm != null and regsNm != ''">and REGS_NM = #{regsNm}</if>
  78. <if test="waterPriceIsMade != null and waterPriceIsMade != ''">and WATER_PRICE_IS_MADE =
  79. #{waterPriceIsMade}
  80. </if>
  81. <if test="waterSafeOrPay != null and waterSafeOrPay != ''">and WATER_SAFE_OR_PAY = #{waterSafeOrPay}</if>
  82. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  83. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  84. <if test="intm != null">and INTM = #{intm}</if>
  85. <if test="uptm != null">and UPTM = #{uptm}</if>
  86. <if test="note != null and note != ''">and NOTE = #{note}</if>
  87. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  88. <if test="state != null and state != ''">and STATE = #{state}</if>
  89. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
  90. <if test="isPkx != null and isPkx != ''">and IS_PKX = #{isPkx}</if>
  91. <if test="isFoOver != null and isFoOver != ''">and IS_FO_OVER = #{isFoOver}</if>
  92. </trim>
  93. </sql>
  94. <select id="get" resultMap="bisNewVillRgstrResultMap" parameterType="String">
  95. select
  96. <include refid="table_columns"/>
  97. from BIS_NEW_VILL_RGSTR where ID = #{id}
  98. </select>
  99. <select id="getBy" resultMap="bisNewVillRgstrResultMap">
  100. select
  101. <include refid="table_columns"/>
  102. from BIS_NEW_VILL_RGSTR
  103. <include refid="page_where"/>
  104. </select>
  105. <select id="findAll" resultMap="bisNewVillRgstrResultMap">
  106. select
  107. <include refid="table_columns"/>
  108. from BIS_NEW_VILL_RGSTR
  109. </select>
  110. <select id="findList" resultMap="bisNewVillRgstrResultMap">
  111. select
  112. <include refid="table_columns"/>
  113. from BIS_NEW_VILL_RGSTR
  114. <include refid="page_where"/>
  115. </select>
  116. <select id="selectCount" resultType="int">
  117. select count(ID) from BIS_NEW_VILL_RGSTR
  118. <include refid="page_where"/>
  119. </select>
  120. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  121. insert into BIS_NEW_VILL_RGSTR(
  122. <include refid="table_columns"/>
  123. )
  124. values (
  125. <include refid="entity_properties"/>
  126. )
  127. </insert>
  128. <delete id="delete" parameterType="java.lang.String">
  129. delete from BIS_NEW_VILL_RGSTR where ID = #{id}
  130. </delete>
  131. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  132. delete from BIS_NEW_VILL_RGSTR
  133. <include refid="page_where"/>
  134. </delete>
  135. <update id="deleteInFlag" parameterType="java.lang.String">
  136. update BIS_NEW_VILL_RGSTR set flag_valid = 0 where ID = #{id}
  137. </update>
  138. <update id="updateVillSum" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  139. update BIS_NEW_VILL_RGSTR set VILL_NUM = #{villNum} where ID = #{id}
  140. </update>
  141. <update id="updateProSum" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  142. update BIS_NEW_VILL_RGSTR set PRO_NUM = #{proNum} where ID = #{id}
  143. </update>
  144. <update id="updateWaterSum" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  145. update BIS_NEW_VILL_RGSTR set WATER_NUM = #{waterNum} where ID = #{id}
  146. </update>
  147. <update id="updateAllNum" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  148. update BIS_NEW_VILL_RGSTR set WATER_NUM = #{waterNum},PRO_NUM = #{proNum},VILL_NUM = #{villNum} where ID = #{id}
  149. </update>
  150. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisNewVillRgstr">
  151. update BIS_NEW_VILL_RGSTR
  152. <trim prefix="set" suffixOverrides=",">
  153. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  154. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  155. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  156. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  157. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  158. <if test="regsNm != null and regsNm != ''">REGS_NM = #{regsNm},</if>
  159. <if test="waterPriceIsMade != null and waterPriceIsMade != ''">WATER_PRICE_IS_MADE = #{waterPriceIsMade},
  160. </if>
  161. <if test="waterSafeOrPay != null and waterSafeOrPay != ''">WATER_SAFE_OR_PAY = #{waterSafeOrPay},</if>
  162. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  163. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  164. <if test="intm != null">INTM = #{intm},</if>
  165. <if test="uptm != null">UPTM = #{uptm},</if>
  166. <if test="note != null and note != ''">NOTE = #{note},</if>
  167. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  168. <if test="state != null and state != ''">STATE = #{state},</if>
  169. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  170. <if test="isPkx != null and isPkx != ''">IS_PKX = #{isPkx},</if>
  171. <if test="isFoOver != null and isFoOver != ''">IS_FO_OVER = #{isFoOver},</if>
  172. </trim>
  173. <where>ID = #{id}</where>
  174. </update>
  175. <select id="pageNotAddRegstr" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto"
  176. parameterType="cn.com.goldenwater.dcproj.param.CommonParam">
  177. select e.ad_code,e.ad_name,(case when e.is_poveryt is null then '0' else e.is_poveryt end) is_poveryt,e.lgtd,e.lttd,
  178. (case when o.obj_id is null then '0' else '1' end) status,o.obj_id,o.id from att_ad_x_base e
  179. left join bis_insp_all_obj o on e.ad_code=o.code
  180. where o.ptype=#{objType}
  181. <if test="objId !=null and objId !=''">
  182. and o.obj_id=#{objId}
  183. </if>
  184. <if test="name !=null and name !=''">
  185. and e.ad_name like '%${name}%'
  186. </if>
  187. <if test="adCode !=null and adCode !=''">
  188. and e.ad_code like '%${adCode}%'
  189. </if>
  190. <if test="isPoveryt !=null and isPoveryt !=''">
  191. and e.is_poveryt =#{isPoveryt}
  192. </if>
  193. <if test="orderBy !=null and orderBy !=''">
  194. order by ${orderBy}
  195. </if>
  196. </select>
  197. <select id="findNewVillPageByType" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  198. resultType="cn.com.goldenwater.dcproj.dto.BisNewVillRgstrDto">
  199. select * from (select A.*,CASE WHEN b.state IS NULL THEN '0' ELSE b.state END AS wtdstState,B.Id as
  200. regstr_id,B.Id as rgstr_id,B.INTM,(
  201. case WHEN B.is_pkx is null THEN '0' else B.is_pkx END ) as is_pkx,
  202. B.Water_Price_Is_Made,B.WATER_SAFE_OR_PAY,B.vill_num,B.pro_num,B.water_num
  203. FROM BIS_INSP_ALL_OBJ A
  204. LEFT JOIN BIS_NEW_VILL_RGSTR B
  205. ON A.OBJ_ID = B.OBJ_ID
  206. where A.ptype=#{pType} AND
  207. A.Id in (
  208. select distinct ww.id from (
  209. SELECT P.id FROM BIS_INSP_ALL P
  210. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  211. WHERE A.PERSID = #{presId} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  212. union all
  213. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  214. WHERE A.PERSID =#{presId} and length(id)=12 )
  215. ) ww
  216. )
  217. ) a
  218. where 1=1
  219. <if test="adCode !=null and adCode !=''">
  220. and a.code like '${adCode}%'
  221. </if>
  222. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  223. AND INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND INTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY)
  224. </if>
  225. <if test="plnaId !=null and plnaId !=''">
  226. and a.id like '${plnaId}%'
  227. </if>
  228. <if test="groupId !=null and groupId !=''">
  229. and a.id like '${groupId}%'
  230. </if>
  231. <if test="state !=null and state !=''">
  232. and wtdstState in (${state})
  233. </if>
  234. <if test="rsName !=null and rsName !=''">
  235. and a.nm like '%${rsName}%'
  236. </if>
  237. order by wtdstState asc
  238. <if test="orderBy != null and orderBy != ''">
  239. ,${orderBy}
  240. </if>
  241. </select>
  242. <!-- 其他自定义SQL -->
  243. <select id="sumNewVillNumAdd" resultType="cn.com.goldenwater.dcproj.dto.SumNewVillNumDto" parameterType="String">
  244. select sum(vill_num) as vill_num,sum(pro_num) as pro_num,sum(water_num) as water_num from (
  245. SELECT COUNT(B.ad_code) vill_num,0 as pro_num,0 as water_num
  246. FROM bis_new_dcuser_rel_vill B
  247. where B.regstr_id =#{regstrId}
  248. UNION all
  249. SELECT 0 as vill_num,count(B.id) pro_num,0 as water_num
  250. FROM BIS_NEW_COUNTRY_FEE B
  251. where B.REGSTR_ID=#{regstrId}
  252. UNION all
  253. SELECT
  254. 0 as vill_num,0 as pro_num,COUNT(B.id) as water_num
  255. FROM BIS_NEW_WATERUSER_INFO B
  256. where B.REGSTR_ID=#{regstrId}
  257. ) w
  258. </select>
  259. <select id="sumNewVillNum" resultType="cn.com.goldenwater.dcproj.dto.SumNewVillNumDto" parameterType="String">
  260. select sum(vill_num) as vill_num,sum(pro_num) as pro_num,sum(water_num) as water_num
  261. from (
  262. SELECT COUNT(B.ad_code) vill_num,0 as pro_num,0 as water_num
  263. FROM att_ad_x_base B
  264. where B.ad_code like '${code}%' and substr(ad_code,10) !='000'
  265. ) w
  266. </select>
  267. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm"
  268. parameterType="cn.com.goldenwater.dcproj.param.PlbmParam">
  269. select w.* from (
  270. select j.id as oid,j.obj_id,m.pblm_id,m.obj_type,m.insp_pblm_name
  271. ,m.insp_pblm_desc,m.pblm_long,m.pblm_lat,s.check_point,s.PBLM_DESC,
  272. m.new_vill_name,j.nm,m.vill_type,m.has_vedio,m.quote,m.rec_pers,
  273. m.regid,j.code as ad_code,ba.ad_full_name,s.sn_num,p.pers_name,al.sttm,al.entm,
  274. m.insp_add_desc,m.coll_time,(select l.pnm from bis_insp_all l where l.id=substr(al.id,1,6)) as pnm,
  275. (select org_nm from bis_insp_org where org_id=substr(al.id,4,3)) as org_nm
  276. from (select *
  277. from BIS_INSP_ALL_OBJ j
  278. <choose>
  279. <when test="objType != null and objType != '' ">
  280. where j.pType= #{objType}
  281. </when>
  282. <otherwise>
  283. where j.pType='25'
  284. </otherwise>
  285. </choose>
  286. ) j
  287. join BIS_INSP_PBLM m on m.obj_id=j.obj_id
  288. join obj_insp_pblms s on m.pblms_type_id=s.guid
  289. left join bis_insp_all al on al.id=j.id
  290. left join bis_insp_all_rlation_pers p on m.rec_pers=p.guid
  291. left join att_ad_x_base ba on j.code=ba.ad_code
  292. ) w
  293. where 1=1
  294. <if test="tabType =='2'.toString()">
  295. and w.entm &lt; DATE_ADD(str_to_date(#{nowTime},'%Y-%m-%d'), INTERVAL 1 DAY)
  296. </if>
  297. <if test="tabType =='1'.toString()">
  298. and w.entm &gt;=str_to_date(#{nowTime},'%Y-%m-%d') and w.sttm &lt; DATE_ADD(str_to_date(#{nowTime},'%Y-%m-%d'), INTERVAL 1 DAY)
  299. </if>
  300. <if test="timeType =='1'.toString()">
  301. and w.COLL_TIME >=str_to_date(#{nowTime},'%Y-%m-%d')
  302. </if>
  303. <if test="timeType =='2'.toString()">
  304. and w.COLL_TIME &gt;=str_to_date(#{nowMonth},'%Y-%m')
  305. </if>
  306. <if test="timeType =='3'.toString()">
  307. and w.COLL_TIME &gt;= str_to_date(#{nowYear},'%Y')
  308. </if>
  309. AND W.OID in (
  310. select distinct ww.id from (
  311. SELECT P.id FROM BIS_INSP_ALL P
  312. WHERE FIND_IN_SET(P.ID, getSubNodes_bis_insp_all((SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  313. WHERE A.PERSID = #{presId} AND length(A.id) in (3,6,9)
  314. <include refid="choseSql"/>
  315. group by A.PERSID ),0,0)) &gt; 0
  316. CONNECT BY P.PID = PRIOR P.ID
  317. union all
  318. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  319. WHERE A.PERSID =#{presId} and length(id)=12
  320. <include refid="choseSql"/>
  321. )
  322. ) ww
  323. )
  324. <if test="villType !=null and villType !=''">
  325. and w.vill_type in (${villType})
  326. </if>
  327. <if test="objIdes != null and objIdes != ''">and OBJ_ID in (${objIdes})</if>
  328. <if test="inspPblmName !=null and inspPblmName !=''">
  329. and w.insp_pblm_name like '${inspPblmName}%'
  330. </if>
  331. <if test="startTime != null and startTime != ''">and COLL_TIME &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d')</if>
  332. <if test="findTime != null and findTime != ''">and COLL_TIME=STR_TO_DATE(#{findTime},'%Y-%m-%d')</if>
  333. <if test="endTime != null and endTime != ''">and COLL_TIME &lt; DATE_ADD(STR_TO_DATE(#{endTime},'%Y-%m-%d'), INTERVAL 1 DAY)</if>
  334. <if test="oides != null and oides != ''">and oid in (${oides})</if>
  335. <if test="regid !=null and regid !=''">
  336. and w.regid=#{regid}
  337. </if>
  338. <if test="recPers !=null and recPers !=''">
  339. and w.rec_Pers=#{recPers}
  340. </if>
  341. <if test="objId !=null and objId !=''">
  342. and w.obj_id=#{objId}
  343. </if>
  344. <if test="groupId !=null and groupId !=''">
  345. and oid like '${groupId}%'
  346. </if>
  347. <if test="adFullName !=null and adFullName !=''">
  348. and w.AD_FULL_NAMe like '%${adFullName}%'
  349. </if>
  350. <if test="persName !=null and persName !=''">
  351. and w.PERS_NAME like '%${persName}%'
  352. </if>
  353. <if test="nm !=null and nm !=''">
  354. and w.NM like '%${nm}%'
  355. </if>
  356. <if test="orgNm !=null and orgNm !=''">
  357. and w.ORG_NM like '%${orgNm}%'
  358. </if>
  359. <if test="hasVedio !=null and hasVedio !=''">
  360. and w.HAS_VEDIO=#{hasVedio}
  361. </if>
  362. <if test="adCode !=null and adCode !=''">
  363. and w.AD_CODE like '${adCode}%'
  364. </if>
  365. order by w.AD_CODE
  366. <if test="orderBy !=null and orderBy !=''">
  367. ,${orderBy}
  368. </if>
  369. </select>
  370. <select id="findPageByType" resultType="cn.com.goldenwater.dcproj.dto.BisNewVillRgstrDto"
  371. parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
  372. select * from (select A.id,A.Nm,A.Code,A.Obj_Id,A.Lgtd,A.Lttd,A.Lgtdpc,A.Lttdpc,
  373. A.pType,CASE WHEN b.state IS NULL THEN '0' ELSE b.state
  374. END AS wtdstState,B.Id as regstr_Id,ad.ad_full_name,al.pnm as groupName,b.intm as c_time
  375. ,date_format(b.intm,'%Y-%m-%d %H:%i:%s') as intm,
  376. date_format(b.uptm,'%Y-%m-%d %H:%i:%s') as uptm,B.Water_Price_Is_Made,B.WATER_SAFE_OR_PAY
  377. FROM BIS_INSP_ALL_OBJ A
  378. LEFT JOIN BIS_New_VILL_RGSTR B
  379. ON A.OBJ_ID = B.OBJ_ID
  380. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code
  381. left join BIS_INSP_ALL al
  382. on A.id=al.id
  383. where
  384. A.Id in (
  385. select distinct w.id from (
  386. SELECT P.id FROM BIS_INSP_ALL P
  387. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  388. WHERE A.PERSID = #{presId} and length(A.id) in (3,6,9)
  389. <include refid="choseSql"/>
  390. group by A.PERSID ),0,0) ) &gt; 0
  391. union all
  392. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  393. WHERE A.PERSID =#{presId} and length(id)=12
  394. <include refid="choseSql"/>
  395. )
  396. )w
  397. )
  398. <if test="tabType =='2'.toString()">
  399. and al.entm &lt; DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d'), INTERVAL 1 DAY)
  400. </if>
  401. <if test="tabType =='1'.toString()">
  402. and al.entm &gt;= STR_TO_DATE(#{nowTime},'%Y-%m-%d')
  403. </if>
  404. ) a
  405. where ptype=#{pType}
  406. <if test="plnaId !=null and plnaId !=''">
  407. and a.id like '${plnaId}%'
  408. </if>
  409. <if test="state !=null and state !=''">
  410. and a.wtdstState in (${state})
  411. </if>
  412. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  413. AND a.c_time &gt;= str_to_date(#{sttm},'%Y-%m-%d') AND a.c_time &lt; date_add(str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY )
  414. </if>
  415. <if test="groupId !=null and groupId !=''">
  416. and a.id like '${groupId}%'
  417. </if>
  418. <if test="name !=null and name !=''">
  419. and a.nm like '%${name}%'
  420. </if>
  421. <if test="nm !=null and nm !=''">
  422. and a.nm like '%${nm}%'
  423. </if>
  424. <if test="adName !=null and adName !=''">
  425. and a.ad_full_name like '%${adName}%'
  426. </if>
  427. <if test="rsName !=null and rsName !=''">
  428. and a.nm like '%${rsName}%'
  429. </if>
  430. order by a.wtdstState asc
  431. <if test="orderBy != null and orderBy != ''">
  432. <!--,${orderBy}-->
  433. ,CONVERT( a.nm USING gbk ) COLLATE gbk_chinese_ci ASC
  434. </if>
  435. </select>
  436. <sql id="choseSql">
  437. <choose>
  438. <when test="province !=null and province !=''">
  439. AND ad_code=#{province}
  440. </when>
  441. <otherwise>
  442. AND ad_code is null
  443. </otherwise>
  444. </choose>
  445. </sql>
  446. <select id="getVill20ByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam"
  447. resultType="cn.com.goldenwater.dcproj.dto.BisNewWateruserInfoDto">
  448. SELECT A.*,ad.LGTD lgtdPc,ad.LTTD lttdPc,ad.AD_LONG centerXGd,ad.AD_LAT centerYGd,B.Obj_Id
  449. FROM BIS_NEW_WATERUSER_INFO A LEFT JOIN BIS_NEW_VILL_RGSTR B ON A.REGSTR_ID = B.ID
  450. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  451. LEFT JOIN ATT_AD_X_BASE ad on A.AD_CODE = ad.AD_CODE
  452. WHERE C.PTYPE = #{objType}
  453. AND
  454. <if test="adName != null and adName != ''">and A.VILLAGE_NM LIKE '%${adName}%'</if>
  455. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  456. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and ad.LGTD BETWEEN
  457. #{minLgtd} AND #{maxLgtd}
  458. </if>
  459. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and ad.LTTD BETWEEN
  460. #{minLttd} AND #{maxLttd}
  461. </if>
  462. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  463. ad.AD_LONG BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  464. </if>
  465. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  466. ad.AD_LAT BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  467. </if>
  468. </select>
  469. </mapper>