TacInspYearBatchObjDao.xml 17 KB

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