cbcececb1f7dda6dcbba934b7dd01481ca96af9a.svn-base 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  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,1,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,1,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. </select>
  241. <select id="findProvincePblmInfo" resultMap="tacPblmInfoResultMap">
  242. select t.*,r.name,r.location,r.ad_code from TAC_PROVINCE_PBLM_INFO t ,tac_pawp_rgstr r where t.rgstr_id=r.id
  243. <if test="stepId != null and stepId != ''">and t.STEP_ID = #{stepId}</if>
  244. <include refid="commonSql"/>
  245. </select>
  246. <select id="findPageInfoNew2" resultMap="tacPblmInfoResultMap">
  247. SELECT T.*,R.NAME,R.LOCATION,R.AD_CODE
  248. FROM ${pblmTableName} T ,TAC_PAWP_RGSTR R
  249. WHERE T.RGSTR_ID=R.ID
  250. <if test="stepId != null and stepId != ''">
  251. AND t.TASK_ID = #{stepId}
  252. </if>
  253. <include refid="commonSql"/>
  254. </select>
  255. <select id="findPageJieduanInfo" resultMap="tacPblmInfoResultMap">
  256. SELECT T.*,R.LOCATION,R.NAME,R.AD_CODE
  257. FROM TAC_PBLM_INFO T,TAC_PAWP_RGSTR R
  258. WHERE R.ID=SUBSTR(T.RGSTR_ID,1,32)
  259. AND LENGTH(T.RGSTR_ID) &gt;32
  260. <include refid="jieduanSql"/>
  261. order by T.OBJ_TYPE, t.pblm_Pasi, t.SN
  262. </select>
  263. <select id="findPageJieduanZLorTPY" resultMap="tacPblmInfoResultMap">
  264. 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,1,32)
  265. and length(t.rgstr_id) &gt;32
  266. and r.group_id in (select group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS p
  267. where p.pers_id in (select id from TAC_WORKER_B b where b.login_id=#{persId}))
  268. <include refid="jieduanSql"/>
  269. <include refid="mySearch"/>
  270. order by T.OBJ_TYPE, t.pblm_Pasi, t.SN
  271. </select>
  272. <sql id="jieduanSql">
  273. <if test="rgstrId != null and rgstrId != ''">and t.RGSTR_ID like '${rgstrId}%'</if>
  274. <include refid="mySearch"/>
  275. </sql>
  276. <sql id="commonSql">
  277. <if test="rgstrId != null and rgstrId != ''">and t.RGSTR_ID = #{rgstrId}</if>
  278. <include refid="mySearch"/>
  279. </sql>
  280. <sql id="mySearch">
  281. <if test="listType != null and listType != ''">and t.LIST_TYPE = #{listType}</if>
  282. <if test="hasVedio != null and hasVedio != ''">and t.HAS_VEDIO = #{hasVedio}</if>
  283. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">and pblm_Type_Desc = #{pblmTypeDesc}</if>
  284. <if test="pblmPasi != null and pblmPasi != ''">and t.PBLM_PASI = #{pblmPasi}</if>
  285. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">and t.PBLM_QLTTV_CD = #{pblmQlttvCd}</if>
  286. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">and t.PBLM_QLTTV_NM = #{pblmQlttvNm}</if>
  287. <if test="adCode != null and adCode != ''">and r.AD_CODE = #{adCode}</if>
  288. <if test="objId != null and objId != ''">and r.OBJ_ID = #{objId}</if>
  289. <if test="ifCasePblm != null and ifCasePblm != ''">and IF_CASE_PBLM = #{ifCasePblm}</if>
  290. <if test="subjectNames != null and subjectNames != ''">and subject_Names like '%${subjectNames}%'</if>
  291. <if test="groupId != null and groupId != ''">and r.GROUP_ID = #{groupId}</if>
  292. <include refid="choseSql"/>
  293. <if test="pblmNm != null and pblmNm != ''">
  294. and PBLM_NM like '%${pblmNm}%'
  295. </if>
  296. order by T.OBJ_TYPE, t.pblm_Pasi, t.SN
  297. </sql>
  298. <select id="findPageInfoZLorTPY" resultMap="tacPblmInfoResultMap">
  299. select t.*,r.location,r.name,r.ad_code from TAC_PAWP_RGSTR r,tac_pblm_info t where t.rgstr_id=r.id
  300. and r.group_id in (select group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS p
  301. where p.pers_id in (select id from TAC_WORKER_B b where b.login_id=#{persId}))
  302. <include refid="commonSql"/>
  303. </select>
  304. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  305. insert into TAC_PBLM_INFO(
  306. <include refid="table_columns"/>
  307. )
  308. values (
  309. <include refid="entity_properties"/>
  310. )
  311. </insert>
  312. <delete id="delete" parameterType="java.lang.String">
  313. delete from TAC_PBLM_INFO where ID = #{id}
  314. </delete>
  315. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  316. delete from TAC_PBLM_INFO
  317. <include refid="page_where"/>
  318. </delete>
  319. <update id="deleteInFlag" parameterType="java.lang.String">
  320. update TAC_PBLM_INFO set flag_valid = 0 where ID = #{id}
  321. </update>
  322. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  323. update TAC_PBLM_INFO
  324. <trim prefix="set" suffixOverrides=",">
  325. <if test="isPblmStbOth != null and isPblmStbOth != ''">IS_PBLM_STB_OTH = #{isPblmStbOth},</if>
  326. <if test="pblmStbOthCate != null">PBLM_STB_OTH_CATE = #{pblmStbOthCate},</if>
  327. <if test="pblmStbOthDesc != null">PBLM_STB_OTH_DESC = #{pblmStbOthDesc},</if>
  328. <if test="relativeLaw != null "> RELATIVE_LAW = #{relativeLaw} , </if>
  329. <if test="lawContent != null "> LAW_CONTENT = #{lawContent}, </if>
  330. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">PBLM_QLTTV_CD = #{pblmQlttvCd},</if>
  331. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">PBLM_QLTTV_NM = #{pblmQlttvNm},</if>
  332. <if test="isCpQa != null and isCpQa != ''">IS_CP_QA = #{isCpQa},</if>
  333. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  334. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  335. <if test="pblmPasi != null">PBLM_PASI = #{pblmPasi},</if>
  336. <if test="ifCasePblm != null">IF_CASE_PBLM = #{ifCasePblm},</if>
  337. <if test="subjectIds != null">SUBJECT_IDS = #{subjectIds},</if>
  338. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">pblm_Type_Desc = #{pblmTypeDesc},</if>
  339. <if test="pblmDesc != null">PBLM_DESC = #{pblmDesc},</if>
  340. <if test="pblmReason != null">PBLM_REASON = #{pblmReason},</if>
  341. <if test="pblmSggtn != null">PBLM_SGGTN = #{pblmSggtn},</if>
  342. <if test="pblmSn != null">PBLM_SN = #{pblmSn},</if>
  343. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  344. <if test="pblmstdId != null">PBLMSTD_ID = #{pblmstdId},</if>
  345. <if test="subjectNames != null ">subject_Names = #{subjectNames},</if>
  346. <if test="rectId != null and rectId != ''">RECT_ID = #{rectId},</if>
  347. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  348. <if test="listType != null">LIST_TYPE = #{listType},</if>
  349. <if test="listId != null">LIST_ID = #{listId},</if>
  350. <if test="groupId != null">GROUP_ID = #{groupId},</if>
  351. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  352. <if test="persNm != null and persNm != ''">PERS_NM = #{persNm},</if>
  353. <if test="hasVedio != null">HAS_VEDIO = #{hasVedio},</if>
  354. <if test="pblmNm != null">PBLM_NM = #{pblmNm},</if>
  355. <if test="intm != null">INTM = #{intm},</if>
  356. <if test="spclId != null and spclId != ''">SPCL_ID = #{spclId},</if>
  357. <if test="spclNm != null and spclNm != ''">SPCL_NM = #{spclNm},</if>
  358. <if test="spclRvwOptn != null">SPCL_RVW_OPTN = #{spclRvwOptn},</if>
  359. <if test="spclTm != null">SPCL_TM = #{spclTm},</if>
  360. <if test="uptm != null">UPTM = #{uptm},</if>
  361. <if test="note != null and note != ''">NOTE = #{note},</if>
  362. <if test="dataStat != null and dataStat != ''">data_Stat = #{dataStat},</if>
  363. <if test="reasonState != null and reasonState != ''">REASON_STATE = #{reasonState},</if>
  364. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">PBLM_REASON_DETAIL = #{pblmReasonDetail},</if>
  365. <if test="pblmMeasure != null and pblmMeasure != ''">PBLM_MEASURE = #{pblmMeasure},</if>
  366. SN = #{sn},
  367. </trim>
  368. <where>ID = #{id}</where>
  369. </update>
  370. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmInfo">
  371. update TAC_PBLM_INFO
  372. <trim prefix="set" suffixOverrides=",">
  373. <if test="isPblmStbOth != null and isPblmStbOth != ''">IS_PBLM_STB_OTH = #{isPblmStbOth},</if>
  374. <if test="pblmStbOthCate != null and pblmStbOthCate != ''">PBLM_STB_OTH_CATE = #{pblmStbOthCate},</if>
  375. <if test="pblmStbOthDesc != null and pblmStbOthDesc != ''">PBLM_STB_OTH_DESC = #{pblmStbOthDesc},</if>
  376. <if test="relativeLaw != null "> RELATIVE_LAW = #{relativeLaw} , </if>
  377. <if test="lawContent != null "> LAW_CONTENT = #${lawContent}, </if>
  378. <if test="pblmQlttvCd != null and pblmQlttvCd != ''">PBLM_QLTTV_CD = #{pblmQlttvCd},</if>
  379. <if test="pblmQlttvNm != null and pblmQlttvNm != ''">PBLM_QLTTV_NM = #{pblmQlttvNm},</if>
  380. <if test="isCpQa != null and isCpQa != ''">IS_CP_QA = #{isCpQa},</if>
  381. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  382. <if test="pblmTypeDesc != null and pblmTypeDesc != ''">pblm_Type_Desc = #{pblmTypeDesc},</if>
  383. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  384. <if test="pblmPasi != null">PBLM_PASI = #{pblmPasi},</if>
  385. <if test="ifCasePblm != null">IF_CASE_PBLM = #{ifCasePblm},</if>
  386. <if test="subjectIds != null">SUBJECT_IDS = #{subjectIds},</if>
  387. <if test="pblmDesc != null">PBLM_DESC = #{pblmDesc},</if>
  388. <if test="pblmReason != null">PBLM_REASON = #{pblmReason},</if>
  389. <if test="pblmSggtn != null">PBLM_SGGTN = #{pblmSggtn},</if>
  390. <if test="subjectNames != null">subject_Names = #{subjectNames},</if>
  391. <if test="pblmSn != null">PBLM_SN = #{pblmSn},</if>
  392. <if test="pblmstdId != null">PBLMSTD_ID = #{pblmstdId},</if>
  393. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  394. <if test="rectId != null and rectId != ''">RECT_ID = #{rectId},</if>
  395. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  396. <if test="listType != null">LIST_TYPE = #{listType},</if>
  397. <if test="listId != null">LIST_ID = #{listId},</if>
  398. <if test="groupId != null">GROUP_ID = #{groupId},</if>
  399. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  400. <if test="persNm != null">PERS_NM = #{persNm},</if>
  401. <if test="intm != null">INTM = #{intm},</if>
  402. <if test="spclId != null and spclId != ''">SPCL_ID = #{spclId},</if>
  403. <if test="spclNm != null">SPCL_NM = #{spclNm},</if>
  404. <if test="spclRvwOptn != null">SPCL_RVW_OPTN = #{spclRvwOptn},</if>
  405. <if test="spclTm != null">SPCL_TM = #{spclTm},</if>
  406. <if test="uptm != null">UPTM = #{uptm},</if>
  407. <if test="note != null and note != ''">NOTE = #{note},</if>
  408. <if test="dataStat != null and dataStat != ''">data_Stat = #{dataStat},</if>
  409. <if test="reasonState != null and reasonState != ''">REASON_STATE = #{reasonState},</if>
  410. <if test="pblmReasonDetail != null and pblmReasonDetail != ''">PBLM_REASON_DETAIL = #{pblmReasonDetail},</if>
  411. <if test="pblmMeasure != null and pblmMeasure != ''">PBLM_MEASURE = #{pblmMeasure},</if>
  412. SN = #{sn},
  413. </trim>
  414. <include refid="page_where"/>
  415. </update>
  416. <!-- 其他自定义SQL -->
  417. <select id="getPblmCountByYear" resultType="java.lang.Integer"
  418. parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam">
  419. select case when count(*) is NULL then 0 else count(*) end from TAC_PBLM_INFO t left join
  420. TAC_INSP_YEAR_BATCH_OBJ o on t.obj_id = o.id where o.id is not null and o.year = #{year}
  421. <if test="persId != null and persId != ''">
  422. and o.group_id in (select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID = (select b.id from
  423. TAC_WORKER_B b where b.login_id = #{persId})
  424. )
  425. </if>
  426. <include refid="choseSql"/>
  427. </select>
  428. <select id="getMaxSn" resultType="String">
  429. SELECT Max(sn) from TAC_PBLM_INFO t where 1=1
  430. <include refid="choseSql"/>
  431. </select>
  432. <sql id="choseSql">
  433. <choose>
  434. <when test="province !=null and province !=''">
  435. and t.province=#{province}
  436. </when>
  437. <otherwise>
  438. and t.province is null
  439. </otherwise>
  440. </choose>
  441. </sql>
  442. <select id="countPblmInfoByType" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  443. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  444. select PBLM_PASI as code,count(*) as count from (
  445. select * from TAC_PBLM_INFO t left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id left join
  446. TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  447. where r.id is not null and t.pblm_pasi is not null
  448. <include refid="choseSql"/>
  449. <if test="year != null">
  450. and o.year = #{year}
  451. </if>
  452. <if test="batch != null">
  453. and o.batch = #{batch}
  454. </if>
  455. <if test="type != null and type != ''">
  456. and r.type = #{type}
  457. </if>
  458. <if test="isPoverty != null and isPoverty != ''">
  459. and r.IS_POVERTY = #{isPoverty}
  460. </if>
  461. <if test="state != null and state != ''">
  462. and r.state = #{state}
  463. </if>
  464. <if test="searchStat != null and searchStat != ''">
  465. and t.RGSTR_ID like '%_${searchStat}'
  466. </if>
  467. )w group by PBLM_PASI
  468. </select>
  469. <select id="countPblmInfoBySub" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  470. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  471. select t.sub_id as code,t.pblm_pasi as name, count(*) as count from (
  472. 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
  473. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  474. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  475. where t.pblm_pasi is not null and s.id is not null and s.sub_id is not null
  476. <if test="year != null">
  477. and o.year = #{year}
  478. </if>
  479. <if test="batch != null">
  480. and o.batch = #{batch}
  481. </if>
  482. <if test="type != null and type != ''">
  483. and r.type = #{type}
  484. </if>
  485. <if test="isPoverty != null and isPoverty != ''">
  486. and r.IS_POVERTY = #{isPoverty}
  487. </if>
  488. <if test="state != null and state != ''">
  489. and r.state = #{state}
  490. </if>
  491. <if test="searchStat != null and searchStat != ''">
  492. and t.RGSTR_ID like '%_${searchStat}'
  493. </if>
  494. <if test="rgstrId != null and rgstrId !=''">
  495. and t.RGSTR_ID like '%_${rgstrId}'
  496. </if>
  497. ) t group by t.sub_id,t.pblm_pasi
  498. </select>
  499. <select id="countPblmInfoBySubNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  500. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  501. select t.SYS_TYPE as code,t.pblm_pasi as name, count(*) as count from (
  502. select distinct t.id,t.pblm_pasi,os.SYS_TYPE from TAC_PBLM_INFO t left join
  503. 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
  504. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id left join tac_obj_subject os on s.sub_id = os.ID
  505. where t.pblm_pasi is not null and s.id is not null and s.sub_id is not null
  506. <include refid="choseSql"/>
  507. <if test="year != null">
  508. and o.year =#{year}
  509. </if>
  510. <if test="batch != null">
  511. and o.batch = #{batch}
  512. </if>
  513. <if test="type != null and type != ''">
  514. and r.type = #{type}
  515. </if>
  516. <if test="isPoverty != null and isPoverty != ''">
  517. and r.IS_POVERTY = #{isPoverty}
  518. </if>
  519. <if test="state != null and state != ''">
  520. and r.state = #{state}
  521. </if>
  522. <if test="searchStat != null and searchStat != ''">
  523. and t.RGSTR_ID like '%_${searchStat}'
  524. </if>
  525. <if test="rgstrId != null and rgstrId !=''">
  526. and length(t.RGSTR_ID)=32
  527. </if>
  528. ) t group by t.SYS_TYPE,t.pblm_pasi
  529. </select>
  530. <select id="countPblmInfoByAdCode" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  531. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  532. select AD_Code as code,concat('(',AD_Name,')',name) as name,count(*) as count,PBLM_PASI AS pblmPasi from (
  533. 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
  534. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  535. left join att_ad_x_base b on r.ad_code = b.ad_code
  536. where r.id is not null and t.pblm_pasi is not null
  537. <if test="year != null">
  538. and o.year = #{year}
  539. </if>
  540. <if test="batch != null">
  541. and o.batch = #{batch}
  542. </if>
  543. <if test="type != null and type != ''">
  544. and r.type = #{type}
  545. </if>
  546. <if test="isPoverty != null and isPoverty != ''">
  547. and r.IS_POVERTY = #{isPoverty}
  548. </if>
  549. <if test="state != null and state != ''">
  550. and r.state = #{state}
  551. </if>
  552. <if test="searchStat != null and searchStat != ''">
  553. and t.RGSTR_ID like '%_${searchStat}'
  554. </if>
  555. <if test="rgstrId != null and rgstrId !=''">
  556. and t.RGSTR_ID like '%_${rgstrId}'
  557. </if>
  558. ) w group by AD_Code,AD_Name,name,PBLM_PASI order by COUNT desc
  559. </select>
  560. <select id="countPblmInfoByAdCodeNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  561. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  562. select AD_Code as code, PBLM_PASI AS name, count(*) as count
  563. from (
  564. select t.*, a.ad_code, a.ad_name
  565. from TAC_PBLM_INFO t
  566. left join TAC_PAWP_RGSTR r on t.obj_id = r.obj_id
  567. left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  568. left join TAC_INSP_YEAR_BATCH_AREA a on a.GROUP_ID=o.GROUP_ID
  569. where r.id is not null
  570. and t.pblm_pasi is not null
  571. <include refid="choseSql"/>
  572. <if test="year != null">
  573. and o.year = #{year}
  574. </if>
  575. <if test="batch != null">
  576. and o.batch = #{batch}
  577. </if>
  578. <if test="type != null and type != ''">
  579. and r.type = #{type}
  580. </if>
  581. <if test="isPoverty != null and isPoverty != ''">
  582. and r.IS_POVERTY = #{isPoverty}
  583. </if>
  584. <if test="state != null and state != ''">
  585. and r.state = #{state}
  586. </if>
  587. <if test="searchStat != null and searchStat != ''">
  588. and t.RGSTR_ID like '%_${searchStat}'
  589. </if>
  590. <if test="rgstrId != null and rgstrId !=''">
  591. and length(t.RGSTR_ID)=32
  592. </if>
  593. ) w group by AD_Code, AD_Name,PBLM_PASI order by COUNT desc
  594. </select>
  595. <select id="countPblmInfoByObjTypeNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  596. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  597. WITH O AS (
  598. SELECT B.TYPE AS NAME,
  599. COUNT(T.ID) PBLM_SIZE
  600. FROM TAC_INSP_YEAR_BATCH_OBJ O
  601. JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
  602. LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
  603. LEFT JOIN (SELECT * FROM TAC_PBLM_INFO) T ON T.RGSTR_ID = R.ID
  604. WHERE T.PBLM_PASI IS NOT NULL
  605. <include refid="choseSql"/>
  606. <if test="year != null">
  607. and O.year = #{year}
  608. </if>
  609. <if test="batch != null">
  610. and O.batch = #{batch}
  611. </if>
  612. <if test="rgstrId != null and rgstrId !=''">
  613. and length(t.RGSTR_ID)=32
  614. </if>
  615. GROUP BY B.TYPE
  616. )
  617. SELECT
  618. name, SUM(PBLM_SIZE) AS "count"
  619. FROM O
  620. WHERE name is not null
  621. GROUP BY name
  622. ORDER BY name
  623. </select>
  624. <select id="countPblmInfoByStb" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  625. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  626. SELECT
  627. ( CASE WHEN count( * ) IS NULL THEN 0 ELSE count( * ) END ) AS count,
  628. (case when spfsnlType='质量实体' then '工程质量'
  629. when spfsnlType='质量行为' then '工程质量'
  630. when spfsnlType='安全管理' then '工程安全'
  631. else spfsnlType end ) 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. ) w
  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. (case when spfsnlType='质量实体' then '工程质量'
  690. when spfsnlType='质量行为' then '工程质量'
  691. when spfsnlType='安全管理' then '工程安全'
  692. else spfsnlType end ) AS name ,
  693. pblmType,
  694. pblmPasi AS code
  695. FROM
  696. (
  697. SELECT
  698. tb.SPFSNL_TYPE AS spfsnlType,
  699. t.PBLM_PASI AS pblmPasi,
  700. tb.pblm_type AS pblmType,
  701. t.PBLM_NM
  702. FROM
  703. TAC_PBLM_INFO t
  704. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  705. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  706. WHERE
  707. o.id IS NOT NULL
  708. AND t.pblm_pasi IS NOT NULL
  709. AND tb.id IS NOT NULL
  710. <include refid="choseSql"/>
  711. <if test="year != null">and o.year = #{year}
  712. </if>
  713. <if test="batch != null">and o.batch = #{batch}
  714. </if>
  715. <if test="type != null and type != ''">and r.type = #{type}
  716. </if>
  717. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  718. </if>
  719. <if test="state != null and state != ''">
  720. and r.state = #{state}
  721. </if>
  722. <if test="searchStat != null and searchStat != ''">
  723. and t.RGSTR_ID like '%_${searchStat}'
  724. </if>
  725. <if test="objId != null and objId != ''">
  726. and t.obj_id = #{objId}
  727. </if>
  728. <if test="rgstrId != null and rgstrId !=''">
  729. and length(t.RGSTR_ID)=32
  730. </if>
  731. ) w
  732. WHERE
  733. spfsnlType NOT IN ( '质量管理—实体质量', '计划管理' )
  734. GROUP BY
  735. spfsnlType,
  736. pblmType,
  737. pblmPasi
  738. ORDER BY
  739. pblmType
  740. </select>
  741. <select id="countPblmInfoByCase" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  742. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  743. select count(*) as count,t.if_case_pblm as code from (
  744. 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
  745. 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 =
  746. r.obj_id
  747. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  748. where 1=1
  749. <include refid="choseSql"/>
  750. <if test="year != null">
  751. and o.year = #{year}
  752. </if>
  753. <if test="batch != null">
  754. and o.batch = #{batch}
  755. </if>
  756. <if test="type != null and type != ''">
  757. and r.type = #{type}
  758. </if>
  759. <if test="isPoverty != null and isPoverty != ''">
  760. and r.IS_POVERTY = #{isPoverty}
  761. </if>
  762. <if test="state != null and state != ''">
  763. and r.state = #{state}
  764. </if>
  765. <if test="searchStat != null and searchStat != ''">
  766. and t.RGSTR_ID like '%_${searchStat}'
  767. </if>
  768. ) t group by t.if_case_pblm
  769. </select>
  770. <select id="countPblmInfoByQlttv" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  771. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  772. select count(*),t.PBLM_QLTTV_CD as code,t.PBLM_QLTTV_NM as name from (
  773. 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
  774. = r.obj_id left join TAC_INSP_YEAR_BATCH_OBJ o on o.id = r.obj_id
  775. left join TAC_PBLM_SUBJECT s on t.id = s.pblm_id
  776. where t.PBLM_QLTTV_NM is not null
  777. <include refid="choseSql"/>
  778. <if test="year != null">
  779. and o.year = #{year}
  780. </if>
  781. <if test="batch != null">
  782. and o.batch = #{batch}
  783. </if>
  784. <if test="type != null and type != ''">
  785. and r.type = #{type}
  786. </if>
  787. <if test="isPoverty != null and isPoverty != ''">
  788. and r.IS_POVERTY = #{isPoverty}
  789. </if>
  790. <if test="state != null and state != ''">
  791. and r.state = #{state}
  792. </if>
  793. <if test="searchStat != null and searchStat != ''">
  794. and t.RGSTR_ID like '%_${searchStat}'
  795. </if>
  796. ) t group by t.PBLM_QLTTV_CD,t.PBLM_QLTTV_NM
  797. </select>
  798. <select id="findListByYearBatch" resultMap="tacPblmInfoResultMap">
  799. select t.*,r.name,r.location,r.ad_code from tac_pblm_info t ,tac_pawp_rgstr r where substr(t.rgstr_id,1,32)=r.id and length(t.rgstr_id) &gt;32
  800. and r.id in (
  801. select B.Id from TAC_INSP_YEAR_BATCH_OBJ A
  802. JOIN TAC_PAWP_RGSTR B
  803. ON A.ID=B.OBJ_ID
  804. WHERE B.STATE=#{state}
  805. and a.year=#{year}
  806. and A.BATCH=#{batch}
  807. )
  808. and t.rgstr_id like '%_${state}' and r.ad_code like '${orgId}%'
  809. </select>
  810. <select id="countIfCasePblm" resultType="java.lang.Integer">
  811. SELECT
  812. count(*)
  813. FROM
  814. TAC_PBLM_INFO t
  815. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  816. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  817. WHERE
  818. t.pblm_pasi IS NOT NULL
  819. AND tb.id IS NOT NULL
  820. <if test="year != null">and o.year = #{year}
  821. </if>
  822. <if test="batch != null">and o.batch = #{batch}
  823. </if>
  824. <if test="type != null and type != ''">and r.type = #{type}
  825. </if>
  826. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  827. </if>
  828. <if test="state != null and state != ''">
  829. and r.state = #{state}
  830. </if>
  831. <if test="searchStat != null and searchStat != ''">
  832. and t.RGSTR_ID like '%_${searchStat}'
  833. </if>
  834. <if test="objId != null and objId != ''">
  835. and t.obj_id = #{objId}
  836. </if>
  837. <choose>
  838. <when test="rgstrId != null and rgstrId !=''">
  839. and t.RGSTR_ID like '%_${rgstrId}'
  840. </when>
  841. <otherwise>
  842. and length(t.RGSTR_ID)=32
  843. </otherwise>
  844. </choose>
  845. <choose>
  846. <when test="ifCasePblm == 1">
  847. and t.IF_CASE_PBLM = 1
  848. </when>
  849. <otherwise>
  850. and (t.IF_CASE_PBLM = 0 or t.IF_CASE_PBLM is null)
  851. </otherwise>
  852. </choose>
  853. </select>
  854. <select id="countIfCasePblmNew" resultType="java.lang.Integer">
  855. SELECT
  856. count(*)
  857. FROM
  858. TAC_PBLM_INFO t
  859. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  860. LEFT JOIN TAC_OBJ_PBLMSTB tb ON tb.id = t.PBLMSTD_ID
  861. WHERE
  862. t.pblm_pasi IS NOT NULL
  863. AND tb.id IS NOT NULL
  864. <include refid="choseSql"/>
  865. <if test="year != null">and o.year = #{year}
  866. </if>
  867. <if test="batch != null">and o.batch = #{batch}
  868. </if>
  869. <if test="type != null and type != ''">and r.type = #{type}
  870. </if>
  871. <if test="isPoverty != null and isPoverty != ''">and r.IS_POVERTY = #{isPoverty}
  872. </if>
  873. <if test="state != null and state != ''">
  874. and r.state = #{state}
  875. </if>
  876. <if test="searchStat != null and searchStat != ''">
  877. and t.RGSTR_ID like '%_${searchStat}'
  878. </if>
  879. <if test="objId != null and objId != ''">
  880. and t.obj_id = #{objId}
  881. </if>
  882. <if test="rgstrId != null and rgstrId !=''">
  883. and length(t.RGSTR_ID)=32
  884. </if>
  885. <choose>
  886. <when test="ifCasePblm == 1">
  887. and t.IF_CASE_PBLM = 1
  888. </when>
  889. <otherwise>
  890. and (t.IF_CASE_PBLM = 0 or t.IF_CASE_PBLM is null)
  891. </otherwise>
  892. </choose>
  893. </select>
  894. <select id="countPblmInfoByQt" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  895. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  896. SELECT
  897. count( * ) AS count,
  898. a.showName,
  899. a.name
  900. FROM
  901. (
  902. SELECT
  903. t.LIST_TYPE as name,
  904. tp.PBLM_TYPE_DESC AS showName
  905. FROM
  906. TAC_PBLM_INFO t
  907. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  908. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  909. WHERE
  910. t.PBLMSTD_ID IS NOT NULL
  911. AND tp.id IS NOT NULL
  912. and tp.PBLM_TYPE_DESC is not null
  913. <if test="year !=null">
  914. and o.year = #{year}
  915. </if>
  916. <if test="batch != null">
  917. and o.batch = #{batch}
  918. </if>
  919. <if test="stbClaName != null and stbClaName != ''">
  920. and t.LIST_TYPE = #{stbClaName}
  921. </if>
  922. <if test="rgstrId != null and rgstrId !=''">
  923. and t.RGSTR_ID like '_${rgstrId}%'
  924. </if>
  925. ) A
  926. GROUP BY
  927. a.showName,
  928. a.name
  929. ORDER BY
  930. a.showName
  931. </select>
  932. <select id="countPblmInfoByQtNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  933. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  934. SELECT
  935. count( * ) AS count,
  936. a.showName,
  937. a.name
  938. FROM
  939. (
  940. SELECT
  941. t.LIST_TYPE as name,
  942. tp.PBLM_TYPE_DESC AS showName
  943. FROM
  944. TAC_PBLM_INFO t
  945. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  946. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  947. WHERE
  948. t.PBLMSTD_ID IS NOT NULL
  949. AND tp.id IS NOT NULL
  950. and tp.PBLM_TYPE_DESC is not null
  951. and tp.PBLM_TYPE_DESC !='其他'
  952. <include refid="choseSql"/>
  953. <if test="year !=null">
  954. and o.year = #{year}
  955. </if>
  956. <if test="batch != null">
  957. and o.batch = #{batch}
  958. </if>
  959. <if test="stbClaName != null and stbClaName != ''">
  960. and t.LIST_TYPE = #{stbClaName}
  961. </if>
  962. <if test="rgstrId != null and rgstrId !=''">
  963. and length(t.RGSTR_ID)=32
  964. </if>
  965. ) A
  966. GROUP BY
  967. a.showName,
  968. a.name
  969. ORDER BY
  970. a.showName
  971. </select>
  972. <select id="countPblmInfoObjByQt" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  973. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  974. SELECT
  975. count( * ) AS count,
  976. a.showName,
  977. a.name
  978. FROM
  979. (
  980. SELECT
  981. DISTINCT
  982. t.PBLMSTD_ID,
  983. tp.PBLM_TYPE_DESC AS showName,
  984. t.LIST_TYPE as name
  985. FROM
  986. TAC_PBLM_INFO t
  987. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  988. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  989. WHERE
  990. t.PBLMSTD_ID IS NOT NULL
  991. AND tp.id IS NOT NULL
  992. and tp.PBLM_TYPE_DESC is not null
  993. <if test="year !=null">
  994. and o.year = #{year}
  995. </if>
  996. <if test="batch != null">
  997. and o.batch = #{batch}
  998. </if>
  999. <if test="stbClaName != null and stbClaName != ''">
  1000. and t.LIST_TYPE = #{stbClaName}
  1001. </if>
  1002. <if test="rgstrId != null and rgstrId !=''">
  1003. and t.RGSTR_ID like '_${rgstrId}%'
  1004. </if>
  1005. ) A
  1006. GROUP BY
  1007. a.name,a.showName
  1008. ORDER BY
  1009. a.showName
  1010. </select>
  1011. <select id="countPblmInfoObjByQtNew" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  1012. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1013. SELECT
  1014. count( * ) AS count,
  1015. a.showName,
  1016. a.name
  1017. FROM
  1018. (
  1019. SELECT
  1020. DISTINCT
  1021. t.PBLMSTD_ID,
  1022. tp.PBLM_TYPE_DESC AS showName,
  1023. t.LIST_TYPE as name
  1024. FROM
  1025. TAC_PBLM_INFO t
  1026. LEFT JOIN TAC_OBJ_PBLMSTB tp ON t.PBLMSTD_ID = tp.id
  1027. LEFT JOIN TAC_INSP_YEAR_BATCH_OBJ o ON o.id = t.obj_id
  1028. WHERE
  1029. t.PBLMSTD_ID IS NOT NULL
  1030. AND tp.id IS NOT NULL
  1031. and tp.PBLM_TYPE_DESC is not null
  1032. and tp.PBLM_TYPE_DESC !='其他'
  1033. <include refid="choseSql"/>
  1034. <if test="year !=null">
  1035. and o.year = #{year}
  1036. </if>
  1037. <if test="batch != null">
  1038. and o.batch = #{batch}
  1039. </if>
  1040. <if test="stbClaName != null and stbClaName != ''">
  1041. and t.LIST_TYPE = #{stbClaName}
  1042. </if>
  1043. <if test="rgstrId != null and rgstrId !=''">
  1044. and length(t.RGSTR_ID)=32
  1045. </if>
  1046. ) A
  1047. GROUP BY
  1048. a.name,a.showName
  1049. ORDER BY
  1050. a.showName
  1051. </select>
  1052. <select id="countAdNameByAdAdCade" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam"
  1053. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1054. select a.AD_CODE as code, a.AD_NAME as name, count(*) as count
  1055. from att_ad_x_base a
  1056. where a.GUID is not null
  1057. and a.AD_CODE in (${adCode})
  1058. group by a.AD_CODE, a.AD_NAME
  1059. </select>
  1060. <select id="countPblmInfoByObj" parameterType="cn.com.goldenwater.dcproj.param.TacPblmInfoParam"
  1061. resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  1062. SELECT
  1063. a.ID as rgstrId,
  1064. a.name,
  1065. count(*) AS count
  1066. FROM
  1067. (
  1068. SELECT r.ID, r.NAME
  1069. FROM TAC_INSP_YEAR_BATCH_OBJ o
  1070. join TAC_PAWP_RGSTR r on o.id = r.obj_id
  1071. join TAC_PBLM_INFO t on t.obj_id = r.obj_id
  1072. <where>
  1073. <include refid="choseSql"/>
  1074. <if test="year !=null">and o.year = #{year}</if>
  1075. <if test="batch != null">and o.batch = #{batch}</if>
  1076. <if test="rgstrId != null and rgstrId !=''">and length(t.RGSTR_ID)=32</if>
  1077. <if test="adCode != null and adCode != ''">and r.AD_CODE like concat('%' , substr(#{adCode},1,4) , '%')</if>
  1078. </where>
  1079. ) A
  1080. GROUP BY a.name,a.ID
  1081. </select>
  1082. </mapper>