TacInspYearBatchObjDao.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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.TacInspYearBatchObjDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj" id="tacInspYearBatchObjResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="yearBatchId" column="YEAR_BATCH_ID"/>
  7. <result property="year" column="YEAR"/>
  8. <result property="batch" column="BATCH"/>
  9. <result property="groupId" column="GROUP_ID"/>
  10. <result property="groupNm" column="GROUP_NM"/>
  11. <result property="ojbId" column="OJB_ID"/>
  12. <result property="ojbNm" column="OJB_NM"/>
  13. <result property="persId" column="PERS_ID"/>
  14. <result property="inTm" column="IN_TM"/>
  15. <result property="upTm" column="UP_TM"/>
  16. <result property="dataStat" column="DATA_STAT"/>
  17. <result property="province" column="PROVINCE"/>
  18. <result property="sn" column="SN"/>
  19. </resultMap>
  20. <sql id="table_columns">
  21. ID,
  22. YEAR_BATCH_ID,
  23. YEAR,
  24. BATCH,
  25. GROUP_ID,
  26. GROUP_NM,
  27. OJB_ID,
  28. OJB_NM,
  29. PERS_ID,
  30. IN_TM,
  31. UP_TM,
  32. DATA_STAT,PROVINCE,SN
  33. </sql>
  34. <sql id="entity_properties">
  35. #{id},
  36. #{yearBatchId},
  37. #{year},
  38. #{batch},
  39. #{groupId},
  40. #{groupNm},
  41. #{ojbId},
  42. #{ojbNm},
  43. #{persId},
  44. #{inTm},
  45. #{upTm},
  46. #{dataStat},#{province},#{sn}
  47. </sql>
  48. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  49. <sql id="page_where">
  50. <trim prefix="where" prefixOverrides="and | or ">
  51. <if test="yearBatchId != null and yearBatchId != ''">and YEAR_BATCH_ID = #{yearBatchId}</if>
  52. <if test="year != null and year != ''">and YEAR = #{year}</if>
  53. <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
  54. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  55. <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
  56. <if test="ojbId != null and ojbId != ''">and OJB_ID = #{ojbId}</if>
  57. <if test="ojbNm != null and ojbNm != ''">and OJB_NM = #{ojbNm}</if>
  58. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  59. <if test="inTm != null">and IN_TM = #{inTm}</if>
  60. <if test="upTm != null">and UP_TM = #{upTm}</if>
  61. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  62. <include refid="choseSql"/>
  63. </trim>
  64. </sql>
  65. <sql id="choseSql">
  66. <choose>
  67. <when test="province !=null and province !=''">
  68. AND t.PROVINCE=#{province}
  69. </when>
  70. <otherwise>
  71. AND t.PROVINCE is null
  72. </otherwise>
  73. </choose>
  74. </sql>
  75. <select id="get" resultMap="tacInspYearBatchObjResultMap" parameterType="String" >
  76. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ where ID = #{id}
  77. </select>
  78. <select id="getBy" resultMap="tacInspYearBatchObjResultMap">
  79. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
  80. </select>
  81. <select id="findAll" resultMap="tacInspYearBatchObjResultMap">
  82. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ
  83. </select>
  84. <select id="findList" resultMap="tacInspYearBatchObjResultMap">
  85. select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
  86. order by t.sn asc
  87. </select>
  88. <select id="getObjAndType" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  89. select t.ID
  90. , t.YEAR_BATCH_ID
  91. , t.YEAR
  92. , t.BATCH
  93. , t.GROUP_ID
  94. , t.GROUP_NM
  95. , t.OJB_ID
  96. , t.PERS_ID
  97. , t.IN_TM
  98. , t.UP_TM
  99. , t.DATA_STAT
  100. , t.PROVINCE
  101. , t.SN,r.TYPE as TYPE , tt.name as ojb_nm from TAC_INSP_YEAR_BATCH_OBJ t left join tac_pawp_rgstr r on t.id = r.obj_id
  102. left join TAC_ATT_PAWP_BASE tt on tt.id = t.ojb_id
  103. where 1=1
  104. <if test="yearBatchId != null and yearBatchId != ''">and t.YEAR_BATCH_ID = #{yearBatchId}</if>
  105. <if test="year != null and year != ''">and t.YEAR = #{year}</if>
  106. <if test="batch != null and batch != ''">and t.BATCH = #{batch}</if>
  107. <if test="groupId != null and groupId != ''">and t.GROUP_ID = #{groupId}</if>
  108. <if test="groupNm != null and groupNm != ''">and t.GROUP_NM = #{groupNm}</if>
  109. <if test="ojbId != null and ojbId != ''">and t.OJB_ID = #{ojbId}</if>
  110. <if test="ojbNm != null and ojbNm != ''">and t.OJB_NM = #{ojbNm}</if>
  111. <if test="persId != null and persId != ''">and t.PERS_ID = #{persId}</if>
  112. <if test="inTm != null">and t.IN_TM = #{inTm}</if>
  113. <if test="upTm != null">and t.UP_TM = #{upTm}</if>
  114. <if test="dataStat != null and dataStat != ''">and t.DATA_STAT = #{dataStat}</if>
  115. order by t.sn asc
  116. </select>
  117. <select id="selectCount" resultType="int" >
  118. select count(ID) from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
  119. </select>
  120. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  121. insert into TAC_INSP_YEAR_BATCH_OBJ( <include refid="table_columns" /> )
  122. values ( <include refid="entity_properties" /> )
  123. </insert>
  124. <delete id="delete" parameterType="java.lang.String">
  125. delete from TAC_INSP_YEAR_BATCH_OBJ where ID = #{id}
  126. </delete>
  127. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  128. delete from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
  129. </delete>
  130. <update id="deleteInFlag" parameterType="java.lang.String">
  131. update TAC_INSP_YEAR_BATCH_OBJ set flag_valid = 0 where ID = #{id}
  132. </update>
  133. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  134. update TAC_INSP_YEAR_BATCH_OBJ
  135. <trim prefix="set" suffixOverrides=",">
  136. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  137. <if test="year != null and year != ''">YEAR = #{year},</if>
  138. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  139. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  140. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  141. <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
  142. <if test="ojbNm != null and ojbNm != ''">OJB_NM = #{ojbNm},</if>
  143. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  144. <if test="inTm != null">IN_TM = #{inTm},</if>
  145. <if test="upTm != null">UP_TM = #{upTm},</if>
  146. <if test="sn != null">SN = #{sn},</if>
  147. <if test="province != null">PROVINCE = #{province},</if>
  148. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  149. </trim>
  150. <where>ID = #{id}</where>
  151. </update>
  152. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  153. update TAC_INSP_YEAR_BATCH_OBJ
  154. <trim prefix="set" suffixOverrides=",">
  155. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  156. <if test="year != null and year != ''">YEAR = #{year},</if>
  157. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  158. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  159. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  160. <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
  161. <if test="ojbNm != null and ojbNm != ''">OJB_NM = #{ojbNm},</if>
  162. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  163. <if test="inTm != null">IN_TM = #{inTm},</if>
  164. <if test="province != null">PROVINCE = #{province},</if>
  165. <if test="sn != null">SN = #{sn},</if>
  166. <if test="upTm != null">UP_TM = #{upTm},</if>
  167. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  168. </trim>
  169. <include refid="page_where" />
  170. </update>
  171. <!-- 其他自定义SQL -->
  172. <select id="getObjList" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
  173. select t.year_batch_id,t.year,t.batch,t.GROUP_NM,rg.ID
  174. , rg.OBJ_ID
  175. , rg.ADM_ORG
  176. , rg.AD_CODE
  177. , rg.LOCATION
  178. , rg.TYPE
  179. , rg.ITME_DESC
  180. , rg.ITME_EVAL
  181. , rg.KATALOG
  182. , rg.SPCLT_YM
  183. , rg.REV_OPIN
  184. , rg.REV_TM
  185. , rg.CENTER_X
  186. , rg.CENTER_Y
  187. , rg.GD_X
  188. , rg.GD_Y
  189. , rg.NOTE
  190. , rg.STATE
  191. , rg.DATA_STAT
  192. , rg.PDBST_STAT
  193. , rg.BSTOCM_PLPRS_STAT
  194. , rg.BSTOCM_TSOPBFP_STAT
  195. , rg.BSTOCM_CPSS_STAT
  196. , rg.BSTOCM_CMS_STAT
  197. , rg.RAIOBIS_STAT
  198. , rg.BIOFUAM_STAT
  199. , rg.BITOPQ_QMS_STAT
  200. , rg.BITOPQ_PEQAA_STAT
  201. , rg.BIOES_PE_STAT
  202. , rg.BIOES_RWUNIT_STAT
  203. , rg.PERS_ID
  204. , rg.GROUP_ID
  205. , rg.INTM
  206. , rg.UPTM
  207. , rg.ORG_ID
  208. , rg.AD_NAME
  209. , rg.IS_POVERTY
  210. , rg.PROVINCE
  211. , rg.TASK_ID
  212. , rg.BACKUP,'8' as ptype,t.OJB_NM ,tt.name from TAC_INSP_YEAR_BATCH_OBJ t left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID
  213. left join TAC_ATT_PAWP_BASE tt on tt.id = t.ojb_id
  214. where 1=1
  215. <if test="persId != null and persId != ''">
  216. and t.group_id in (
  217. select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (
  218. select b.id from TAC_WORKER_B b where b.login_id = #{persId}
  219. <trim>
  220. <choose>
  221. <when test="province !=null and province !=''">
  222. AND b.PROVINCE=#{province}
  223. </when>
  224. <otherwise>
  225. AND b.PROVINCE is null
  226. </otherwise>
  227. </choose>
  228. </trim>
  229. )
  230. )
  231. </if>
  232. <include refid="choseSql"/>
  233. <if test="yearBatchId != null and yearBatchId != ''">
  234. and t.year_batch_id = #{yearBatchId}
  235. </if>
  236. <if test="year != null and year != ''">
  237. and t.year = #{year}
  238. </if>
  239. <if test="batch != null and batch != ''">
  240. and t.batch = #{batch}
  241. </if>
  242. <if test="adCode != null and adCode != ''">
  243. and rg.ad_code like '%' || substr(#{adCode},0,4) || '%'
  244. </if>
  245. <if test="groupId != null and groupId != ''">
  246. and t.group_id = #{groupId}
  247. </if>
  248. <if test="ojbNm != null and ojbNm != ''">
  249. and t.ojb_nm like '%${ojbNm}%'
  250. </if>
  251. <if test="state != null and state != ''">
  252. and rg.state = #{state}
  253. </if>
  254. <if test="type != null and type != ''">
  255. and rg.type = #{type}
  256. </if>
  257. order by rg.INTM desc
  258. </select>
  259. <!-- 山东稽察 汇总成果 增加在批次下选择项目 -->
  260. <select id="objslistbybatch" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
  261. select t.YEAR_BATCH_ID, t.GROUP_ID, t.OJB_ID as OBJ_ID, t.OJB_NM from TAC_INSP_YEAR_BATCH_OBJ t
  262. left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID
  263. where 1=1
  264. <include refid="choseSql"/>
  265. <if test="yearBatchId != null and yearBatchId != ''">
  266. and t.year_batch_id = #{yearBatchId}
  267. </if>
  268. <if test="year != null and year != ''">
  269. and t.year = #{year}
  270. </if>
  271. <if test="batch != null and batch != ''">
  272. and t.batch = #{batch}
  273. </if>
  274. <if test="adCode != null and adCode != ''">
  275. and rg.ad_code like '%' || substr(#{adCode},0,4) || '%'
  276. </if>
  277. <if test="groupId != null and groupId != ''">
  278. and t.group_id = #{groupId}
  279. </if>
  280. <if test="ojbNm != null and ojbNm != ''">
  281. and t.ojb_nm like '%${ojbNm}%'
  282. </if>
  283. <if test="state != null and state != ''">
  284. and rg.state = #{state}
  285. </if>
  286. <if test="type != null and type != ''">
  287. and rg.type = #{type}
  288. </if>
  289. order by t.SN asc
  290. </select>
  291. <select id="getBaseNotInGroupByGroupId" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  292. select distinct * from (
  293. select t.* from TAC_ATT_PAWP_BASE t where t.id not in (
  294. select OJB_ID from TAC_INSP_YEAR_BATCH_OBJ t where group_id = #{groupId}
  295. <include refid="choseSql"/>
  296. )
  297. <include refid="choseSql"/>
  298. <if test="ojbNm != null and ojbNm != ''">and t.name LIKE '%${ojbNm}%'</if>
  299. <if test="engSta != null and engSta != ''">and t.type LIKE '%${engSta}%'</if>
  300. ) where 1=1
  301. <if test="adCode != null and adCode != ''">and ${adCode}</if>
  302. ORDER BY
  303. <if test="orderBy != null and orderBy != ''">${orderBy},</if>
  304. ad_code,name
  305. </select>
  306. <select id="getObjTreeList" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
  307. select r.ad_code,t.*,r.id as rgstrId,(case when r.state is null then '0' else r.state end) state,r.TASK_ID taskId from TAC_INSP_YEAR_BATCH_OBJ t
  308. join TAC_INSP_YEAR_BATCH h on t.year_batch_id=h.id join tac_pawp_rgstr r on t.id = r.obj_id
  309. where 1=1
  310. <if test="persId != null and persId != ''">
  311. and t.group_id in (
  312. select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{persId}
  313. <if test=' "1" == isEval'>
  314. <!-- 外聘稽查专家测评 isExternal 是否外聘 0否 1是 -->
  315. AND (b.IS_EXTERNAL != '1' or b.IS_EXTERNAL is null)
  316. </if>
  317. )
  318. <!-- 外聘稽查专家测评 稽查专家、助理、组长、特派员 -->
  319. <if test=' "1" == isEval'>
  320. AND PERS_ID in (select WORKERID from tac_worker_type where TYPE='1' and instr(',11,12,13,14,15,16,19,20,21,' , ','||VALUE||',') &gt; 0 )
  321. </if>
  322. <!--专家组长测评 稽查专家、助理、特派员 -->
  323. <if test=' "2" == isEval'>
  324. AND PERS_ID in (select WORKERID from tac_worker_type where TYPE='1' and instr(',11,12,13,14,15,16,19,21,' , ','||VALUE||',') &gt; 0 )
  325. </if>
  326. )
  327. </if>
  328. <include refid="choseSql"/>
  329. <if test="year != null and year != ''">
  330. and t.year = #{year}
  331. </if>
  332. <if test="batch != null and batch != ''">
  333. and t.batch = #{batch}
  334. </if>
  335. order by t.year desc,t.batch desc,to_number(t.group_nm)
  336. </select>
  337. <select id="getObjListByPersId" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
  338. select * from (
  339. select rg.id,
  340. rg.obj_id,
  341. rg.name,
  342. rg.ADM_ORG,
  343. rg.LOCATION,
  344. rg.type,
  345. rg.ITME_DESC,
  346. rg.ITME_EVAL,
  347. rg.ad_code,
  348. (case when rg.CENTER_X is null then ba.CENTER_X else rg.CENTER_X end) CENTER_X,
  349. (case when rg.CENTER_Y is null then ba.CENTER_Y else rg.CENTER_Y end) CENTER_Y,
  350. (case when rg.GD_X is null then ba.GD_X else rg.GD_X end) GD_X,
  351. (case when rg.GD_Y is null then ba.GD_Y else rg.GD_Y end) GD_Y,
  352. rg.state,t.ojb_id as baseId,t.year,t.batch,t.group_id,t.YEAR_BATCH_ID
  353. from TAC_INSP_YEAR_BATCH_OBJ t left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID left join TAC_ATT_PAWP_BASE ba on t.OJB_ID = ba.id
  354. where 1=1
  355. <if test="persId != null and persId != ''">
  356. and t.group_id in (
  357. select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{persId})
  358. )
  359. </if>
  360. <include refid="choseSql"/>
  361. <if test="year != null">
  362. and t.year = #{year}
  363. </if>
  364. <if test="batch != null">
  365. and t.batch = #{batch}
  366. </if>
  367. <if test="adCode != null and adCode != ''">
  368. and rg.ad_Code like '${adCode}%'
  369. </if>
  370. <if test="type != null and type != ''">
  371. and rg.type = #{type}
  372. </if>
  373. <if test="name != null and name != ''">
  374. and rg.name like '%${name}%'
  375. </if>
  376. <if test="ojbId != null and ojbId != ''">
  377. and t.ojb_id = #{ojbId}
  378. </if>
  379. ) t where 1=1
  380. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and t.CENTER_X BETWEEN
  381. #{minLgtd} AND #{maxLgtd}
  382. </if>
  383. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and t.CENTER_Y BETWEEN
  384. #{minLttd} AND #{maxLttd}
  385. </if>
  386. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  387. t.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  388. </if>
  389. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  390. t.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  391. </if>
  392. </select>
  393. <select id="getObjListByGroupIdList" resultType="String">
  394. select ID from TAC_INSP_YEAR_BATCH_OBJ
  395. where group_id in
  396. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  397. #{item}
  398. </foreach>
  399. </select>
  400. </mapper>