TacPblmInfoDao.xml 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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.TacPblmInfoDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacPblmInfo" id="tacPblmInfoResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objType" column="OBJ_TYPE"/>
  7. <result property="objId" column="OBJ_ID"/>
  8. <result property="pblmPasi" column="PBLM_PASI"/>
  9. <result property="ifCasePblm" column="IF_CASE_PBLM"/>
  10. <result property="subjectIds" column="SUBJECT_IDS"/>
  11. <result property="subjectNames" column="subject_Names"/>
  12. <result property="pblmDesc" column="PBLM_DESC"/>
  13. <result property="pblmReason" column="PBLM_REASON"/>
  14. <result property="pblmSggtn" column="PBLM_SGGTN"/>
  15. <result property="pblmSn" column="PBLM_SN"/>
  16. <result property="pblmstdId" column="PBLMSTD_ID"/>
  17. <result property="rectId" column="RECT_ID"/>
  18. <result property="rgstrId" column="RGSTR_ID"/>
  19. <result property="listType" column="LIST_TYPE"/>
  20. <result property="listId" column="LIST_ID"/>
  21. <result property="groupId" column="GROUP_ID"/>
  22. <result property="persId" column="PERS_ID"/>
  23. <result property="persNm" column="PERS_NM"/>
  24. <result property="intm" column="INTM"/>
  25. <result property="spclId" column="SPCL_ID"/>
  26. <result property="spclNm" column="SPCL_NM"/>
  27. <result property="pblmNm" column="PBLM_NM"/>
  28. <result property="hasVedio" column="HAS_VEDIO"/>
  29. <result property="spclRvwOptn" column="SPCL_RVW_OPTN"/>
  30. <result property="spclTm" column="SPCL_TM"/>
  31. <result property="uptm" column="UPTM"/>
  32. <result property="note" column="NOTE"/>
  33. <result property="sn" column="SN"/>
  34. <result property="pblmQlttvCd" column="PBLM_QLTTV_CD"/>
  35. <result property="pblmQlttvNm" column="PBLM_QLTTV_NM"/>
  36. <result property="isCpQa" column="IS_CP_QA"/>
  37. <result property="dataStat" column="DATA_STAT"/>
  38. <result property="province" column="PROVINCE"/>
  39. <result property="name" column="NAME"/>
  40. <result property="location" column="LOCATION"/>
  41. <result property="adName" column="AD_NAME"/>
  42. <result property="adCode" column="AD_CODE"/>
  43. <result property="pblmTypeDesc" column="PBLM_TYPE_DESC"/>
  44. <result property="reasonState" column="REASON_STATE"/>
  45. <result property="pblmReasonDetail" column="PBLM_REASON_DETAIL"/>
  46. <result property="pblmMeasure" column="PBLM_MEASURE"/>
  47. <result property="pblmstdSn" column="PBLMSTD_SN"/>
  48. <result property="isPblmStbOth" column="IS_PBLM_STB_OTH"/>
  49. <result property="pblmStbOthCate" column="PBLM_STB_OTH_CATE"/>
  50. <result property="pblmStbOthDesc" column="PBLM_STB_OTH_DESC"/>
  51. <result property="relativeLaw" column="RELATIVE_LAW"/>
  52. <result property="lawContent" column="LAW_CONTENT"/>
  53. </resultMap>
  54. <sql id="table_columns">
  55. ID,PBLM_TYPE_DESC,
  56. OBJ_TYPE,
  57. OBJ_ID,
  58. PBLM_PASI,
  59. IF_CASE_PBLM,
  60. SUBJECT_IDS,
  61. PBLM_DESC,
  62. PBLM_REASON,
  63. PBLM_SGGTN,
  64. PBLM_SN,
  65. PBLMSTD_ID,
  66. RECT_ID,
  67. RGSTR_ID,
  68. LIST_TYPE,
  69. LIST_ID,
  70. GROUP_ID,
  71. PERS_ID,
  72. PERS_NM,
  73. INTM,
  74. SPCL_ID,
  75. SPCL_NM,
  76. SPCL_RVW_OPTN,
  77. SPCL_TM,
  78. UPTM,PBLM_NM,HAS_VEDIO,subject_Names,NOTE,
  79. SN,PBLM_QLTTV_CD,PBLM_QLTTV_NM,IS_CP_QA,DATA_STAT,PROVINCE,REASON_STATE,
  80. PBLM_REASON_DETAIL
  81. ,PBLM_MEASURE
  82. ,IS_PBLM_STB_OTH
  83. ,PBLM_STB_OTH_CATE
  84. ,PBLM_STB_OTH_DESC
  85. ,RELATIVE_LAW
  86. ,LAW_CONTENT
  87. </sql>
  88. <sql id="entity_properties">
  89. #{id},#{pblmTypeDesc},
  90. #{objType},
  91. #{objId},
  92. #{pblmPasi},
  93. #{ifCasePblm},
  94. #{subjectIds},
  95. #{pblmDesc},
  96. #{pblmReason}, #{pblmSggtn}, #{pblmSn},
  97. #{pblmstdId}, #{rectId}, #{rgstrId},
  98. #{listType},
  99. #{listId},
  100. #{groupId},
  101. #{persId},
  102. #{persNm},
  103. #{intm},
  104. #{spclId},
  105. #{spclNm},
  106. #{spclRvwOptn},
  107. #{spclTm},
  108. #{uptm},#{pblmNm},#{hasVedio},#{subjectNames},#{note},
  109. #{sn},#{pblmQlttvCd},#{pblmQlttvNm},#{isCpQa},#{dataStat},#{province},
  110. #{reasonState},
  111. #{pblmReasonDetail},
  112. #{pblmMeasure},
  113. #{isPblmStbOth},
  114. #{pblmStbOthCate},
  115. #{pblmStbOthDesc},
  116. #{relativeLaw},
  117. #{lawContent}
  118. </sql>
  119. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  120. <sql id="page_where">
  121. <trim prefix="where" prefixOverrides="and | or ">
  122. <if test="isPblmStbOth != null and isPblmStbOth != ''">and IS_PBLM_STB_OTH = #{isPblmStbOth}</if>
  123. <if test="pblmStbOthCate != null and pblmStbOthCate != ''">and PBLM_STB_OTH_CATE = #{pblmStbOthCate}</if>
  124. <if test="pblmStbOthDesc != null and pblmStbOthDesc != ''">and PBLM_STB_OTH_DESC = #{pblmStbOthDesc}</if>
  125. <if test="relativeLaw != null and relativeLaw != ''">and RELATIVE_LAW like '%${relativeLaw}%'</if>
  126. <if test="lawContent != null and lawContent != ''">and LAW_CONTENT like '%${lawContent}%' </if>
  127. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">and PBLM_QLTTV_CD = #{pblmQlttvCd}</if>
  128. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">and PBLM_QLTTV_NM = #{pblmQlttvNm}</if>
  129. <if test="isCpQa != null and isCpQa != ''">and IS_CP_QA = #{isCpQa}</if>
  130. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  131. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">and pblm_Type_Desc = #{pblmTypeDesc}</if>
  132. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  133. <if test="pblmPasi != null and pblmPasi != ''">and PBLM_PASI = #{pblmPasi}</if>
  134. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  135. <if test="subjectIds != null and subjectIds != ''">and SUBJECT_IDS = #{subjectIds}</if>
  136. <if test="subjectNames != null and subjectNames != ''">and subject_Names like '%${subjectNames}%'</if>
  137. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC like '%${pblmDesc}%'</if>
  138. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  139. <if test="pblmNm != null and pblmNm != ''">and PBLM_NM like '%${pblmNm}%'</if>
  140. <if test="pblmReason != null and pblmReason != ''">and PBLM_REASON like '%${pblmReason}%'</if>
  141. <if test="pblmSggtn != null and pblmSggtn != ''">and PBLM_SGGTN like '%${pblmSggtn}%'</if>
  142. <if test="pblmSn != null and pblmSn != ''">and PBLM_SN = #{pblmSn}</if>
  143. <if test="pblmstdId != null and pblmstdId != ''">and PBLMSTD_ID = #{pblmstdId}</if>
  144. <if test="rectId != null and rectId != ''">and RECT_ID = #{rectId}</if>
  145. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  146. <if test="listType != null and listType != ''">and LIST_TYPE = #{listType}</if>
  147. <if test="listId != null and listId != ''">and LIST_ID = #{listId}</if>
  148. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  149. <if test="province != null and province != ''">and PROVINCE = #{province}</if>
  150. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  151. <if test="persNm != null and persNm != ''">and PERS_NM like '%${persNm}%'</if>
  152. <if test="intm != null">and INTM = #{intm}</if>
  153. <if test="spclId != null and spclId != ''">and SPCL_ID = #{spclId}</if>
  154. <if test="spclNm != null and spclNm != ''">and SPCL_NM like '%${spclNm}%'</if>
  155. <if test="spclRvwOptn != null and spclRvwOptn != ''">and SPCL_RVW_OPTN like '%${spclRvwOptn}%'</if>
  156. <if test="spclTm != null">and SPCL_TM = #{spclTm}</if>
  157. <if test="uptm != null">and UPTM = #{uptm}</if>
  158. <if test="note != null and note != ''">and NOTE = #{note}</if>
  159. <if test="sn != null and sn != ''">and SN = #{sn}</if>
  160. <if test="dataStat != null and dataStat != ''">and data_Stat = #{dataStat}</if>
  161. <if test="reasonState != null and reasonState != ''">and REASON_STATE = #{reasonState}</if>
  162. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">and PBLM_REASON_DETAIL = #{pblmReasonDetail}</if>
  163. <if test="pblmMeasure != null and pblmMeasure != ''">and PBLM_MEASURE = #{pblmMeasure}</if>
  164. </trim>
  165. </sql>
  166. <sql id="mysql">
  167. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  168. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  169. <if test="pblmPasi != null and pblmPasi != ''">and PBLM_PASI = #{pblmPasi}</if>
  170. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  171. <if test="subjectIds != null and subjectIds != ''">and SUBJECT_IDS = #{subjectIds}</if>
  172. <if test="subjectNames != null and subjectNames != ''">and subject_Names like '%${subjectNames}%'</if>
  173. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC like '%${pblmDesc}%'</if>
  174. <if test="hasVedio != null and hasVedio != ''">and HAS_VEDIO = #{hasVedio}</if>
  175. <if test="pblmNm != null and pblmNm != ''">
  176. and PBLM_NM like '%${pblmNm}%'
  177. </if>
  178. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">and pblm_Type_Desc = #{pblmTypeDesc}</if>
  179. <if test="pblmReason != null and pblmReason != ''">and PBLM_REASON like '%${pblmReason}%'</if>
  180. <if test="pblmSggtn != null and pblmSggtn != ''">and PBLM_SGGTN like '%${pblmSggtn}%'</if>
  181. <if test="relativeLaw != null and relativeLaw != ''">and RELATIVE_LAW like '%${relativeLaw}%'</if>
  182. <if test="lawContent != null and lawContent != ''">and LAW_CONTENT like '%${lawContent}%' </if>
  183. <if test="pblmSn != null and pblmSn != ''">and PBLM_SN = #{pblmSn}</if>
  184. <if test="pblmstdId != null and pblmstdId != ''">and PBLMSTD_ID = #{pblmstdId}</if>
  185. <if test="rectId != null and rectId != ''">and RECT_ID = #{rectId}</if>
  186. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  187. <if test="listType != null and listType != ''">and LIST_TYPE = #{listType}</if>
  188. <if test="listId != null and listId != ''">and LIST_ID = #{listId}</if>
  189. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  190. <if test="sn != null and sn != ''">and SN = #{sn}</if>
  191. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">and PBLM_QLTTV_CD = #{pblmQlttvCd}</if>
  192. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">and PBLM_QLTTV_NM = #{pblmQlttvNm}</if>
  193. <if test="isCpQa != null and isCpQa != ''">and IS_CP_QA = #{isCpQa}</if>
  194. <if test="dataStat != null and dataStat != ''">and data_Stat = #{dataStat}</if>
  195. <if test="reasonState != null and reasonState != ''">and REASON_STATE = #{reasonState}</if>
  196. <if test="pblmMeasure != null and pblmMeasure != ''">and PBLM_MEASURE = #{pblmMeasure}</if>
  197. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">and PBLM_REASON_DETAIL = #{pblmReasonDetail}</if>
  198. </sql>
  199. <select id="get" resultMap="tacPblmInfoResultMap" parameterType="String">
  200. select t.*,r.name,r.location,h.ad_name,r.ad_code from tac_pblm_info t ,tac_pawp_rgstr r,att_ad_X_base h
  201. where substr(t.rgstr_id,0,32)=r.id and r.ad_code=h.ad_code and t.id=#{id}
  202. </select>
  203. <select id="getBy" resultMap="tacPblmInfoResultMap">
  204. select
  205. <include refid="table_columns"/>
  206. from TAC_PBLM_INFO t
  207. <include refid="page_where"/>
  208. </select>
  209. <select id="findAll" resultMap="tacPblmInfoResultMap">
  210. select
  211. <include refid="table_columns"/>
  212. from TAC_PBLM_INFO t where 1=1
  213. <include refid="choseSql"/>
  214. </select>
  215. <select id="findPblmList" resultMap="tacPblmInfoResultMap">
  216. select * from tac_pblm_info t where 1=1
  217. <include refid="mysql"/>
  218. <include refid="choseSql"/>
  219. </select>
  220. <select id="findList" resultMap="tacPblmInfoResultMap">
  221. select t.* from (
  222. select t.*,r.name,r.location,r.ad_code from tac_pblm_info t ,tac_pawp_rgstr r where substr(t.rgstr_id,0,32)=r.id
  223. ) t where 1=1
  224. <if test="persId != null and persId != ''">and t.pers_Id = #{persId}</if>
  225. <include refid="commonSql"/>
  226. </select>
  227. <select id="findListBy" resultMap="tacPblmInfoResultMap">
  228. select
  229. <include refid="table_columns"/>
  230. from tac_pblm_info t
  231. <include refid="page_where"/>
  232. </select>
  233. <select id="selectCount" resultType="int">
  234. select count(ID) from TAC_PBLM_INFO t
  235. <include refid="page_where"/>
  236. </select>
  237. <select id="findPageInfoNew" resultMap="tacPblmInfoResultMap">
  238. select t.*,r.name,r.location,r.ad_code from TAC_PBLM_INFO t ,tac_pawp_rgstr r where t.rgstr_id=r.id
  239. <include refid="commonSql"/>
  240. order by sn asc,pblm_pasi desc
  241. </select>
  242. <select id="findProvincePblmInfo" resultMap="tacPblmInfoResultMap">
  243. select t.*,r.name,r.location,r.ad_code from TAC_PBLM_INFO t ,tac_pawp_rgstr r where t.rgstr_id=r.id
  244. <include refid="commonSql"/>
  245. <!--<if test="stepId != null and stepId != ''">and t.STEP_ID = #{stepId}</if>-->
  246. order by sn asc
  247. </select>
  248. <select id="findPageInfoNew2" resultMap="tacPblmInfoResultMap">
  249. SELECT T.*,R.NAME,R.LOCATION,R.AD_CODE
  250. FROM ${pblmTableName} T ,TAC_PAWP_RGSTR R
  251. WHERE T.RGSTR_ID=R.ID
  252. <if test="stepId != null and stepId != ''">
  253. AND t.TASK_ID = #{stepId}
  254. </if>
  255. <include refid="commonSql"/>
  256. order by sn asc,pblm_pasi desc
  257. </select>
  258. <select id="findPageJieduanInfo" resultMap="tacPblmInfoResultMap">
  259. SELECT T.*,R.LOCATION,R.NAME,R.AD_CODE
  260. FROM TAC_PBLM_INFO T,TAC_PAWP_RGSTR R
  261. WHERE R.ID=SUBSTR(T.RGSTR_ID,0,32)
  262. AND LENGTH(T.RGSTR_ID) &gt;32
  263. <include refid="jieduanSql"/>
  264. order by T.OBJ_TYPE, t.pblm_Pasi, t.SN
  265. </select>
  266. <select id="findPageJieduanZLorTPY" resultMap="tacPblmInfoResultMap">
  267. select t.*,r.location,r.name,r.ad_code from TAC_PAWP_RGSTR r,tac_pblm_info t where r.id=substr(t.rgstr_id,0,32)
  268. and length(t.rgstr_id) &gt;32
  269. and r.group_id in (select group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS p
  270. where p.pers_id in (select id from TAC_WORKER_B b where b.login_id=#{persId}))
  271. <include refid="jieduanSql"/>
  272. <include refid="mySearch"/>
  273. order by T.OBJ_TYPE, t.pblm_Pasi, t.SN
  274. </select>
  275. <sql id="jieduanSql">
  276. <if test="rgstrId != null and rgstrId != ''">and t.RGSTR_ID like '${rgstrId}%'</if>
  277. <include refid="mySearch"/>
  278. </sql>
  279. <sql id="commonSql">
  280. <if test="rgstrId != null and rgstrId != ''">and t.RGSTR_ID = #{rgstrId}</if>
  281. <include refid="mySearch"/>
  282. </sql>
  283. <sql id="mySearch">
  284. <if test="listType != null and listType != ''">and t.LIST_TYPE = #{listType}</if>
  285. <if test="hasVedio != null and hasVedio != ''">and t.HAS_VEDIO = #{hasVedio}</if>
  286. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">and pblm_Type_Desc = #{pblmTypeDesc}</if>
  287. <if test="pblmPasi != null and pblmPasi != ''">and t.PBLM_PASI = #{pblmPasi}</if>
  288. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">and t.PBLM_QLTTV_CD = #{pblmQlttvCd}</if>
  289. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">and t.PBLM_QLTTV_NM = #{pblmQlttvNm}</if>
  290. <if test="adCode != null and adCode != ''">and r.AD_CODE = #{adCode}</if>
  291. <if test="objId != null and objId != ''">and r.OBJ_ID = #{objId}</if>
  292. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  293. <if test="subjectNames != null and subjectNames != ''">and subject_Names like '%${subjectNames}%'</if>
  294. <if test="groupId != null and groupId != ''">and r.GROUP_ID = #{groupId}</if>
  295. <include refid="choseSql"/>
  296. <if test="pblmNm != null and pblmNm != ''">
  297. and PBLM_NM like '%${pblmNm}%'
  298. </if>
  299. </sql>
  300. <select id="findPageInfoZLorTPY" resultMap="tacPblmInfoResultMap">
  301. select t.*,r.location,r.name,r.ad_code from TAC_PAWP_RGSTR r,tac_pblm_info t where t.rgstr_id=r.id
  302. and r.group_id in (select group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS p
  303. where p.pers_id in (select id from TAC_WORKER_B b where b.login_id=#{persId}))
  304. <include refid="commonSql"/>
  305. order by sn ASC, t.PBLM_PASI DESC
  306. </select>
  307. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  308. insert into TAC_PBLM_INFO(
  309. <include refid="table_columns"/>
  310. )
  311. values (
  312. <include refid="entity_properties"/>
  313. )
  314. </insert>
  315. <delete id="delete" parameterType="java.lang.String">
  316. delete from TAC_PBLM_INFO where ID = #{id}
  317. </delete>
  318. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  319. delete from TAC_PBLM_INFO
  320. <include refid="page_where"/>
  321. </delete>
  322. <update id="deleteInFlag" parameterType="java.lang.String">
  323. update TAC_PBLM_INFO set flag_valid = 0 where ID = #{id}
  324. </update>
  325. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  326. update TAC_PBLM_INFO
  327. <trim prefix="set" suffixOverrides=",">
  328. <if test="isPblmStbOth != null and isPblmStbOth != ''">IS_PBLM_STB_OTH = #{isPblmStbOth},</if>
  329. <if test="pblmStbOthCate != null">PBLM_STB_OTH_CATE = #{pblmStbOthCate},</if>
  330. <if test="pblmStbOthDesc != null">PBLM_STB_OTH_DESC = #{pblmStbOthDesc},</if>
  331. <if test="relativeLaw != null "> RELATIVE_LAW = #{relativeLaw} , </if>
  332. <if test="lawContent != null "> LAW_CONTENT = #{lawContent}, </if>
  333. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">PBLM_QLTTV_CD = #{pblmQlttvCd},</if>
  334. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">PBLM_QLTTV_NM = #{pblmQlttvNm},</if>
  335. <if test="isCpQa != null and isCpQa != ''">IS_CP_QA = #{isCpQa},</if>
  336. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  337. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  338. <if test="pblmPasi != null">PBLM_PASI = #{pblmPasi},</if>
  339. <if test="ifCasePblm != null">IF_CASE_PBLM = #{ifCasePblm},</if>
  340. <if test="subjectIds != null">SUBJECT_IDS = #{subjectIds},</if>
  341. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">pblm_Type_Desc = #{pblmTypeDesc},</if>
  342. <if test="pblmDesc != null">PBLM_DESC = #{pblmDesc},</if>
  343. <if test="pblmReason != null">PBLM_REASON = #{pblmReason},</if>
  344. <if test="pblmSggtn != null">PBLM_SGGTN = #{pblmSggtn},</if>
  345. <if test="pblmSn != null">PBLM_SN = #{pblmSn},</if>
  346. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  347. <if test="pblmstdId != null">PBLMSTD_ID = #{pblmstdId},</if>
  348. <if test="subjectNames != null ">subject_Names = #{subjectNames},</if>
  349. <if test="rectId != null and rectId != ''">RECT_ID = #{rectId},</if>
  350. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  351. <if test="listType != null">LIST_TYPE = #{listType},</if>
  352. <if test="listId != null">LIST_ID = #{listId},</if>
  353. <if test="groupId != null">GROUP_ID = #{groupId},</if>
  354. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  355. <if test="persNm != null and persNm != ''">PERS_NM = #{persNm},</if>
  356. <if test="hasVedio != null">HAS_VEDIO = #{hasVedio},</if>
  357. <if test="pblmNm != null">PBLM_NM = #{pblmNm},</if>
  358. <if test="intm != null">INTM = #{intm},</if>
  359. <if test="spclId != null and spclId != ''">SPCL_ID = #{spclId},</if>
  360. <if test="spclNm != null and spclNm != ''">SPCL_NM = #{spclNm},</if>
  361. <if test="spclRvwOptn != null">SPCL_RVW_OPTN = #{spclRvwOptn},</if>
  362. <if test="spclTm != null">SPCL_TM = #{spclTm},</if>
  363. <if test="uptm != null">UPTM = #{uptm},</if>
  364. <if test="note != null and note != ''">NOTE = #{note},</if>
  365. <if test="dataStat != null and dataStat != ''">data_Stat = #{dataStat},</if>
  366. <if test="reasonState != null and reasonState != ''">REASON_STATE = #{reasonState},</if>
  367. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">PBLM_REASON_DETAIL = #{pblmReasonDetail},</if>
  368. <if test="pblmMeasure != null and pblmMeasure != ''">PBLM_MEASURE = #{pblmMeasure},</if>
  369. SN = #{sn},
  370. </trim>
  371. <where>ID = #{id}</where>
  372. </update>
  373. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  374. update TAC_PBLM_INFO
  375. <trim prefix="set" suffixOverrides=",">
  376. <if test="isPblmStbOth != null and isPblmStbOth != ''">IS_PBLM_STB_OTH = #{isPblmStbOth},</if>
  377. <if test="pblmStbOthCate != null and pblmStbOthCate != ''">PBLM_STB_OTH_CATE = #{pblmStbOthCate},</if>
  378. <if test="pblmStbOthDesc != null and pblmStbOthDesc != ''">PBLM_STB_OTH_DESC = #{pblmStbOthDesc},</if>
  379. <if test="relativeLaw != null "> RELATIVE_LAW = #{relativeLaw} , </if>
  380. <if test="lawContent != null "> LAW_CONTENT = #${lawContent}, </if>
  381. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">PBLM_QLTTV_CD = #{pblmQlttvCd},</if>
  382. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">PBLM_QLTTV_NM = #{pblmQlttvNm},</if>
  383. <if test="isCpQa != null and isCpQa != ''">IS_CP_QA = #{isCpQa},</if>
  384. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  385. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">pblm_Type_Desc = #{pblmTypeDesc},</if>
  386. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  387. <if test="pblmPasi != null">PBLM_PASI = #{pblmPasi},</if>
  388. <if test="ifCasePblm != null">IF_CASE_PBLM = #{ifCasePblm},</if>
  389. <if test="subjectIds != null">SUBJECT_IDS = #{subjectIds},</if>
  390. <if test="pblmDesc != null">PBLM_DESC = #{pblmDesc},</if>
  391. <if test="pblmReason != null">PBLM_REASON = #{pblmReason},</if>
  392. <if test="pblmSggtn != null">PBLM_SGGTN = #{pblmSggtn},</if>
  393. <if test="subjectNames != null">subject_Names = #{subjectNames},</if>
  394. <if test="pblmSn != null">PBLM_SN = #{pblmSn},</if>
  395. <if test="pblmstdId != null">PBLMSTD_ID = #{pblmstdId},</if>
  396. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  397. <if test="rectId != null and rectId != ''">RECT_ID = #{rectId},</if>
  398. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  399. <if test="listType != null">LIST_TYPE = #{listType},</if>
  400. <if test="listId != null">LIST_ID = #{listId},</if>
  401. <if test="groupId != null">GROUP_ID = #{groupId},</if>
  402. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  403. <if test="persNm != null">PERS_NM = #{persNm},</if>
  404. <if test="intm != null">INTM = #{intm},</if>
  405. <if test="spclId != null and spclId != ''">SPCL_ID = #{spclId},</if>
  406. <if test="spclNm != null">SPCL_NM = #{spclNm},</if>
  407. <if test="spclRvwOptn != null">SPCL_RVW_OPTN = #{spclRvwOptn},</if>
  408. <if test="spclTm != null">SPCL_TM = #{spclTm},</if>
  409. <if test="uptm != null">UPTM = #{uptm},</if>
  410. <if test="note != null and note != ''">NOTE = #{note},</if>
  411. <if test="dataStat != null and dataStat != ''">data_Stat = #{dataStat},</if>
  412. <if test="reasonState != null and reasonState != ''">REASON_STATE = #{reasonState},</if>
  413. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">PBLM_REASON_DETAIL = #{pblmReasonDetail},</if>
  414. <if test="pblmMeasure != null and pblmMeasure != ''">PBLM_MEASURE = #{pblmMeasure},</if>
  415. SN = #{sn},
  416. </trim>
  417. <include refid="page_where"/>
  418. </update>
  419. <!-- 其他自定义SQL -->
  420. <select id="getPblmCountByYear" resultType="java.lang.Integer"
  421. parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam">
  422. select case when count(*) is NULL then 0 else count(*) end from TAC_PBLM_INFO t left join
  423. TAC_INSP_YEAR_BATCH_OBJ o on t.obj_id = o.id where o.id is not null and o.year = #{year}
  424. <if test="persId != null and persId != ''">
  425. and o.group_id in (select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID = (select b.id from
  426. TAC_WORKER_B b where b.login_id = #{persId})
  427. )
  428. </if>
  429. <include refid="choseSql"/>
  430. </select>
  431. <select id="getMaxSn" resultType="String">
  432. SELECT Max(sn) from TAC_PBLM_INFO t where 1=1
  433. <include refid="choseSql"/>
  434. </select>
  435. <sql id="choseSql">
  436. <choose>
  437. <when test="province !=null and province !=''">
  438. and t.province=#{province}
  439. </when>
  440. <otherwise>
  441. and t.province is null
  442. </otherwise>
  443. </choose>
  444. </sql>
  445. <select id="countPblmInfoByType" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  446. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  447. select PBLM_PASI as code,count(*) as count from (
  448. select * from TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id left join
  449. TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  450. where r.id is not null and t.pblm_pasi is not null
  451. <include refid="choseSql"/>
  452. <if test="year != null">
  453. and o.year = #{year}
  454. </if>
  455. <if test="batch != null">
  456. and o.batch = #{batch}
  457. </if>
  458. <if test="type != null and type != ''">
  459. and r.type = #{type}
  460. </if>
  461. <if test="isPoverty != null and isPoverty != ''">
  462. and r.IS_POVERTY = #{isPoverty}
  463. </if>
  464. <if test="state != null and state != ''">
  465. and r.state = #{state}
  466. </if>
  467. <if test="searchStat != null and searchStat != ''">
  468. and t.RGSTR_ID like '%_${searchStat}'
  469. </if>
  470. ) group by PBLM_PASI
  471. </select>
  472. <select id="countPblmInfoBySub" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  473. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  474. select t.sub_id as code,t.pblm_pasi as name, count(*) as count from (
  475. select distinct t.id,t.pblm_pasi,s.sub_id from TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id
  476. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  477. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  478. where t.pblm_pasi is not null and s.id is not null and s.sub_id is not null
  479. <if test="year != null">
  480. and o.year = #{year}
  481. </if>
  482. <if test="batch != null">
  483. and o.batch = #{batch}
  484. </if>
  485. <if test="type != null and type != ''">
  486. and r.type = #{type}
  487. </if>
  488. <if test="isPoverty != null and isPoverty != ''">
  489. and r.IS_POVERTY = #{isPoverty}
  490. </if>
  491. <if test="state != null and state != ''">
  492. and r.state = #{state}
  493. </if>
  494. <if test="searchStat != null and searchStat != ''">
  495. and t.RGSTR_ID like '%_${searchStat}'
  496. </if>
  497. <if test="rgstrId != null and rgstrId !=''">
  498. and t.RGSTR_ID like '%_${rgstrId}'
  499. </if>
  500. ) t group by t.sub_id,t.pblm_pasi
  501. </select>
  502. <select id="countPblmInfoBySubNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  503. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  504. select t.SYS_TYPE as code,t.pblm_pasi as name, count(*) as count from (
  505. select distinct t.id,t.pblm_pasi,os.SYS_TYPE from TAC_PBLM_INFO t left join
  506. TAC_PAWP_RGSTR r on t.obj_id = r.obj_id left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  507. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id left join tac_obj_subject os on s.sub_id = os.ID
  508. where t.pblm_pasi is not null and s.id is not null and s.sub_id is not null
  509. <include refid="choseSql"/>
  510. <if test="year != null">
  511. and o.year =#{year}
  512. </if>
  513. <if test="batch != null">
  514. and o.batch = #{batch}
  515. </if>
  516. <if test="type != null and type != ''">
  517. and r.type = #{type}
  518. </if>
  519. <if test="isPoverty != null and isPoverty != ''">
  520. and r.IS_POVERTY = #{isPoverty}
  521. </if>
  522. <if test="state != null and state != ''">
  523. and r.state = #{state}
  524. </if>
  525. <if test="searchStat != null and searchStat != ''">
  526. and t.RGSTR_ID like '%_${searchStat}'
  527. </if>
  528. <if test="rgstrId != null and rgstrId !=''">
  529. and length(t.RGSTR_ID)=32
  530. </if>
  531. ) t group by t.SYS_TYPE,t.pblm_pasi
  532. </select>
  533. <select id="countPblmInfoByAdCode" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  534. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  535. select AD_Code as code,'('||AD_Name||')'||name as name,count(*) as count,PBLM_PASI AS pblmPasi from (
  536. select t.*,r.ad_code,b.ad_name,r.name from TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id
  537. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  538. left join att_ad_x_base b on r.ad_code = b.ad_code
  539. where r.id is not null and t.pblm_pasi is not null
  540. <if test="year != null">
  541. and o.year = #{year}
  542. </if>
  543. <if test="batch != null">
  544. and o.batch = #{batch}
  545. </if>
  546. <if test="type != null and type != ''">
  547. and r.type = #{type}
  548. </if>
  549. <if test="isPoverty != null and isPoverty != ''">
  550. and r.IS_POVERTY = #{isPoverty}
  551. </if>
  552. <if test="state != null and state != ''">
  553. and r.state = #{state}
  554. </if>
  555. <if test="searchStat != null and searchStat != ''">
  556. and t.RGSTR_ID like '%_${searchStat}'
  557. </if>
  558. <if test="rgstrId != null and rgstrId !=''">
  559. and t.RGSTR_ID like '%_${rgstrId}'
  560. </if>
  561. ) group by AD_Code,AD_Name,name,PBLM_PASI order by COUNT desc
  562. </select>
  563. <select id="countPblmInfoByAdCodeNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  564. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  565. select AD_Code as code, PBLM_PASI AS name, count(*) as count
  566. from (
  567. select t.*, a.ad_code, a.ad_name
  568. from TAC_PBLM_INFO t
  569. left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id
  570. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  571. left join TAC_INSP_YEAR_BATCH_AREA a on a.GROUP_ID=o.GROUP_ID
  572. where r.id is not null
  573. and t.pblm_pasi is not null
  574. <include refid="choseSql"/>
  575. <if test="year != null">
  576. and o.year = #{year}
  577. </if>
  578. <if test="batch != null">
  579. and o.batch = #{batch}
  580. </if>
  581. <if test="type != null and type != ''">
  582. and r.type = #{type}
  583. </if>
  584. <if test="isPoverty != null and isPoverty != ''">
  585. and r.IS_POVERTY = #{isPoverty}
  586. </if>
  587. <if test="state != null and state != ''">
  588. and r.state = #{state}
  589. </if>
  590. <if test="searchStat != null and searchStat != ''">
  591. and t.RGSTR_ID like '%_${searchStat}'
  592. </if>
  593. <if test="rgstrId != null and rgstrId !=''">
  594. and length(t.RGSTR_ID)=32
  595. </if>
  596. ) group by AD_Code, AD_Name,PBLM_PASI order by COUNT desc
  597. </select>
  598. <select id="countPblmInfoByObjTypeNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  599. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  600. WITH O AS (
  601. SELECT B.TYPE AS NAME,
  602. COUNT(T.ID) PBLM_SIZE
  603. FROM TAC_INSP_YEAR_BATCH_OBJ O
  604. JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  605. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  606. LEFT JOIN (SELECT * FROM TAC_PBLM_INFO) T ON T.RGSTR_ID = R.ID
  607. WHERE T.PBLM_PASI IS NOT NULL
  608. <include refid="choseSql"/>
  609. <if test="year != null">
  610. and O.year = #{year}
  611. </if>
  612. <if test="batch != null">
  613. and O.batch = #{batch}
  614. </if>
  615. <if test="rgstrId != null and rgstrId !=''">
  616. and length(t.RGSTR_ID)=32
  617. </if>
  618. GROUP BY B.TYPE
  619. )
  620. SELECT
  621. name, SUM(PBLM_SIZE) AS "count"
  622. FROM O
  623. WHERE name is not null
  624. GROUP BY name
  625. ORDER BY name
  626. </select>
  627. <select id="countPblmInfoByStb" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  628. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  629. SELECT
  630. ( CASE WHEN count( * ) IS NULL THEN 0 ELSE count( * ) END ) AS count,
  631. DECODE( spfsnlType, '质量实体', '工程质量', '质量行为', '工程质量', '安全管理', '工程安全', spfsnlType ) AS name,
  632. pblmType,
  633. pblmPasi AS code
  634. FROM
  635. (
  636. SELECT
  637. tb.SPFSNL_TYPE AS spfsnlType,
  638. t.PBLM_PASI AS pblmPasi,
  639. tb.pblm_type AS pblmType,
  640. t.PBLM_NM
  641. FROM
  642. TAC_PBLM_INFO t
  643. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  644. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  645. WHERE
  646. o.id IS NOT NULL
  647. AND t.pblm_pasi IS NOT NULL
  648. AND tb.id IS NOT NULL
  649. <if test="year != null">and o.year = #{year}
  650. </if>
  651. <if test="batch != null">and o.batch = #{batch}
  652. </if>
  653. <if test="type != null and type != ''">and r.type = #{type}
  654. </if>
  655. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  656. </if>
  657. <if test="state != null and state != ''">
  658. and r.state = #{state}
  659. </if>
  660. <if test="searchStat != null and searchStat != ''">
  661. and t.RGSTR_ID like '%_${searchStat}'
  662. </if>
  663. <if test="objId != null and objId != ''">
  664. and t.obj_id = #{objId}
  665. </if>
  666. <choose>
  667. <when test="rgstrId != null and rgstrId !=''">
  668. and t.RGSTR_ID like '%_${rgstrId}'
  669. and length(t.RGSTR_ID) > 32
  670. </when>
  671. <otherwise>
  672. and length(t.RGSTR_ID)=32
  673. </otherwise>
  674. </choose>
  675. )
  676. WHERE
  677. spfsnlType NOT IN ( '质量管理—实体质量', '计划管理' )
  678. GROUP BY
  679. spfsnlType,
  680. pblmType,
  681. pblmPasi
  682. ORDER BY
  683. pblmType
  684. </select>
  685. <select id="countPblmInfoByStbZjNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  686. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  687. SELECT
  688. ( CASE WHEN count( * ) IS NULL THEN 0 ELSE count( * ) END ) AS count,
  689. DECODE( spfsnlType, '质量实体', '工程质量', '质量行为', '工程质量', '安全管理', '工程安全', spfsnlType ) AS name,
  690. pblmType,
  691. pblmPasi AS code
  692. FROM
  693. (
  694. SELECT
  695. tb.SPFSNL_TYPE AS spfsnlType,
  696. t.PBLM_PASI AS pblmPasi,
  697. tb.pblm_type AS pblmType,
  698. t.PBLM_NM
  699. FROM
  700. TAC_PBLM_INFO t
  701. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  702. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  703. WHERE
  704. o.id IS NOT NULL
  705. AND t.pblm_pasi IS NOT NULL
  706. AND tb.id IS NOT NULL
  707. <include refid="choseSql"/>
  708. <if test="year != null">and o.year = #{year}
  709. </if>
  710. <if test="batch != null">and o.batch = #{batch}
  711. </if>
  712. <if test="type != null and type != ''">and r.type = #{type}
  713. </if>
  714. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  715. </if>
  716. <if test="state != null and state != ''">
  717. and r.state = #{state}
  718. </if>
  719. <if test="searchStat != null and searchStat != ''">
  720. and t.RGSTR_ID like '%_${searchStat}'
  721. </if>
  722. <if test="objId != null and objId != ''">
  723. and t.obj_id = #{objId}
  724. </if>
  725. <if test="rgstrId != null and rgstrId !=''">
  726. and length(t.RGSTR_ID)=32
  727. </if>
  728. )
  729. WHERE
  730. spfsnlType NOT IN ( '质量管理—实体质量', '计划管理' )
  731. GROUP BY
  732. spfsnlType,
  733. pblmType,
  734. pblmPasi
  735. ORDER BY
  736. pblmType
  737. </select>
  738. <select id="countPblmInfoByCase" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  739. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  740. select count(*) as count,t.if_case_pblm as code from (
  741. select distinct t.id,(case when t.if_case_pblm is null then '0' else t.if_case_pblm end ) as if_case_pblm from
  742. TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id left join TAC_INSP_YEAR_BATCH_OBJ o on o.id =
  743. r.obj_id
  744. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  745. where 1=1
  746. <include refid="choseSql"/>
  747. <if test="year != null">
  748. and o.year = #{year}
  749. </if>
  750. <if test="batch != null">
  751. and o.batch = #{batch}
  752. </if>
  753. <if test="type != null and type != ''">
  754. and r.type = #{type}
  755. </if>
  756. <if test="isPoverty != null and isPoverty != ''">
  757. and r.IS_POVERTY = #{isPoverty}
  758. </if>
  759. <if test="state != null and state != ''">
  760. and r.state = #{state}
  761. </if>
  762. <if test="searchStat != null and searchStat != ''">
  763. and t.RGSTR_ID like '%_${searchStat}'
  764. </if>
  765. ) t group by t.if_case_pblm
  766. </select>
  767. <select id="countPblmInfoByQlttv" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  768. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  769. select count(*),t.PBLM_QLTTV_CD as code,t.PBLM_QLTTV_NM as name from (
  770. select distinct t.id,t.PBLM_QLTTV_CD,t.PBLM_QLTTV_NM from TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id
  771. = r.obj_id left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  772. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  773. where t.PBLM_QLTTV_NM is not null
  774. <include refid="choseSql"/>
  775. <if test="year != null">
  776. and o.year = #{year}
  777. </if>
  778. <if test="batch != null">
  779. and o.batch = #{batch}
  780. </if>
  781. <if test="type != null and type != ''">
  782. and r.type = #{type}
  783. </if>
  784. <if test="isPoverty != null and isPoverty != ''">
  785. and r.IS_POVERTY = #{isPoverty}
  786. </if>
  787. <if test="state != null and state != ''">
  788. and r.state = #{state}
  789. </if>
  790. <if test="searchStat != null and searchStat != ''">
  791. and t.RGSTR_ID like '%_${searchStat}'
  792. </if>
  793. ) t group by t.PBLM_QLTTV_CD,t.PBLM_QLTTV_NM
  794. </select>
  795. <select id="findListByYearBatch" resultMap="tacPblmInfoResultMap">
  796. select t.*,r.name,r.location,r.ad_code from tac_pblm_info t ,tac_pawp_rgstr r where substr(t.rgstr_id,0,32)=r.id and length(t.rgstr_id) &gt;32
  797. and r.id in (
  798. select B.Id from TAC_INSP_YEAR_BATCH_OBJ A
  799. JOIN TAC_PAWP_RGSTR B
  800. ON A.ID=B.OBJ_ID
  801. WHERE B.STATE=#{state}
  802. and a.year=#{year}
  803. and A.BATCH=#{batch}
  804. )
  805. and t.rgstr_id like '%_${state}' and r.ad_code like '${orgId}%'
  806. </select>
  807. <select id="countIfCasePblm" resultType="java.lang.Integer">
  808. SELECT
  809. count(*)
  810. FROM
  811. TAC_PBLM_INFO t
  812. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  813. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  814. WHERE
  815. t.pblm_pasi IS NOT NULL
  816. AND tb.id IS NOT NULL
  817. <if test="year != null">and o.year = #{year}
  818. </if>
  819. <if test="batch != null">and o.batch = #{batch}
  820. </if>
  821. <if test="type != null and type != ''">and r.type = #{type}
  822. </if>
  823. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  824. </if>
  825. <if test="state != null and state != ''">
  826. and r.state = #{state}
  827. </if>
  828. <if test="searchStat != null and searchStat != ''">
  829. and t.RGSTR_ID like '%_${searchStat}'
  830. </if>
  831. <if test="objId != null and objId != ''">
  832. and t.obj_id = #{objId}
  833. </if>
  834. <choose>
  835. <when test="rgstrId != null and rgstrId !=''">
  836. and t.RGSTR_ID like '%_${rgstrId}'
  837. </when>
  838. <otherwise>
  839. and length(t.RGSTR_ID)=32
  840. </otherwise>
  841. </choose>
  842. <choose>
  843. <when test="ifCasePblm == 1">
  844. and t.IF_CASE_PBLM = 1
  845. </when>
  846. <otherwise>
  847. and (t.IF_CASE_PBLM = 0 or t.IF_CASE_PBLM is null)
  848. </otherwise>
  849. </choose>
  850. </select>
  851. <select id="countIfCasePblmNew" resultType="java.lang.Integer">
  852. SELECT
  853. count(*)
  854. FROM
  855. TAC_PBLM_INFO t
  856. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  857. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  858. WHERE
  859. t.pblm_pasi IS NOT NULL
  860. AND tb.id IS NOT NULL
  861. <include refid="choseSql"/>
  862. <if test="year != null">and o.year = #{year}
  863. </if>
  864. <if test="batch != null">and o.batch = #{batch}
  865. </if>
  866. <if test="type != null and type != ''">and r.type = #{type}
  867. </if>
  868. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  869. </if>
  870. <if test="state != null and state != ''">
  871. and r.state = #{state}
  872. </if>
  873. <if test="searchStat != null and searchStat != ''">
  874. and t.RGSTR_ID like '%_${searchStat}'
  875. </if>
  876. <if test="objId != null and objId != ''">
  877. and t.obj_id = #{objId}
  878. </if>
  879. <if test="rgstrId != null and rgstrId !=''">
  880. and length(t.RGSTR_ID)=32
  881. </if>
  882. <choose>
  883. <when test="ifCasePblm == 1">
  884. and t.IF_CASE_PBLM = 1
  885. </when>
  886. <otherwise>
  887. and (t.IF_CASE_PBLM = 0 or t.IF_CASE_PBLM is null)
  888. </otherwise>
  889. </choose>
  890. </select>
  891. <select id="countPblmInfoByQt" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  892. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  893. SELECT
  894. count( * ) AS count,
  895. a.showName,
  896. a.name
  897. FROM
  898. (
  899. SELECT
  900. t.LIST_TYPE as name,
  901. tp.PBLM_TYPE_DESC AS showName
  902. FROM
  903. TAC_PBLM_INFO t
  904. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  905. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  906. WHERE
  907. t.PBLMSTD_ID IS NOT NULL
  908. AND tp.id IS NOT NULL
  909. and tp.PBLM_TYPE_DESC is not null
  910. <if test="year !=null">
  911. and o.year = #{year}
  912. </if>
  913. <if test="batch != null">
  914. and o.batch = #{batch}
  915. </if>
  916. <if test="stbClaName != null and stbClaName != ''">
  917. and t.LIST_TYPE = #{stbClaName}
  918. </if>
  919. <if test="rgstrId != null and rgstrId !=''">
  920. and t.RGSTR_ID like '_${rgstrId}%'
  921. </if>
  922. ) A
  923. GROUP BY
  924. a.showName,
  925. a.name
  926. ORDER BY
  927. a.showName
  928. </select>
  929. <select id="countPblmInfoByQtNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  930. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  931. SELECT
  932. count( * ) AS count,
  933. a.showName,
  934. a.name
  935. FROM
  936. (
  937. SELECT
  938. t.LIST_TYPE as name,
  939. tp.PBLM_TYPE_DESC AS showName
  940. FROM
  941. TAC_PBLM_INFO t
  942. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  943. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  944. WHERE
  945. t.PBLMSTD_ID IS NOT NULL
  946. AND tp.id IS NOT NULL
  947. and tp.PBLM_TYPE_DESC is not null
  948. and tp.PBLM_TYPE_DESC !='其他'
  949. <include refid="choseSql"/>
  950. <if test="year !=null">
  951. and o.year = #{year}
  952. </if>
  953. <if test="batch != null">
  954. and o.batch = #{batch}
  955. </if>
  956. <if test="stbClaName != null and stbClaName != ''">
  957. and t.LIST_TYPE = #{stbClaName}
  958. </if>
  959. <if test="rgstrId != null and rgstrId !=''">
  960. and length(t.RGSTR_ID)=32
  961. </if>
  962. ) A
  963. GROUP BY
  964. a.showName,
  965. a.name
  966. ORDER BY
  967. a.showName
  968. </select>
  969. <select id="countPblmInfoObjByQt" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  970. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  971. SELECT
  972. count( * ) AS count,
  973. a.showName,
  974. a.name
  975. FROM
  976. (
  977. SELECT
  978. DISTINCT
  979. t.PBLMSTD_ID,
  980. tp.PBLM_TYPE_DESC AS showName,
  981. t.LIST_TYPE as name
  982. FROM
  983. TAC_PBLM_INFO t
  984. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  985. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  986. WHERE
  987. t.PBLMSTD_ID IS NOT NULL
  988. AND tp.id IS NOT NULL
  989. and tp.PBLM_TYPE_DESC is not null
  990. <if test="year !=null">
  991. and o.year = #{year}
  992. </if>
  993. <if test="batch != null">
  994. and o.batch = #{batch}
  995. </if>
  996. <if test="stbClaName != null and stbClaName != ''">
  997. and t.LIST_TYPE = #{stbClaName}
  998. </if>
  999. <if test="rgstrId != null and rgstrId !=''">
  1000. and t.RGSTR_ID like '_${rgstrId}%'
  1001. </if>
  1002. ) A
  1003. GROUP BY
  1004. a.name,a.showName
  1005. ORDER BY
  1006. a.showName
  1007. </select>
  1008. <select id="countPblmInfoObjByQtNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  1009. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1010. SELECT
  1011. count( * ) AS count,
  1012. a.showName,
  1013. a.name
  1014. FROM
  1015. (
  1016. SELECT
  1017. DISTINCT
  1018. t.PBLMSTD_ID,
  1019. tp.PBLM_TYPE_DESC AS showName,
  1020. t.LIST_TYPE as name
  1021. FROM
  1022. TAC_PBLM_INFO t
  1023. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  1024. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  1025. WHERE
  1026. t.PBLMSTD_ID IS NOT NULL
  1027. AND tp.id IS NOT NULL
  1028. and tp.PBLM_TYPE_DESC is not null
  1029. and tp.PBLM_TYPE_DESC !='其他'
  1030. <include refid="choseSql"/>
  1031. <if test="year !=null">
  1032. and o.year = #{year}
  1033. </if>
  1034. <if test="batch != null">
  1035. and o.batch = #{batch}
  1036. </if>
  1037. <if test="stbClaName != null and stbClaName != ''">
  1038. and t.LIST_TYPE = #{stbClaName}
  1039. </if>
  1040. <if test="rgstrId != null and rgstrId !=''">
  1041. and length(t.RGSTR_ID)=32
  1042. </if>
  1043. ) A
  1044. GROUP BY
  1045. a.name,a.showName
  1046. ORDER BY
  1047. a.showName
  1048. </select>
  1049. <select id="countAdNameByAdAdCade" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam"
  1050. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1051. select a.AD_CODE as code, a.AD_NAME as name, count(*) as count
  1052. from att_ad_x_base a
  1053. where a.GUID is not null
  1054. and a.AD_CODE in (${adCode})
  1055. group by a.AD_CODE, a.AD_NAME
  1056. </select>
  1057. <select id="countPblmInfoByObj" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  1058. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1059. SELECT
  1060. a.ID as rgstrId,
  1061. a.name,
  1062. count(*) AS count
  1063. FROM
  1064. (
  1065. SELECT r.ID, r.NAME
  1066. FROM TAC_INSP_YEAR_BATCH_OBJ o
  1067. join TAC_PAWP_RGSTR r on o.id = r.obj_id
  1068. join TAC_PBLM_INFO t on t.obj_id = r.obj_id
  1069. <where>
  1070. <include refid="choseSql"/>
  1071. <if test="year !=null">and o.year = #{year}</if>
  1072. <if test="batch != null">and o.batch = #{batch}</if>
  1073. <if test="rgstrId != null and rgstrId !=''">and length(t.RGSTR_ID)=32</if>
  1074. <if test="adCode != null and adCode != ''">and r.AD_CODE like '%' || substr(#{adCode},0,4) || '%'</if>
  1075. </where>
  1076. ) A
  1077. GROUP BY a.name,a.ID
  1078. </select>
  1079. <select id="getLeaderId" resultType="java.lang.String" parameterType="java.lang.String">
  1080. select guid from bis_insp_all_rlation_pers where mobilenumb in (select t.mobilenumb from TAC_INSP_YEAR_BATCH_GROUP_PERS p left join TAC_WORKER_B t on t.id = p.pers_id
  1081. left join tac_insp_year_batch h on p.year_batch_id=h.id
  1082. where h.data_stat='0' and p.GROUP_ID in (select r.group_id from TAC_PBLM_INFO t,tac_pawp_rgstr r where t.rgstr_id=r.id and t.id = #{id}) and p.role_type = 20)
  1083. </select>
  1084. </mapper>