AttAdXBaseDao.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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.AttAdXBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttAdXBase" id="attAdXBaseResultMap">
  5. <result property="isPoveryt" column="IS_POVERYT"/>
  6. <result property="src" column="SRC"/>
  7. <result property="remark" column="REMARK"/>
  8. <result property="guid" column="GUID"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="lowLeftLong" column="LOW_LEFT_LONG"/>
  12. <result property="lowLeftLat" column="LOW_LEFT_LAT"/>
  13. <result property="upRightLong" column="UP_RIGHT_LONG"/>
  14. <result property="upRightLat" column="UP_RIGHT_LAT"/>
  15. <result property="upAdName" column="UP_AD_NAME"/>
  16. <result property="adGrad" column="AD_GRAD"/>
  17. <result property="adAbbrName" column="AD_ABBR_NAME"/>
  18. <result property="adStat" column="AD_STAT"/>
  19. <result property="adArea" column="AD_AREA"/>
  20. <result property="adFullName" column="AD_FULL_NAME"/>
  21. <result property="note" column="NOTE"/>
  22. <result property="effDate" column="EFF_DATE"/>
  23. <result property="exprDate" column="EXPR_DATE"/>
  24. <result property="adStatLong" column="AD_STAT_LONG"/>
  25. <result property="adStatLat" column="AD_STAT_LAT"/>
  26. <result property="domainCode" column="DOMAIN_CODE"/>
  27. <result property="adSign" column="AD_SIGN"/>
  28. <result property="modifierPeople" column="MODIFIER_PEOPLE"/>
  29. <result property="updDate" column="UPD_DATE"/>
  30. <result property="isReport" column="IS_REPORT"/>
  31. <result property="adFcode" column="AD_FCODE"/>
  32. <result property="lgtd" column="LGTD"/>
  33. <result property="lttd" column="LTTD"/>
  34. <result property="lgtdpc" column="LGTDPC"/>
  35. <result property="lttdpc" column="LTTDPC"/>
  36. </resultMap>
  37. <sql id="table_columns">
  38. IS_POVERYT ,
  39. SRC ,
  40. REMARK ,
  41. LGTD ,
  42. LTTD ,
  43. LGTDPC ,
  44. LTTDPC ,
  45. GUID ,
  46. AD_CODE ,
  47. AD_NAME ,
  48. LOW_LEFT_LONG ,
  49. LOW_LEFT_LAT ,
  50. UP_RIGHT_LONG ,
  51. UP_RIGHT_LAT ,
  52. UP_AD_NAME ,
  53. AD_GRAD ,
  54. AD_ABBR_NAME ,
  55. AD_STAT ,
  56. AD_AREA ,
  57. AD_FULL_NAME ,
  58. NOTE ,
  59. DATE_FORMAT(EFF_DATE,'%Y-%m-%d %T') EFF_DATE,
  60. DATE_FORMAT(EXPR_DATE,'%Y-%m-%d %T') EXPR_DATE,
  61. AD_STAT_LONG ,
  62. AD_STAT_LAT ,
  63. DOMAIN_CODE ,
  64. AD_SIGN ,
  65. MODIFIER_PEOPLE ,
  66. DATE_FORMAT(UPD_DATE,'%Y-%m-%d %T') UPD_DATE,
  67. IS_REPORT ,
  68. AD_FCODE
  69. </sql>
  70. <sql id="table_columns2">
  71. IS_POVERYT ,
  72. SRC ,
  73. REMARK ,
  74. LGTD ,
  75. LTTD ,
  76. LGTDPC ,
  77. LTTDPC ,
  78. GUID ,
  79. AD_CODE ,
  80. AD_NAME ,
  81. LOW_LEFT_LONG ,
  82. LOW_LEFT_LAT ,
  83. UP_RIGHT_LONG ,
  84. UP_RIGHT_LAT ,
  85. UP_AD_NAME ,
  86. AD_GRAD ,
  87. AD_ABBR_NAME ,
  88. AD_STAT ,
  89. AD_AREA ,
  90. AD_FULL_NAME ,
  91. NOTE ,
  92. EFF_DATE ,
  93. EXPR_DATE ,
  94. AD_STAT_LONG ,
  95. AD_STAT_LAT ,
  96. DOMAIN_CODE ,
  97. AD_SIGN ,
  98. MODIFIER_PEOPLE ,
  99. UPD_DATE ,
  100. IS_REPORT ,
  101. AD_FCODE
  102. </sql>
  103. <sql id="entity_properties">
  104. #{isPoveryt},
  105. #{src},
  106. #{remark},
  107. #{lgtd},
  108. #{lttd},
  109. #{lgtdpc},
  110. #{lttdpc},
  111. #{guid},
  112. #{adCode},
  113. #{adName},
  114. #{lowLeftLong},
  115. #{lowLeftLat},
  116. #{upRightLong},
  117. #{upRightLat},
  118. #{upAdName},
  119. #{adGrad},
  120. #{adAbbrName},
  121. #{adStat},
  122. #{adArea},
  123. #{adFullName},
  124. #{note},
  125. STR_TO_DATE(#{effDate},'%Y-%m-%d %T') ,
  126. STR_TO_DATE(#{exprDate},'%Y-%m-%d %T') ,
  127. #{adStatLong},
  128. #{adStatLat},
  129. #{domainCode},
  130. #{adSign},
  131. #{modifierPeople},
  132. STR_TO_DATE(#{updDate},'%Y-%m-%d %T') ,
  133. #{isReport},
  134. #{adFcode}
  135. </sql>
  136. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  137. <sql id="page_where">
  138. <trim prefix="where" prefixOverrides="and | or ">
  139. <if test="isPoveryt == '1'.toString() or isPoveryt == '0'.toString()">and IS_POVERYT = #{isPoveryt}</if>
  140. <if test="isPoveryt == '2'.toString()">and IS_POVERYT IS NULL</if>
  141. <if test="src != null and src != ''">and SRC = #{src}</if>
  142. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  143. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  144. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  145. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
  146. <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
  147. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  148. <if test="adCode != null and adCode != ''">and AD_CODE like concat(#{adCode},'%')</if>
  149. <if test="adName != null and adName != ''">and AD_NAME LIKE concat('%',#{adName},'%')</if>
  150. <if test="lowLeftLong != null and lowLeftLong != ''">and LOW_LEFT_LONG = #{lowLeftLong}</if>
  151. <if test="lowLeftLat != null and lowLeftLat != ''">and LOW_LEFT_LAT = #{lowLeftLat}</if>
  152. <if test="upRightLong != null and upRightLong != ''">and UP_RIGHT_LONG = #{upRightLong}</if>
  153. <if test="upRightLat != null and upRightLat != ''">and UP_RIGHT_LAT = #{upRightLat}</if>
  154. <if test="upAdName != null and upAdName != ''">and UP_AD_NAME LIKE concat('%',#{upAdName},'%')</if>
  155. <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
  156. <if test="adAbbrName != null and adAbbrName != ''">and AD_ABBR_NAME LIKE concat('%',#{adAbbrName},'%')</if>
  157. <if test="adStat != null and adStat != ''">and AD_STAT = #{adStat}</if>
  158. <if test="adArea != null and adArea != ''">and AD_AREA = #{adArea}</if>
  159. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME LIKE concat('%',#{adFullName},'%')</if>
  160. <if test="note != null and note != ''">and NOTE = #{note}</if>
  161. <if test="effDate != null and effDate != ''">and DATE_FORMAT(EFF_DATE,'%Y-%m-%d %T') = DATE_FORMAT(STR_TO_DATE(#{effDate},'%Y-%m-%d %T') ,'%Y-%m-%d %T')</if>
  162. <if test="exprDate != null and exprDate != ''">and DATE_FORMAT(EXPR_DATE,'%Y-%m-%d %T') = DATE_FORMAT( STR_TO_DATE(#{exprDate},'%Y-%m-%d %T'), '%Y-%m-%d %T')
  163. </if>
  164. <if test="adStatLong != null and adStatLong != ''">and AD_STAT_LONG = #{adStatLong}</if>
  165. <if test="adStatLat != null and adStatLat != ''">and AD_STAT_LAT = #{adStatLat}</if>
  166. <if test="domainCode != null and domainCode != ''">and DOMAIN_CODE = #{domainCode}</if>
  167. <if test="adSign != null and adSign != ''">and AD_SIGN = #{adSign}</if>
  168. <if test="modifierPeople != null and modifierPeople != ''">and MODIFIER_PEOPLE = #{modifierPeople}</if>
  169. <if test="updDate != null and updDate != ''">and DATE_FORMAT(UPD_DATE,'%Y-%m-%d %T') = DATE_FORMAT(STR_TO_DATE(#{updDate},'%Y-%m-%d %T'), '%Y-%m-%d %T')</if>
  170. <if test="isReport != null and isReport != ''">and IS_REPORT = #{isReport}</if>
  171. <if test="adFcode != null and adFcode != ''">and AD_FCODE = #{adFcode}</if>
  172. <if test="province != null and province != ''">and AD_CODE like '${province}%'</if>
  173. AND EXPR_DATE IS NULL
  174. </trim>
  175. </sql>
  176. <select id="get" resultMap="attAdXBaseResultMap" parameterType="String">
  177. select
  178. <include refid="table_columns"/>
  179. from ATT_AD_X_BASE where AD_CODE = #{id}
  180. </select>
  181. <select id="getBy" resultMap="attAdXBaseResultMap">
  182. select
  183. <include refid="table_columns"/>
  184. from ATT_AD_X_BASE
  185. <include refid="page_where"/>
  186. </select>
  187. <select id="findAll" resultMap="attAdXBaseResultMap">
  188. select
  189. <include refid="table_columns"/>
  190. from ATT_AD_X_BASE
  191. </select>
  192. <select id="findList" resultMap="attAdXBaseResultMap">
  193. select
  194. <include refid="table_columns"/>
  195. from ATT_AD_X_BASE
  196. <include refid="page_where"/>
  197. order by UPD_DATE DESC,AD_CODE
  198. </select>
  199. <select id="selectCount" resultType="int">
  200. select count(GUID) from ATT_AD_X_BASE
  201. <include refid="page_where"/>
  202. </select>
  203. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  204. insert into ATT_AD_X_BASE(
  205. <include refid="table_columns2"/>
  206. )
  207. values (
  208. <include refid="entity_properties"/>
  209. )
  210. </insert>
  211. <delete id="delete" parameterType="java.lang.String">
  212. delete from ATT_AD_X_BASE where GUID = #{id}
  213. </delete>
  214. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  215. delete from ATT_AD_X_BASE
  216. <include refid="page_where"/>
  217. </delete>
  218. <update id="deleteInFlag" parameterType="java.lang.String">
  219. update ATT_AD_X_BASE set flag_valid = 0 where GUID = #{id}
  220. </update>
  221. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  222. update ATT_AD_X_BASE
  223. <trim prefix="set" suffixOverrides=",">
  224. <if test="isPoveryt != null and isPoveryt != ''">IS_POVERYT = #{isPoveryt},</if>
  225. <if test="src != null and src != ''">SRC = #{src},</if>
  226. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  227. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  228. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  229. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  230. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  231. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  232. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  233. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  234. <if test="lowLeftLong != null and lowLeftLong != ''">LOW_LEFT_LONG = #{lowLeftLong},</if>
  235. <if test="lowLeftLat != null and lowLeftLat != ''">LOW_LEFT_LAT = #{lowLeftLat},</if>
  236. <if test="upRightLong != null and upRightLong != ''">UP_RIGHT_LONG = #{upRightLong},</if>
  237. <if test="upRightLat != null and upRightLat != ''">UP_RIGHT_LAT = #{upRightLat},</if>
  238. <if test="upAdName != null and upAdName != ''">UP_AD_NAME = #{upAdName},</if>
  239. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  240. <if test="adAbbrName != null and adAbbrName != ''">AD_ABBR_NAME = #{adAbbrName},</if>
  241. <if test="adStat != null and adStat != ''">AD_STAT = #{adStat},</if>
  242. <if test="adArea != null and adArea != ''">AD_AREA = #{adArea},</if>
  243. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  244. <if test="note != null and note != ''">NOTE = #{note},</if>
  245. <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %T'),</if>
  246. <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %T'),
  247. </if>
  248. <if test="adStatLong != null and adStatLong != ''">AD_STAT_LONG = #{adStatLong},</if>
  249. <if test="adStatLat != null and adStatLat != ''">AD_STAT_LAT = #{adStatLat},</if>
  250. <if test="domainCode != null and domainCode != ''">DOMAIN_CODE = #{domainCode},</if>
  251. <if test="adSign != null and adSign != ''">AD_SIGN = #{adSign},</if>
  252. <if test="modifierPeople != null and modifierPeople != ''">MODIFIER_PEOPLE = #{modifierPeople},</if>
  253. <if test="updDate != null and updDate != ''">UPD_DATE = STR_TO_DATE(#{updDate},'%Y-%m-%d %T'),</if>
  254. <if test="isReport != null and isReport != ''">IS_REPORT = #{isReport},</if>
  255. <if test="adFcode != null and adFcode != ''">AD_FCODE = #{adFcode},</if>
  256. </trim>
  257. <where>GUID = #{guid}</where>
  258. </update>
  259. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  260. update ATT_AD_X_BASE
  261. <trim prefix="set" suffixOverrides=",">
  262. <if test="isPoveryt != null and isPoveryt != ''">IS_POVERYT = #{isPoveryt},</if>
  263. <if test="src != null and src != ''">SRC = #{src},</if>
  264. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  265. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  266. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  267. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  268. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  269. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  270. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  271. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  272. <if test="lowLeftLong != null and lowLeftLong != ''">LOW_LEFT_LONG = #{lowLeftLong},</if>
  273. <if test="lowLeftLat != null and lowLeftLat != ''">LOW_LEFT_LAT = #{lowLeftLat},</if>
  274. <if test="upRightLong != null and upRightLong != ''">UP_RIGHT_LONG = #{upRightLong},</if>
  275. <if test="upRightLat != null and upRightLat != ''">UP_RIGHT_LAT = #{upRightLat},</if>
  276. <if test="upAdName != null and upAdName != ''">UP_AD_NAME = #{upAdName},</if>
  277. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  278. <if test="adAbbrName != null and adAbbrName != ''">AD_ABBR_NAME = #{adAbbrName},</if>
  279. <if test="adStat != null and adStat != ''">AD_STAT = #{adStat},</if>
  280. <if test="adArea != null and adArea != ''">AD_AREA = #{adArea},</if>
  281. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  282. <if test="note != null and note != ''">NOTE = #{note},</if>
  283. <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %T'),</if>
  284. <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %T'), </if>
  285. <if test="adStatLong != null and adStatLong != ''">AD_STAT_LONG = #{adStatLong},</if>
  286. <if test="adStatLat != null and adStatLat != ''">AD_STAT_LAT = #{adStatLat},</if>
  287. <if test="domainCode != null and domainCode != ''">DOMAIN_CODE = #{domainCode},</if>
  288. <if test="adSign != null and adSign != ''">AD_SIGN = #{adSign},</if>
  289. <if test="modifierPeople != null and modifierPeople != ''">MODIFIER_PEOPLE = #{modifierPeople},</if>
  290. <if test="updDate != null and updDate != ''">UPD_DATE = STR_TO_DATE(#{updDate},'%Y-%m-%d %T'),</if>
  291. <if test="isReport != null and isReport != ''">IS_REPORT = #{isReport},</if>
  292. <if test="adFcode != null and adFcode != ''">AD_FCODE = #{adFcode},</if>
  293. </trim>
  294. <include refid="page_where"/>
  295. </update>
  296. <!-- 使用like用法:columnName like '%'||#{columnName}||'%' -->
  297. <sql id="page_where_extend">
  298. <trim prefix="where" prefixOverrides="and | or ">
  299. <if test="isPoveryt != null and isPoveryt != ''">
  300. <choose>
  301. <when test="isPoveryt == 1">
  302. and IS_POVERYT = '1'
  303. </when>
  304. <otherwise>
  305. and IS_POVERYT is null or is_poveryt != '1'
  306. </otherwise>
  307. </choose>
  308. </if>
  309. <if test="src != null and src != ''">and SRC like CONCAT('%', #{src}, '%')</if>
  310. <if test="remark != null and remark != ''">and REMARK like CONCAT('%', #{remark}, '%')</if>
  311. <if test="lgtd != null and lgtd != ''">and LGTD like CONCAT('%', #{lgtd}, '%')</if>
  312. <if test="lttd != null and lttd != ''">and LTTD like CONCAT('%', #{lttd}, '%')</if>
  313. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC like CONCAT('%', #{lgtdpc}, '%')</if>
  314. <if test="lttdpc != null and lttdpc != ''">and LTTDPC like CONCAT('%', #{lttdpc}, '%')</if>
  315. <if test="guid != null and guid != ''">and GUID like CONCAT('%', #{guid}, '%')</if>
  316. <if test="adCode != null and adCode != ''">and AD_CODE like CONCAT(#{adCode}, '%')</if>
  317. <if test="adName != null and adName != ''">
  318. and (AD_NAME LIKE CONCAT('%', #{adName}, '%') OR AD_CODE LIKE CONCAT(#{adName}, '%') )
  319. </if>
  320. <if test="lowLeftLong != null and lowLeftLong != ''">and LOW_LEFT_LONG like CONCAT('%', #{lowLeftLong},'%')
  321. </if>
  322. <if test="lowLeftLat != null and lowLeftLat != ''">and LOW_LEFT_LAT like CONCAT('%', #{lowLeftLat}, '%')
  323. </if>
  324. <if test="upRightLong != null and upRightLong != ''">and UP_RIGHT_LONG like CONCAT('%', #{upRightLong},'%')
  325. </if>
  326. <if test="upRightLat != null and upRightLat != ''">and UP_RIGHT_LAT like CONCAT('%', #{upRightLat}, '%')
  327. </if>
  328. <if test="upAdName != null and upAdName != ''">and UP_AD_NAME LIKE CONCAT('%', #{upAdName}, '%')</if>
  329. <if test="adGrad != null and adGrad != ''">
  330. and instr(#{adGrad},AD_GRAD) > 0
  331. </if>
  332. <if test="adAbbrName != null and adAbbrName != ''">and AD_ABBR_NAME LIKE CONCAT('%', #{adAbbrName}, '%')
  333. </if>
  334. <if test="adStat != null and adStat != ''">and AD_STAT like CONCAT('%', #{adStat}, '%')</if>
  335. <if test="adArea != null and adArea != ''">and AD_AREA like CONCAT('%', #{adArea}, '%')</if>
  336. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAMELIKE CONCAT('%', #{adFullName}, '%')</if>
  337. <if test="note != null and note != ''">and NOTE like CONCAT('%', #{note}, '%')</if>
  338. <if test="effDate != null and effDate != ''">and EFF_DATE = STR_TO_DATE(#{effDate} ,'%Y-%m-%d %T')
  339. </if>
  340. <if test="exprDate != null and exprDate != ''">and EXPR_DATE = STR_TO_DATE(#{exprDate} ,'%Y-%m-%d %T')
  341. </if>
  342. <if test="adStatLong != null and adStatLong != ''">and AD_STAT_LONG like CONCAT('%', #{adStatLong}, '%')
  343. </if>
  344. <if test="adStatLat != null and adStatLat != ''">and AD_STAT_LAT like CONCAT('%', #{adStatLat}, '%')</if>
  345. <if test="domainCode != null and domainCode != ''">and DOMAIN_CODE like CONCAT('%', #{domainCode}, '%')</if>
  346. <if test="adSign != null and adSign != ''">and AD_SIGN like CONCAT('%', #{adSign}, '%')</if>
  347. <if test="modifierPeople != null and modifierPeople != ''">and MODIFIER_PEOPLE like
  348. CONCAT('%', #{modifierPeople}, '%')
  349. </if>
  350. <if test="updDate != null and updDate != ''">and UPD_DATE = STR_TO_DATE(#{updDate}, '%Y-%m-%d %T')
  351. </if>
  352. <if test="isReport != null and isReport != ''">and IS_REPORT like CONCAT('%', #{isReport}, '%')</if>
  353. <if test="adFcode != null and adFcode != ''">and AD_FCODE like CONCAT('%', #{adFcode}, '%')</if>
  354. <if test="province != null and province != ''">and AD_CODE LIKE CONCAT(#{province}, '%')</if>
  355. AND EXPR_DATE IS NULL
  356. </trim>
  357. </sql>
  358. <!--获取行政区划列表-->
  359. <select id="getTableList" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  360. select * from ATT_AD_X_BASE
  361. <include refid="page_where_extend"></include>
  362. order by AD_GRAD asc,AD_CODE asc
  363. </select>
  364. <select id="getByCode" resultMap="attAdXBaseResultMap">
  365. select
  366. <include refid="table_columns"/>
  367. from ATT_AD_X_BASE where ad_code=#{adCode}
  368. </select>
  369. <select id="getMaxVillageCode" resultType="string" parameterType="string">
  370. SELECT MAX(AD_CODE) FROM ATT_AD_X_BASE WHERE AD_FCODE=#{adCode}
  371. </select>
  372. <select id="getDcVillNum" resultType="int" parameterType="string">
  373. SELECT SUM(NUM) FROM(
  374. select count(vill_id) NUM from BIS_INSP_SECSURVEY_VLG where eng_id=#{engId} and village_code=#{adCode}
  375. union all
  376. select count(RUNSTSE_ID) NUM from BIS_INSP_VLGDRINK_FAC_OPER where eng_id=#{engId} and ad_code=#{adCode}
  377. UNION ALL
  378. select count(PRSN_WATER_ID) NUM from BIS_INSP_WATERUSER_INFO where eng_id=#{engId} and village_code=#{adCode}
  379. )
  380. </select>
  381. <select id="queryTCListLast" parameterType="cn.com.goldenwater.dcproj.param.QueryTCListParam"
  382. resultType="cn.com.goldenwater.dcproj.model.TCListBean">
  383. SELECT TOWN_CODE,
  384. TOWN_NAME,
  385. VILL_CODE,
  386. VILL_NAME,
  387. VILL_ID,
  388. TOWN_ID,
  389. LGTD,
  390. LTTD,
  391. LGTDPC,
  392. LTTDPC,
  393. STATUS,
  394. CASE WHEN IS_POVERYT IS NULL THEN '2' ELSE IS_POVERYT END IS_POVERYT
  395. FROM (SELECT B.AD_CODE TOWN_CODE,
  396. B.AD_NAME TOWN_NAME,
  397. A.AD_CODE VILL_CODE,
  398. A.AD_NAME VILL_NAME,
  399. A.guid VILL_ID,
  400. B.GUID TOWN_ID,
  401. A.LGTD,
  402. A.LTTD,
  403. A.LGTDPC,
  404. A.LTTDPC,
  405. CASE WHEN NUM IS NULL THEN 0 ELSE 1 END STATUS,
  406. CASE WHEN D.IS_POVERTY IS NULL THEN A.IS_POVERYT ELSE D.IS_POVERTY END IS_POVERYT
  407. FROM att_ad_x_base A
  408. LEFT JOIN att_ad_x_base B
  409. ON A.AD_FCODE = B.AD_CODE
  410. LEFT JOIN ( SELECT SUM(s.NUM) NUM,s.AD_CODE FROM(
  411. select count(vill_id) NUM,village_code AD_CODE from BIS_INSP_SECSURVEY_VLG where eng_id=#{engId} GROUP BY
  412. village_code
  413. union all
  414. select count(RUNSTSE_ID) NUM,AD_CODE from BIS_INSP_VLGDRINK_FAC_OPER where eng_id=#{engId} GROUP BY AD_CODE
  415. UNION ALL
  416. select count(PRSN_WATER_ID) NUM,village_code AD_CODE from BIS_INSP_WATERUSER_INFO where eng_id=#{engId} GROUP BY
  417. village_code
  418. ) s GROUP BY s.AD_CODE) C ON A.AD_CODE=C.AD_CODE
  419. LEFT JOIN BIS_INSP_SECSURVEY_VLG D ON A.AD_CODE=D.VILLAGE_CODE AND D.ENG_ID=#{engId}
  420. WHERE B.AD_FCODE = #{adCode}
  421. <if test='name != null and name != "" '>
  422. AND( A.AD_NAME LIKE concat('%',#{name},'%') OR B.AD_NAME LIKE concat('%',#{name},'%') )
  423. </if>
  424. ORDER BY B.AD_CODE ,STATUS DESC,A.AD_CODE
  425. ) w WHERE 1=1
  426. <if test="isPoveryt == '0'.toString() or isPoveryt == '1'.toString()">and w.IS_POVERYT =#{isPoveryt}</if>
  427. <if test="isPoveryt == '2'.toString() ">and w.IS_POVERYT IS NULL</if>
  428. </select>
  429. <!--示例参数 001,002-->
  430. <select id="getTargetAdByNodeId" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  431. select DISTINCT t.*
  432. from ATT_AD_X_BASE t
  433. left join ATT_RS_BASE b
  434. on t.ad_code = b.adm_div
  435. left join BIS_INSP_ALL_OBJ o
  436. on b.rs_code = o.code
  437. WHERE 1 = 1
  438. and o.ptype = 1
  439. AND
  440. REGEXP_LIKE(
  441. o.Id,concat('^(',
  442. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid})>0 then
  443. (SELECT group_concat(id separator '|') as
  444. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} GROUP BY PERSID)
  445. else (select 'non' from dual) end)
  446. ,')'))
  447. <if test="nodes != null and nodes != ''">
  448. AND
  449. <foreach collection="nodes" index="index" item="item" separator="or">
  450. o.id like CONCAT(#{item},'%')
  451. </foreach>
  452. </if>
  453. ORDER BY t.AD_CODE ASC
  454. </select>
  455. <select id="getAllNodeByPid" resultType="cn.com.goldenwater.dcproj.model.AttAdXBaseNode">
  456. SELECT AD_CODE AS ID,AD_NAME AS NM,AD_FCODE AS PID, AD_GRAD AS "LEVEL" FROM ATT_AD_X_BASE
  457. where AD_CODE like concat(replace(replace(replace(#{pid},'0000000000',''),'00000000',''),'000000',''), '%')
  458. <if test="lev != null and lev != ''">
  459. AND CAST(ad_grad AS SIGNED)&lt;=#{lev}
  460. </if>
  461. order by AD_GRAD asc , AD_CODE asc
  462. </select>
  463. <select id="getAllNodeByPids" resultType="cn.com.goldenwater.dcproj.model.AttAdXBaseNode">
  464. SELECT AD_CODE AS ID,AD_NAME AS NM,AD_FCODE AS PID, AD_GRAD AS "LEVEL" FROM ATT_AD_X_BASE where 1=1
  465. <if test='adCdS != null and adCdS != ""'>
  466. AND AD_CODE in
  467. <foreach collection="adCdS.split(',')" index="index" item="item" separator="," open="(" close=")">
  468. #{item}
  469. </foreach>
  470. </if>
  471. <if test='level != null and level != ""'>
  472. AND AD_GRAD = #{level}
  473. </if>
  474. </select>
  475. <select id="getAllNodeByIds" resultType="cn.com.goldenwater.dcproj.model.AttAdXBaseNode">
  476. SELECT AD_CODE AS ID,AD_NAME AS NM,AD_FCODE AS PID, AD_GRAD AS "LEVEL" FROM ATT_AD_X_BASE where AD_FCODE = #{id}
  477. </select>
  478. <select id="getByName" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase"
  479. parameterType="cn.com.goldenwater.dcproj.param.AttAdXBaseParam">
  480. select * from Att_ad_x_base t where t.ad_name = #{adName}
  481. <if test="adCode != null and adCode != ''">
  482. and t.AD_CODE LIKE '${adCode}%'
  483. </if>
  484. </select>
  485. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam"
  486. resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  487. SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ad_code =
  488. B.CODE
  489. <if test="objType=='14'.toString()">
  490. LEFT JOIN BIS_INSP_WINT_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  491. </if>
  492. <if test="objType=='15'.toString()">
  493. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  494. </if>
  495. WHERE B.PTYPE = #{objType} AND
  496. REGEXP_LIKE(
  497. B.Id,concat('^(',
  498. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid})>0 then
  499. (SELECT group_concat(id separator '|') as
  500. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} GROUP BY PERSID)
  501. else (select 'non' from dual) end)
  502. ,')'))
  503. <choose>
  504. <when test="province !=null and province !=''">
  505. and B.AD_CODE =#{province}
  506. </when>
  507. <otherwise>
  508. and B.AD_CODE is null
  509. </otherwise>
  510. </choose>
  511. <if test="adName != null and adName != ''">and A.SWHS_NAME LIKE '%${adName}%'</if>
  512. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  513. </select>
  514. <select id="getObjListNotInspGroupId" parameterType="String"
  515. resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  516. select t.*
  517. from ATT_AD_X_BASE t
  518. where t.guid not in (
  519. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  520. <choose>
  521. <when test="province !=null and province !=''">
  522. and B.AD_CODE =#{province}
  523. </when>
  524. <otherwise>
  525. and B.AD_CODE is null
  526. </otherwise>
  527. </choose>
  528. )
  529. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  530. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  531. </select>
  532. <select id="findXZCZhenList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  533. SELECT E.AD_CODE,E.AD_NAME FROM ATT_AD_X_BASE E
  534. WHERE E.AD_CODE LIKE '${adCode}___000%'
  535. and substr(e.ad_code,7)!='000000'
  536. </select>
  537. <select id="findXZCCunList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  538. SELECT
  539. E.AD_CODE,E.AD_NAME,(CASE WHEN E.IS_POVERYT IS NULL THEN '0' ELSE E.IS_POVERYT END) IS_POVERYT
  540. FROM ATT_AD_X_BASE E
  541. WHERE
  542. E.AD_CODE LIKE '${adCode}%'
  543. and substr(e.ad_code,10)!='000'
  544. and e.ad_code not in (
  545. <choose>
  546. <when test="type=='25'.toString()">
  547. select ad_code from BIS_NEW_DCUSER_REL_VILL l where l.regstr_id=#{rgstrId}
  548. </when>
  549. <when test="type=='71'.toString()">
  550. SELECT VILL_CODE FROM BIS_INSP_VILLQH_RGSTR_REL_VILL L WHERE L.REGSTR_ID = #{rgstrId} AND L.DATA_STAT = '0'
  551. </when>
  552. <when test="type=='97'.toString()">
  553. SELECT AD_CODE FROM BIS_INSP_VILL2021_VILL L WHERE L.RGSTR_ID = #{rgstrId} AND L.DATA_STAT = '0'
  554. </when>
  555. <otherwise>
  556. select ad_code from BIS_ZHEJIANG_DCUSER_REL_VILL l where l.rgstr_id=#{rgstrId}
  557. </otherwise>
  558. </choose>
  559. )
  560. order by e.ad_code asc
  561. </select>
  562. <select id="findCunList" resultType="cn.com.goldenwater.dcproj.model.BisZhejiangDcuserRelVill"
  563. parameterType="String">
  564. select * from
  565. <choose>
  566. <when test="type=='41'.toString()">
  567. BIS_ZHEJIANG_DCUSER_REL_VILL
  568. where ad_code like '${adCode}%'
  569. and rgstr_id=#{rgstrId}
  570. order by ad_code
  571. </when>
  572. <when test="type=='71'.toString()">
  573. BIS_INSP_VILLQH_RGSTR_REL_VILL
  574. where DATA_STAT = '0'
  575. AND ad_code like '${adCode}%'
  576. and REGSTR_ID =#{rgstrId}
  577. order by ad_code
  578. </when>
  579. <when test="type=='97'.toString()">
  580. (
  581. SELECT
  582. V.*, A.AD_NAME AS TOWN_NAME
  583. FROM BIS_INSP_VILL2021_VILL V
  584. LEFT JOIN ATT_AD_X_BASE A ON A.AD_CODE = concat(SUBSTR(V.AD_CODE, 1, 9) , '000')
  585. )
  586. where DATA_STAT = '0'
  587. AND ad_code like '${adCode}%'
  588. and RGSTR_ID =#{rgstrId}
  589. order by ad_code
  590. </when>
  591. <otherwise>
  592. BIS_NEW_DCUSER_REL_VILL
  593. where ad_code like '${adCode}%'
  594. and regstr_id=#{rgstrId}
  595. order by ad_code
  596. </otherwise>
  597. </choose>
  598. </select>
  599. <select id="getAdData" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  600. select guid,
  601. ad_code,
  602. ad_name,
  603. low_left_long,
  604. low_left_lat,
  605. up_right_long,
  606. up_right_lat,
  607. up_ad_name,
  608. ad_grad,
  609. ad_abbr_name,
  610. ad_stat,
  611. ad_area,
  612. ad_full_name,
  613. note,
  614. eff_date,
  615. expr_date,
  616. ad_stat_long,
  617. ad_stat_lat,
  618. domain_code,
  619. ad_sign,
  620. modifier_people,
  621. upd_date,
  622. is_report,
  623. ad_fcode,lgtd,lttd from att_ad_x_base WHERE AD_FCODE = #{adCode} ORDER BY AD_CODE
  624. </select>
  625. <select id="getAdDataByAdCode" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  626. select guid,
  627. ad_code,
  628. ad_name,
  629. low_left_long,
  630. low_left_lat,
  631. up_right_long,
  632. up_right_lat,
  633. up_ad_name,
  634. ad_grad,
  635. ad_abbr_name,
  636. ad_stat,
  637. ad_area,
  638. ad_full_name,
  639. note,
  640. eff_date,
  641. expr_date,
  642. ad_stat_long,
  643. ad_stat_lat,
  644. domain_code,
  645. ad_sign,
  646. modifier_people,
  647. upd_date,
  648. is_report,
  649. ad_fcode,lgtd,lttd from att_ad_x_base WHERE AD_CODE IN
  650. <foreach collection="adCodes.split(',')" item="item" index="index" open="(" separator="," close=")">
  651. #{item}
  652. </foreach>
  653. ORDER BY AD_CODE
  654. </select>
  655. <select id="findXZCZhenMfdpList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  656. select e.ad_code,e.ad_name from att_ad_x_base e where e.ad_code like '${adCode}___000%' and substr(e.ad_code,7)!='000000'
  657. and e.ad_code not in (
  658. select ad_code from BIS_INSP_MFDP_RGSTR_OBJ l where l.rgstr_id=#{regstrId} and l.INSP_OBJ_TYPE = '3'
  659. )
  660. </select>
  661. <select id="findXZCCunMfdpList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  662. select e.ad_code,e.ad_name,(case when e.is_poveryt is null then '0' else e.is_poveryt end) is_poveryt
  663. from att_ad_x_base e where
  664. e.ad_code like '${adCode}%' and substr(e.ad_code,10)!='000' and e.ad_code not in (
  665. select ad_code from BIS_INSP_MFDP_RGSTR_OBJ l where l.rgstr_id=#{regstrId} and l.INSP_OBJ_TYPE = '4'
  666. )
  667. order by e.ad_code asc
  668. </select>
  669. <select id="findXZCCunIrrList" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  670. select e.ad_code,e.ad_name,(case when e.is_poveryt is null then '0' else e.is_poveryt end) is_poveryt
  671. from att_ad_x_base e where
  672. e.ad_code like '${adCode}%' and substr(e.ad_code,10)!='000' and e.ad_code not in (
  673. select ad_code from BIS_INSP_IRR_TOWNS_DSU l where l.data_stat = '0' and l.rgstr_id=#{rgstrId}
  674. and l.ad_code is not null
  675. )
  676. order by e.ad_code asc
  677. </select>
  678. <select id="findXZCCunListByType" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.AttCountryDto">
  679. select e.ad_code,e.ad_name,(case when e.is_poveryt is null then '0' else e.is_poveryt end) is_poveryt
  680. from att_ad_x_base e where
  681. e.ad_code like '${adCode}%' and substr(e.ad_code,10)!='000' and e.ad_code not in (
  682. select ad_code from
  683. <if test='type == "37"'>
  684. BIS_RDWSP_RGSTR_REL_VILL
  685. </if>
  686. l where l.regstr_id=#{regstrId}
  687. )
  688. order by e.ad_code asc
  689. </select>
  690. <select id="getAdDataXj" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  691. select guid,
  692. ad_code,
  693. ad_name,
  694. low_left_long,
  695. low_left_lat,
  696. up_right_long,
  697. up_right_lat,
  698. up_ad_name,
  699. ad_grad,
  700. ad_abbr_name,
  701. ad_stat,
  702. ad_area,
  703. ad_full_name,
  704. note,
  705. eff_date,
  706. expr_date,
  707. ad_stat_long,
  708. ad_stat_lat,
  709. domain_code,
  710. ad_sign,
  711. modifier_people,
  712. upd_date,
  713. is_report,
  714. ad_fcode,lgtd,lttd from att_ad_x_base
  715. where ad_name not like '兵团%'
  716. <if test='adCode == "660000000000"'>
  717. and FIND_IN_SET(ad_code , getSubNodes_att_ad_x_base(#{adCode}, substr(#{adCode},1,2) ,1) ) &gt; 0
  718. </if>
  719. <if test='adCode != "660000000000"'>
  720. and FIND_IN_SET(ad_code , getSubNodes_att_ad_x_base(#{adCode}, substr(#{adCode},1,2) ,2) ) &gt; 0
  721. </if>
  722. </select>
  723. <select id="getAdChild" resultType="cn.com.goldenwater.dcproj.model.AttAdXBase">
  724. select * from att_ad_x_base where ad_code like concat(#{adCode},'%')
  725. </select>
  726. </mapper>