TacPawpRgstrDao.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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.TacPawpRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacPawpRgstr" id="tacPawpRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="name" column="NAME"/>
  8. <result property="admOrg" column="ADM_ORG"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="location" column="LOCATION"/>
  11. <result property="type" column="TYPE"/>
  12. <result property="itmeDesc" column="ITME_DESC"/>
  13. <result property="itmeEval" column="ITME_EVAL"/>
  14. <result property="katalog" column="KATALOG"/>
  15. <result property="spcltYm" column="SPCLT_YM"/>
  16. <result property="revOpin" column="REV_OPIN"/>
  17. <result property="revTm" column="REV_TM"/>
  18. <result property="centerX" column="CENTER_X"/>
  19. <result property="centerY" column="CENTER_Y"/>
  20. <result property="gdX" column="GD_X"/>
  21. <result property="gdY" column="GD_Y"/>
  22. <result property="note" column="NOTE"/>
  23. <result property="state" column="STATE"/>
  24. <result property="dataStat" column="DATA_STAT"/>
  25. <result property="pdbstStat" column="PDBST_STAT"/>
  26. <result property="bstocmPlprsStat" column="BSTOCM_PLPRS_STAT"/>
  27. <result property="bstocmTsopbfpStat" column="BSTOCM_TSOPBFP_STAT"/>
  28. <result property="bstocmCpssStat" column="BSTOCM_CPSS_STAT"/>
  29. <result property="bstocmCmsStat" column="BSTOCM_CMS_STAT"/>
  30. <result property="raiobisStat" column="RAIOBIS_STAT"/>
  31. <result property="biofuamStat" column="BIOFUAM_STAT"/>
  32. <result property="bitopqQmsStat" column="BITOPQ_QMS_STAT"/>
  33. <result property="bitopqPeqaaStat" column="BITOPQ_PEQAA_STAT"/>
  34. <result property="bioesPeStat" column="BIOES_PE_STAT"/>
  35. <result property="bioesRwunitStat" column="BIOES_RWUNIT_STAT"/>
  36. <result property="persId" column="PERS_ID"/>
  37. <result property="groupId" column="GROUP_ID"/>
  38. <result property="intm" column="INTM"/>
  39. <result property="uptm" column="UPTM"/>
  40. <result property="adName" column="AD_NAME"/>
  41. <result property="isPoverty" column="IS_POVERTY"/>
  42. <result property="province" column="PROVINCE"/>
  43. <result property="taskId" column="TASK_ID"/>
  44. </resultMap>
  45. <sql id="table_columns">
  46. ID,TASK_ID,
  47. OBJ_ID,
  48. NAME,
  49. ADM_ORG,
  50. AD_CODE,
  51. LOCATION,
  52. TYPE,
  53. ITME_DESC,
  54. ITME_EVAL,
  55. KATALOG,
  56. SPCLT_YM,
  57. REV_OPIN,
  58. REV_TM,
  59. CENTER_X,
  60. CENTER_Y,
  61. GD_X,
  62. GD_Y,
  63. NOTE,
  64. STATE,
  65. DATA_STAT,
  66. PDBST_STAT,
  67. BSTOCM_PLPRS_STAT,
  68. BSTOCM_TSOPBFP_STAT,
  69. BSTOCM_CPSS_STAT,
  70. BSTOCM_CMS_STAT,
  71. RAIOBIS_STAT,
  72. BIOFUAM_STAT,
  73. BITOPQ_QMS_STAT,
  74. BITOPQ_PEQAA_STAT,
  75. BIOES_PE_STAT,
  76. BIOES_RWUNIT_STAT,
  77. PERS_ID,
  78. GROUP_ID,
  79. INTM,
  80. UPTM,AD_NAME,IS_POVERTY,PROVINCE
  81. </sql>
  82. <sql id="entity_properties">
  83. #{id},#{taskId},
  84. #{objId},
  85. #{name},
  86. #{admOrg},
  87. #{adCode},
  88. #{location},
  89. #{type},
  90. #{itmeDesc},
  91. #{itmeEval},
  92. #{katalog},
  93. #{spcltYm},
  94. #{revOpin},
  95. #{revTm},
  96. #{centerX},
  97. #{centerY},
  98. #{gdX},
  99. #{gdY},
  100. #{note},
  101. #{state},
  102. #{dataStat},
  103. #{pdbstStat},
  104. #{bstocmPlprsStat},
  105. #{bstocmTsopbfpStat},
  106. #{bstocmCpssStat},
  107. #{bstocmCmsStat},
  108. #{raiobisStat},
  109. #{biofuamStat},
  110. #{bitopqQmsStat},
  111. #{bitopqPeqaaStat},
  112. #{bioesPeStat},
  113. #{bioesRwunitStat},
  114. #{persId},
  115. #{groupId},
  116. #{intm},
  117. #{uptm},#{adName},#{isPoverty},#{province}
  118. </sql>
  119. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  120. <sql id="page_where">
  121. <trim prefix="where" prefixOverrides="and | or ">
  122. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  123. <if test="name != null and name != ''">and NAME like '%${name}%'</if>
  124. <if test="admOrg != null and admOrg != ''">and ADM_ORG like '%${admOrg}%'</if>
  125. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  126. <if test="location != null and location != ''">and LOCATION like '%${location}%'</if>
  127. <if test="type != null and type != ''">and TYPE like '%${type}%' #{type}</if>
  128. <if test="itmeDesc != null and itmeDesc != ''">and ITME_DESC like '%${itmeDesc}%'</if>
  129. <if test="itmeEval != null and itmeEval != ''">and ITME_EVAL like '%${itmeEval}%'</if>
  130. <if test="katalog != null and katalog != ''">and KATALOG like '%${katalog}%'</if>
  131. <if test="spcltYm != null">and SPCLT_YM = #{spcltYm}</if>
  132. <if test="revOpin != null and revOpin != ''">and REV_OPIN like '%${revOpin}%'</if>
  133. <if test="revTm != null">and REV_TM = #{revTm}</if>
  134. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  135. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  136. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  137. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  138. <if test="note != null and note != ''">and NOTE like '%${note}%'</if>
  139. <if test="state != null and state != ''">and STATE = #{state}</if>
  140. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  141. <if test="pdbstStat != null and pdbstStat != ''">and PDBST_STAT = #{pdbstStat}</if>
  142. <if test="bstocmPlprsStat != null and bstocmPlprsStat != ''">and BSTOCM_PLPRS_STAT = #{bstocmPlprsStat}</if>
  143. <if test="bstocmTsopbfpStat != null and bstocmTsopbfpStat != ''">and BSTOCM_TSOPBFP_STAT =
  144. #{bstocmTsopbfpStat}
  145. </if>
  146. <if test="bstocmCpssStat != null and bstocmCpssStat != ''">and BSTOCM_CPSS_STAT = #{bstocmCpssStat}</if>
  147. <if test="bstocmCmsStat != null and bstocmCmsStat != ''">and BSTOCM_CMS_STAT = #{bstocmCmsStat}</if>
  148. <if test="raiobisStat != null and raiobisStat != ''">and RAIOBIS_STAT = #{raiobisStat}</if>
  149. <if test="biofuamStat != null and biofuamStat != ''">and BIOFUAM_STAT = #{biofuamStat}</if>
  150. <if test="bitopqQmsStat != null and bitopqQmsStat != ''">and BITOPQ_QMS_STAT = #{bitopqQmsStat}</if>
  151. <if test="bitopqPeqaaStat != null and bitopqPeqaaStat != ''">and BITOPQ_PEQAA_STAT = #{bitopqPeqaaStat}</if>
  152. <if test="bioesPeStat != null and bioesPeStat != ''">and BIOES_PE_STAT = #{bioesPeStat}</if>
  153. <if test="bioesRwunitStat != null and bioesRwunitStat != ''">and BIOES_RWUNIT_STAT = #{bioesRwunitStat}</if>
  154. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  155. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  156. <if test="intm != null">and INTM = #{intm}</if>
  157. <if test="uptm != null">and UPTM = #{uptm}</if>
  158. <if test="isPoverty != null">and IS_POVERTY = #{isPoverty}</if>
  159. <if test="adName != null">and AD_NAME = #{adName}</if>
  160. <include refid="choseSqlt"/>
  161. </trim>
  162. </sql>
  163. <sql id="choseSqlt">
  164. <choose>
  165. <when test="province !=null and province !=''">
  166. and province=#{province}
  167. </when>
  168. <otherwise>
  169. and province is null
  170. </otherwise>
  171. </choose>
  172. </sql>
  173. <sql id="choseSql">
  174. <choose>
  175. <when test="province !=null and province !=''">
  176. and t.province=#{province}
  177. </when>
  178. <otherwise>
  179. and t.province is null
  180. </otherwise>
  181. </choose>
  182. </sql>
  183. <select id="get" resultMap="tacPawpRgstrResultMap" parameterType="String">
  184. select
  185. <include refid="table_columns"/>
  186. from TAC_PAWP_RGSTR where ID = #{id}
  187. </select>
  188. <select id="getBy" resultMap="tacPawpRgstrResultMap">
  189. select
  190. <include refid="table_columns"/>
  191. from TAC_PAWP_RGSTR t
  192. <include refid="page_where"/>
  193. </select>
  194. <select id="findAll" resultMap="tacPawpRgstrResultMap">
  195. select
  196. <include refid="table_columns"/>
  197. from TAC_PAWP_RGSTR t where 1=1
  198. <include refid="choseSql"/>
  199. </select>
  200. <select id="findList" resultMap="tacPawpRgstrResultMap">
  201. select
  202. <include refid="table_columns"/>
  203. from TAC_PAWP_RGSTR t
  204. <include refid="page_where"/>
  205. </select>
  206. <select id="selectCount" resultType="int">
  207. select count(ID) from TAC_PAWP_RGSTR t
  208. <include refid="page_where"/>
  209. </select>
  210. <!--获取助理数据-->
  211. <select id="findZhuli" resultType="String">
  212. select n.persid from bis_insp_all_rlation n where n.id in(
  213. select o.id from tac_pawp_rgstr r,bis_insp_all_obj o where r.obj_id=o.obj_id and r.id=#{regstrId} ) and
  214. n.pertype=19
  215. </select>
  216. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  217. insert into TAC_PAWP_RGSTR(
  218. <include refid="table_columns"/>
  219. )
  220. values (
  221. <include refid="entity_properties"/>
  222. )
  223. </insert>
  224. <delete id="delete" parameterType="java.lang.String">
  225. delete from TAC_PAWP_RGSTR where ID = #{id}
  226. </delete>
  227. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  228. delete from TAC_PAWP_RGSTR
  229. <include refid="page_where"/>
  230. </delete>
  231. <update id="deleteInFlag" parameterType="java.lang.String">
  232. update TAC_PAWP_RGSTR set flag_valid = 0 where ID = #{id}
  233. </update>
  234. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  235. update TAC_PAWP_RGSTR
  236. <trim prefix="set" suffixOverrides=",">
  237. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  238. <if test="taskId != null and taskId != ''">TASK_ID = #{taskId},</if>
  239. <if test="name != null and name != ''">NAME = #{name},</if>
  240. <if test="admOrg != null">ADM_ORG = #{admOrg},</if>
  241. <if test="adCode != null">AD_CODE = #{adCode},</if>
  242. <if test="location != null">LOCATION = #{location},</if>
  243. <if test="isPoverty != null">IS_POVERTY = #{isPoverty},</if>
  244. <if test="adName != null">AD_NAME = #{adName},</if>
  245. <if test="type != null">TYPE = #{type},</if>
  246. <if test="itmeDesc != null">ITME_DESC = #{itmeDesc},</if>
  247. <if test="itmeEval != null">ITME_EVAL = #{itmeEval},</if>
  248. <if test="katalog != null">KATALOG = #{katalog},</if>
  249. <if test="spcltYm != null">SPCLT_YM = #{spcltYm},</if>
  250. <if test="revOpin != null">REV_OPIN = #{revOpin},</if>
  251. <if test="revTm != null">REV_TM = #{revTm},</if>
  252. <if test="centerX != null">CENTER_X = #{centerX},</if>
  253. <if test="centerY != null">CENTER_Y = #{centerY},</if>
  254. <if test="gdX != null">GD_X = #{gdX},</if>
  255. <if test="gdY != null">GD_Y = #{gdY},</if>
  256. <if test="note != null">NOTE = #{note},</if>
  257. <if test="state != null and state != ''">STATE = #{state},</if>
  258. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  259. <if test="pdbstStat != null and pdbstStat != ''">PDBST_STAT = #{pdbstStat},</if>
  260. <if test="bstocmPlprsStat != null and bstocmPlprsStat != ''">BSTOCM_PLPRS_STAT = #{bstocmPlprsStat},</if>
  261. <if test="bstocmTsopbfpStat != null and bstocmTsopbfpStat != ''">BSTOCM_TSOPBFP_STAT =
  262. #{bstocmTsopbfpStat},
  263. </if>
  264. <if test="bstocmCpssStat != null and bstocmCpssStat != ''">BSTOCM_CPSS_STAT = #{bstocmCpssStat},</if>
  265. <if test="bstocmCmsStat != null and bstocmCmsStat != ''">BSTOCM_CMS_STAT = #{bstocmCmsStat},</if>
  266. <if test="raiobisStat != null and raiobisStat != ''">RAIOBIS_STAT = #{raiobisStat},</if>
  267. <if test="biofuamStat != null and biofuamStat != ''">BIOFUAM_STAT = #{biofuamStat},</if>
  268. <if test="bitopqQmsStat != null and bitopqQmsStat != ''">BITOPQ_QMS_STAT = #{bitopqQmsStat},</if>
  269. <if test="bitopqPeqaaStat != null and bitopqPeqaaStat != ''">BITOPQ_PEQAA_STAT = #{bitopqPeqaaStat},</if>
  270. <if test="bioesPeStat != null and bioesPeStat != ''">BIOES_PE_STAT = #{bioesPeStat},</if>
  271. <if test="bioesRwunitStat != null and bioesRwunitStat != ''">BIOES_RWUNIT_STAT = #{bioesRwunitStat},</if>
  272. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  273. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  274. <if test="intm != null">INTM = #{intm},</if>
  275. <if test="uptm != null">UPTM = #{uptm},</if>
  276. <if test="province != null and province">PROVINCE = #{province},</if>
  277. </trim>
  278. <where>ID = #{id}</where>
  279. </update>
  280. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  281. update TAC_PAWP_RGSTR
  282. <trim prefix="set" suffixOverrides=",">
  283. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  284. <if test="taskId != null and taskId != ''">TASK_ID = #{taskId},</if>
  285. <if test="name != null and name != ''">NAME = #{name},</if>
  286. <if test="isPoverty != null">IS_POVERTY = #{isPoverty},</if>
  287. <if test="adName != null">AD_NAME = #{adName},</if>
  288. <if test="admOrg != null">ADM_ORG = #{admOrg},</if>
  289. <if test="adCode != null">AD_CODE = #{adCode},</if>
  290. <if test="location != null">LOCATION = #{location},</if>
  291. <if test="type != null">TYPE = #{type},</if>
  292. <if test="itmeDesc != null">ITME_DESC = #{itmeDesc},</if>
  293. <if test="itmeEval != null">ITME_EVAL = #{itmeEval},</if>
  294. <if test="katalog != null">KATALOG = #{katalog},</if>
  295. <if test="spcltYm != null">SPCLT_YM = #{spcltYm},</if>
  296. <if test="revOpin != null">REV_OPIN = #{revOpin},</if>
  297. <if test="revTm != null">REV_TM = #{revTm},</if>
  298. <if test="centerX != null">CENTER_X = #{centerX},</if>
  299. <if test="centerY != null">CENTER_Y = #{centerY},</if>
  300. <if test="gdX != null">GD_X = #{gdX},</if>
  301. <if test="gdY != null">GD_Y = #{gdY},</if>
  302. <if test="note != null">NOTE = #{note},</if>
  303. <if test="state != null and state != ''">STATE = #{state},</if>
  304. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  305. <if test="pdbstStat != null and pdbstStat != ''">PDBST_STAT = #{pdbstStat},</if>
  306. <if test="bstocmPlprsStat != null and bstocmPlprsStat != ''">BSTOCM_PLPRS_STAT = #{bstocmPlprsStat},</if>
  307. <if test="bstocmTsopbfpStat != null and bstocmTsopbfpStat != ''">BSTOCM_TSOPBFP_STAT =
  308. #{bstocmTsopbfpStat},
  309. </if>
  310. <if test="bstocmCpssStat != null and bstocmCpssStat != ''">BSTOCM_CPSS_STAT = #{bstocmCpssStat},</if>
  311. <if test="bstocmCmsStat != null and bstocmCmsStat != ''">BSTOCM_CMS_STAT = #{bstocmCmsStat},</if>
  312. <if test="raiobisStat != null and raiobisStat != ''">RAIOBIS_STAT = #{raiobisStat},</if>
  313. <if test="biofuamStat != null and biofuamStat != ''">BIOFUAM_STAT = #{biofuamStat},</if>
  314. <if test="bitopqQmsStat != null and bitopqQmsStat != ''">BITOPQ_QMS_STAT = #{bitopqQmsStat},</if>
  315. <if test="bitopqPeqaaStat != null and bitopqPeqaaStat != ''">BITOPQ_PEQAA_STAT = #{bitopqPeqaaStat},</if>
  316. <if test="bioesPeStat != null and bioesPeStat != ''">BIOES_PE_STAT = #{bioesPeStat},</if>
  317. <if test="bioesRwunitStat != null and bioesRwunitStat != ''">BIOES_RWUNIT_STAT = #{bioesRwunitStat},</if>
  318. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  319. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  320. <if test="intm != null">INTM = #{intm},</if>
  321. <if test="uptm != null">UPTM = #{uptm},</if>
  322. <if test="province != null and province">PROVINCE = #{province},</if>
  323. </trim>
  324. <include refid="page_where"/>
  325. </update>
  326. <!-- 其他自定义SQL -->
  327. <!--获取稽察项目督查任务列表-->
  328. <select id="findPawpPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  329. resultType="cn.com.goldenwater.dcproj.dto.TacPawpRgstrDto">
  330. SELECT *
  331. FROM (SELECT A.CODE,
  332. (CASE
  333. WHEN R.NAME IS NULL THEN
  334. A.NM
  335. ELSE
  336. R.NAME
  337. END) NM,
  338. A.ID,
  339. A.PTYPE,
  340. A.LGTD,
  341. A.LTTD,
  342. A.OBJ_INTM,
  343. A.OBJ_ID,
  344. A.IS_SET_OBJ,
  345. CASE
  346. WHEN R.STATE IS NULL THEN
  347. '0'
  348. ELSE
  349. R.STATE
  350. END AS WTDSTSTATE,
  351. (CASE
  352. WHEN R.LOCATION IS NULL THEN
  353. E.LOCATION
  354. ELSE
  355. R.LOCATION
  356. END) AS LOCATION,
  357. (CASE
  358. WHEN R.Adm_Org IS NULL THEN
  359. E.Adm_Org
  360. ELSE
  361. R.Adm_Org
  362. END) AS Adm_Org,
  363. R.AD_CODE,
  364. R.TYPE,
  365. R.NAME,
  366. R.CENTER_X,
  367. R.CENTER_Y,
  368. R.GD_X,
  369. R.GD_Y,
  370. R.PDBST_STAT,
  371. R.BSTOCM_PLPRS_STAT,
  372. R.BSTOCM_TSOPBFP_STAT,
  373. R.BSTOCM_CPSS_STAT,
  374. R.BSTOCM_CMS_STAT,
  375. R.RAIOBIS_STAT,
  376. R.BIOFUAM_STAT,
  377. R.BITOPQ_QMS_STAT,
  378. R.BITOPQ_PEQAA_STAT,
  379. R.BIOES_PE_STAT,
  380. R.BIOES_RWUNIT_STAT,
  381. R.ID AS RGSTRID,
  382. R.GROUP_ID,
  383. R.PROVINCE,
  384. R.INTM,
  385. R.AD_NAME,
  386. R.IS_POVERTY
  387. FROM BIS_INSP_ALL_OBJ A
  388. LEFT JOIN TAC_PAWP_RGSTR R
  389. ON A.OBJ_ID = R.OBJ_ID
  390. LEFT JOIN TAC_ATT_PAWP_BASE E
  391. ON A.CODE = E.ID
  392. WHERE A.PTYPE = '8' and
  393. REGEXP_LIKE(
  394. A.Id,'^('||
  395. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId})>0 then
  396. (SELECT LISTAGG(id, '|') as
  397. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} GROUP BY PERSID)
  398. else (select 'non' from dual) end)
  399. ||')') ) a where 1=1
  400. <include refid="choseSqlR"/>
  401. <if test="plnaId !=null and plnaId !=''">
  402. and a.id like '${plnaId}%'
  403. </if>
  404. <if test="rsName !=null and rsName !=''">
  405. and a.nm like '${rsName}%'
  406. </if>
  407. <if test="state !=null and state !=''">
  408. and wtdstState =#{state}
  409. </if>
  410. <if test="code !=null and code !=''">
  411. and code like '${code}%'
  412. </if>
  413. order by wtdstState asc
  414. <if test="orderBy != null and orderBy != ''">
  415. <!-- ,${orderBy}-->
  416. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  417. </if>
  418. </select>
  419. <sql id="choseSqlR">
  420. <choose>
  421. <when test="province !=null and province !=''">
  422. and a.province=#{province}
  423. </when>
  424. <otherwise>
  425. and a.province is null
  426. </otherwise>
  427. </choose>
  428. </sql>
  429. <!--根据批次Id 获取下面的所有督查项目 -->
  430. <select id="getRgstrListByBatch" resultType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  431. select B.* from TAC_INSP_YEAR_BATCH_OBJ A
  432. JOIN TAC_PAWP_RGSTR B ON A.ID=B.OBJ_ID
  433. WHERE B.STATE=#{state} and a.year=#{year} and A.BATCH=#{batch} and b.ad_code like '${orgId}%'
  434. </select>
  435. <select id="listByTimeAndAdCode" resultType="cn.com.goldenwater.dcproj.model.TacPawpRgstr">
  436. select
  437. ID, TASK_ID, OBJ_ID, NAME, ADM_ORG, AD_CODE,
  438. CENTER_X, CENTER_Y, GD_X, GD_Y,
  439. (CASE STATE
  440. WHEN '1' THEN '0'
  441. WHEN '2' THEN '1'
  442. WHEN '3' THEN '1'
  443. WHEN '4' THEN '1'
  444. WHEN '5' THEN '1'
  445. WHEN '6' THEN '1'
  446. WHEN '7' THEN '2'
  447. ELSE '0' END ) AS "STATE",
  448. INTM, UPTM,AD_NAME,IS_POVERTY,PROVINCE
  449. from
  450. TAC_PAWP_RGSTR
  451. <where>
  452. DATA_STAT = '0'
  453. <if test="stTm != null and stTm != '' ">
  454. and to_date(to_CHAR(INTM, 'yyyy-MM-dd'), 'yyyy-MM-dd') &gt;= to_date(#{stTm}, 'yyyy-MM-dd')
  455. </if>
  456. <if test="enTm != null and enTm != '' ">
  457. and to_date(to_CHAR(INTM, 'yyyy-MM-dd'), 'yyyy-MM-dd') &lt; to_date(#{enTm}, 'yyyy-MM-dd')
  458. </if>
  459. <if test="adCode != null and adCode != '' ">
  460. and AD_CODE like '${adCode}%'
  461. </if>
  462. </where>
  463. </select>
  464. <!-- 20-特派员、 19-助理、11-前期专家、12-建管专家、13-计划专家、14-财务专家、15-质量专家、16-安全专家 -->
  465. <select id="findExpertSubmitCount" resultType="java.lang.Integer">
  466. <if test=' "11" == persId '>
  467. select (case when to_number(PDBST_STAT) &gt;3 then 1 else 0 end )as num
  468. from TAC_PAWP_RGSTR
  469. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  470. </if>
  471. <if test=' "12" == persId '>
  472. select (case when to_number(BSTOCM_TSOPBFP_STAT) &gt;3 then 1 else 0 end )as num
  473. from TAC_PAWP_RGSTR
  474. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  475. </if>
  476. <if test=' "13" == persId '>
  477. select (case when to_number(RAIOBIS_STAT) &gt;3 then 1 else 0 end )as num
  478. from TAC_PAWP_RGSTR
  479. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  480. </if>
  481. <if test=' "14" == persId '>
  482. select (case when to_number(BSTOCM_CMS_STAT) &gt;3 then 1 else 0 end )as num
  483. from TAC_PAWP_RGSTR
  484. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  485. </if>
  486. <if test=' "15" == persId '>
  487. select (case when to_number(BITOPQ_PEQAA_STAT) &gt;3 then 1 else 0 end )as num
  488. from TAC_PAWP_RGSTR
  489. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  490. </if>
  491. <if test=' "16" == persId '>
  492. select (case when to_number(BIOES_RWUNIT_STAT) &gt;3 then 1 else 0 end )as num
  493. from TAC_PAWP_RGSTR
  494. where GROUP_ID = #{groupId} and OBJ_ID=#{objId}
  495. </if>
  496. <if test=' "19" == persId || "20" == persId '>
  497. select 1 as num from dual
  498. </if>
  499. </select>
  500. </mapper>