ChkSafeProdLedgerDao.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  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.ChkSafeProdLedgerDao">
  4. <resultMap id="BaseResultMap" type="cn.com.goldenwater.dcproj.model.ChkSafeProdLedger">
  5. <id column="ID" jdbcType="VARCHAR" property="id" />
  6. <result column="ORG_ID" jdbcType="VARCHAR" property="orgId" />
  7. <result column="AD_CODE" jdbcType="VARCHAR" property="adCode" />
  8. <result column="AD_NAME" jdbcType="VARCHAR" property="adName" />
  9. <result column="CHK_MNTH" jdbcType="DATE" property="chkMnth" />
  10. <result column="CHK_PROJ_TYPE" jdbcType="VARCHAR" property="chkProjType" />
  11. <result column="CHK_DTTM" jdbcType="DATE" property="chkDttm" />
  12. <result column="LEAD_DEP" jdbcType="VARCHAR" property="leadDep" />
  13. <result column="LEAD_DEP_RESP_PERS" jdbcType="VARCHAR" property="leadDepRespPers" />
  14. <result column="CHK_ORG" jdbcType="VARCHAR" property="chkOrg" />
  15. <result column="CHK_ORG_RESP_PERS" jdbcType="VARCHAR" property="chkOrgRespPers" />
  16. <result column="CHK_ORG_RESP_PERS_MOBI" jdbcType="VARCHAR" property="chkOrgRespPersMobi" />
  17. <result column="CHK_RESULT" jdbcType="VARCHAR" property="chkResult" />
  18. <result column="CHK_DGER_PBLM" property="chkDgerPblm" />
  19. <result column="CHK_HAND_SUGG" jdbcType="VARCHAR" property="chkHandSugg" />
  20. <result column="CHK_HAND_EDTM" jdbcType="DATE" property="chkHandEdtm" />
  21. <result column="CHK_RECT_IMPL_INFO" jdbcType="VARCHAR" property="chkRectImplInfo" />
  22. <result column="CHK_RECT_IMPL_INFO_DESC" jdbcType="VARCHAR" property="chkRectImplInfoDesc" />
  23. <result column="CHK_ACCE_TM" jdbcType="DATE" property="chkAcceTm" />
  24. <result column="CHK_ACCE_PERS" jdbcType="VARCHAR" property="chkAccePers" />
  25. <result column="CHK_TOTAL_PBLM_NUM" jdbcType="DECIMAL" property="chkTotalPblmNum" />
  26. <result column="CHK_TOTAL_RECT_NUM" jdbcType="DECIMAL" property="chkTotalRectNum" />
  27. <result column="CHK_FILL_UNIT" property="chkFillUnit" />
  28. <result column="CHK_SUBMIT_DEPT" jdbcType="VARCHAR" property="chkSubmitDept" />
  29. <result column="CHK_SUBMIT_DTTM" jdbcType="DATE" property="chkSubmitDttm" />
  30. <result column="FILL_REPO_STAT" jdbcType="VARCHAR" property="fillRepoStat" />
  31. <result column="NOTE" jdbcType="VARCHAR" property="note" />
  32. <result column="PERS_ID" jdbcType="VARCHAR" property="persId" />
  33. <result column="INTM" jdbcType="DATE" property="intm" />
  34. <result column="UPTM" jdbcType="DATE" property="uptm" />
  35. <result column="DATA_STAT" jdbcType="VARCHAR" property="dataStat" />
  36. </resultMap>
  37. <sql id="Base_Column_List">
  38. ID, ORG_ID, AD_CODE, CHK_MNTH, CHK_PROJ_TYPE, CHK_DTTM, LEAD_DEP, LEAD_DEP_RESP_PERS, CHK_ORG, CHK_ORG_RESP_PERS,
  39. CHK_ORG_RESP_PERS_MOBI, CHK_RESULT, CHK_DGER_PBLM, CHK_HAND_SUGG, CHK_HAND_EDTM, CHK_RECT_IMPL_INFO, CHK_RECT_IMPL_INFO_DESC,
  40. CHK_ACCE_TM, CHK_ACCE_PERS, CHK_TOTAL_PBLM_NUM, CHK_TOTAL_RECT_NUM, CHK_FILL_UNIT, CHK_SUBMIT_DEPT,
  41. CHK_SUBMIT_DTTM, FILL_REPO_STAT, NOTE, PERS_ID, INTM, UPTM, DATA_STAT
  42. </sql>
  43. <sql id="page_where">
  44. <trim prefix="where" prefixOverrides="and | or ">
  45. <if test="id != null and id != ''">
  46. and cspl.ID = #{id}
  47. </if>
  48. <if test="orgId != null and orgId != ''">
  49. and cspl.ORG_ID = #{orgId}
  50. </if>
  51. <if test="adCode != null and adCode != ''">
  52. and cspl.AD_CODE like '${adCode}%'
  53. </if>
  54. <if test="chkMnth != null">
  55. <!-- and to_char(cspl.CHK_MNTH,'yyyy-MM') = to_char(#{chkMnth},'yyyy-MM')-->
  56. and to_char(cspl.CHK_DTTM,'yyyy-MM') = to_char(#{chkMnth},'yyyy-MM')
  57. </if>
  58. <if test='chkProjType != null and "" != chkProjType'>
  59. and cspl.CHK_PROJ_TYPE = #{chkProjType}
  60. </if>
  61. <if test="chkDttm != null">
  62. and to_char(cspl.CHK_DTTM,'yyyy-MM-dd') = to_char(#{chkDttm},'yyyy-MM-dd')
  63. </if>
  64. <if test="leadDep != null and leadDep != ''">
  65. and cspl.LEAD_DEP LIKE '%${leadDep}%'
  66. </if>
  67. <if test="leadDepRespPers != null and leadDepRespPers != ''">
  68. and cspl.LEAD_DEP_RESP_PERS = #{leadDepRespPers,jdbcType=VARCHAR}
  69. </if>
  70. <if test="chkOrg != null and chkOrg != ''">
  71. and cspl.CHK_ORG LIKE '%${chkOrg}%'
  72. </if>
  73. <if test="chkOrgRespPers != null and chkOrgRespPers != ''">
  74. and cspl.CHK_ORG_RESP_PERS = #{chkOrgRespPers,jdbcType=VARCHAR}
  75. </if>
  76. <if test="chkOrgRespPersMobi != null and chkOrgRespPersMobi != ''">
  77. and cspl.CHK_ORG_RESP_PERS_MOBI = #{chkOrgRespPersMobi,jdbcType=VARCHAR}
  78. </if>
  79. <if test="chkResult != null and chkResult != ''">
  80. and cspl.CHK_RESULT = #{chkResult,jdbcType=VARCHAR}
  81. </if>
  82. <if test="chkDgerPblm != null and chkDgerPblm != ''">
  83. and cspl.CHK_DGER_PBLM like '%${chkDgerPblm}%'
  84. </if>
  85. <if test="chkHandSugg != null and chkHandSugg != ''">
  86. and cspl.CHK_HAND_SUGG = #{chkHandSugg,jdbcType=VARCHAR}
  87. </if>
  88. <if test="chkHandEdtm != null">
  89. and cspl.CHK_HAND_EDTM = #{chkHandEdtm,jdbcType=DATE}
  90. </if>
  91. <if test="chkRectImplInfo != null and chkRectImplInfo != ''">
  92. and cspl.CHK_RECT_IMPL_INFO = #{chkRectImplInfo,jdbcType=VARCHAR}
  93. </if>
  94. <if test="chkRectImplInfoDesc != null and chkRectImplInfoDesc != ''">
  95. and cspl.CHK_RECT_IMPL_INFO_DESC like '%${chkRectImplInfoDesc}%'
  96. </if>
  97. <if test="chkAcceTm != null">
  98. and cspl.CHK_ACCE_TM = #{chkAcceTm,jdbcType=DATE}
  99. </if>
  100. <if test="chkAccePers != null and chkAccePers != ''">
  101. and cspl.CHK_ACCE_PERS = #{chkAccePers,jdbcType=VARCHAR}
  102. </if>
  103. <if test="chkTotalPblmNum != null">
  104. and cspl.CHK_TOTAL_PBLM_NUM = #{chkTotalPblmNum,jdbcType=DECIMAL}
  105. </if>
  106. <if test="chkTotalRectNum != null">
  107. and cspl.CHK_TOTAL_RECT_NUM = #{chkTotalRectNum,jdbcType=DECIMAL}
  108. </if>
  109. <if test="chkFillUnit != null and chkFillUnit != ''">
  110. and cspl.CHK_FILL_UNIT LIKE '%${chkFillUnit}%'
  111. </if>
  112. <if test="chkSubmitDept != null and chkSubmitDept != ''">
  113. and cspl.CHK_SUBMIT_DEPT LIKE '%${chkSubmitDept}%'
  114. </if>
  115. <if test="chkSubmitDttm != null">
  116. and cspl.CHK_SUBMIT_DTTM = #{chkSubmitDttm,jdbcType=DATE}
  117. </if>
  118. <if test="fillRepoStat != null and fillRepoStat != ''">
  119. and cspl.FILL_REPO_STAT = #{fillRepoStat,jdbcType=VARCHAR}
  120. </if>
  121. <if test="note != null and note != ''">
  122. and cspl.NOTE = #{note,jdbcType=VARCHAR}
  123. </if>
  124. <if test="persId != null and persId != ''">
  125. and cspl.PERS_ID = #{persId,jdbcType=VARCHAR}
  126. </if>
  127. <if test="intm != null">
  128. and cspl.INTM = #{intm,jdbcType=DATE}
  129. </if>
  130. <if test="uptm != null">
  131. and cspl.UPTM = #{uptm,jdbcType=DATE}
  132. </if>
  133. and cspl.DATA_STAT = '0'
  134. </trim>
  135. </sql>
  136. <select id="findList" resultMap="BaseResultMap">
  137. select cspl.*,aab.AD_FULL_NAME AD_NAME from CHK_SAFE_PROD_LEDGER cspl left join ATT_AD_BASE aab on cspl.AD_CODE = aab.AD_CODE <include refid="page_where" />
  138. order by cspl.CHK_DTTM desc , cspl.AD_CODE asc , to_number(cspl.CHK_PROJ_TYPE) asc, cspl.INTM desc
  139. </select>
  140. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  141. select
  142. <include refid="Base_Column_List" />
  143. from CHK_SAFE_PROD_LEDGER
  144. where ID = #{id,jdbcType=VARCHAR}
  145. </select>
  146. <delete id="delete" parameterType="java.lang.String">
  147. update CHK_SAFE_PROD_LEDGER set DATA_STAT = '9'
  148. where ID = #{id,jdbcType=VARCHAR}
  149. </delete>
  150. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeProdLedger">
  151. insert into CHK_SAFE_PROD_LEDGER (ID, ORG_ID, AD_CODE,
  152. CHK_MNTH, CHK_PROJ_TYPE, CHK_DTTM, LEAD_DEP,
  153. LEAD_DEP_RESP_PERS, CHK_ORG, CHK_ORG_RESP_PERS,
  154. CHK_ORG_RESP_PERS_MOBI, CHK_RESULT, CHK_DGER_PBLM,CHK_HAND_SUGG,
  155. CHK_HAND_EDTM, CHK_RECT_IMPL_INFO, CHK_RECT_IMPL_INFO_DESC, CHK_ACCE_TM,
  156. CHK_ACCE_PERS, CHK_TOTAL_PBLM_NUM, CHK_TOTAL_RECT_NUM, CHK_FILL_UNIT,
  157. CHK_SUBMIT_DEPT, CHK_SUBMIT_DTTM, FILL_REPO_STAT,
  158. NOTE, PERS_ID, INTM, UPTM,
  159. DATA_STAT)
  160. values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{adCode,jdbcType=VARCHAR},
  161. #{chkMnth,jdbcType=DATE}, #{chkProjType}, #{chkDttm,jdbcType=DATE}, #{leadDep,jdbcType=VARCHAR},
  162. #{leadDepRespPers,jdbcType=VARCHAR}, #{chkOrg,jdbcType=VARCHAR}, #{chkOrgRespPers,jdbcType=VARCHAR},
  163. #{chkOrgRespPersMobi,jdbcType=VARCHAR}, #{chkResult,jdbcType=VARCHAR},#{chkDgerPblm,jdbcType=VARCHAR}, #{chkHandSugg,jdbcType=VARCHAR},
  164. #{chkHandEdtm,jdbcType=DATE}, #{chkRectImplInfo,jdbcType=VARCHAR}, #{chkRectImplInfoDesc,jdbcType=VARCHAR}, #{chkAcceTm,jdbcType=DATE},
  165. #{chkAccePers,jdbcType=VARCHAR}, #{chkTotalPblmNum,jdbcType=DECIMAL}, #{chkTotalRectNum,jdbcType=DECIMAL},
  166. #{chkFillUnit,jdbcType=VARCHAR},#{chkSubmitDept,jdbcType=VARCHAR}, #{chkSubmitDttm,jdbcType=DATE}, #{fillRepoStat,jdbcType=VARCHAR},
  167. #{note,jdbcType=VARCHAR}, #{persId,jdbcType=VARCHAR}, #{intm,jdbcType=DATE}, #{uptm,jdbcType=DATE},
  168. #{dataStat,jdbcType=VARCHAR})
  169. </insert>
  170. <insert id="insertBatchFile" parameterType="java.util.List" useGeneratedKeys="false">
  171. insert into CHK_SAFE_PROD_LEDGER
  172. (ID, ORG_ID, AD_CODE,CHK_MNTH, CHK_PROJ_TYPE, CHK_DTTM, LEAD_DEP,LEAD_DEP_RESP_PERS, CHK_ORG, CHK_ORG_RESP_PERS,
  173. CHK_ORG_RESP_PERS_MOBI, CHK_RESULT, CHK_DGER_PBLM,CHK_HAND_SUGG, CHK_HAND_EDTM, CHK_RECT_IMPL_INFO,CHK_RECT_IMPL_INFO_DESC, CHK_ACCE_TM,
  174. CHK_ACCE_PERS, CHK_TOTAL_PBLM_NUM, CHK_TOTAL_RECT_NUM, CHK_FILL_UNIT,CHK_SUBMIT_DEPT, CHK_SUBMIT_DTTM, FILL_REPO_STAT,
  175. NOTE, PERS_ID, INTM, UPTM,DATA_STAT)
  176. select t.* from (
  177. <foreach item="item" index="index" collection="list" separator="union all">
  178. select #{item.id} ,#{item.orgId} ,#{item.adCode},#{item.chkMnth},,#{item.chkProjType},#{item.chkDttm},#{item.leadDep},#{item.leadDepRespPers},
  179. #{item.chkOrg},#{item.chkOrgRespPers},#{item.chkOrgRespPersMobi},#{item.chkResult},#{item.chkDgerPblm},#{item.chkHandSugg},#{item.chkHandEdtm},
  180. #{item.chkRectImplInfo},#{item.chkRectImplInfoDesc},#{item.chkAcceTm},#{item.chkAccePers},#{item.chkTotalPblmNum},#{item.chkTotalRectNum},#{item.chkFillUnit},#{item.chkSubmitDept},
  181. #{item.chkSubmitDttm},#{item.fillRepoStat},#{item.note},#{item.persId},#{item.intm},#{item.uptm},#{item.dataStat}
  182. from dual
  183. </foreach>
  184. )t
  185. </insert>
  186. <insert id="insertSelective" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeProdLedger">
  187. insert into CHK_SAFE_PROD_LEDGER
  188. <trim prefix="(" suffix=")" suffixOverrides=",">
  189. <if test="id != null and id != ''">
  190. ID,
  191. </if>
  192. <if test="orgId != null and orgId != ''">
  193. ORG_ID,
  194. </if>
  195. <if test="adCode != null and adCode != ''">
  196. AD_CODE,
  197. </if>
  198. <if test="chkMnth != null">
  199. CHK_MNTH,
  200. </if>
  201. <if test='chkProjType != null and "" != chkProjType'>
  202. CHK_PROJ_TYPE,
  203. </if>
  204. <if test="chkDttm != null">
  205. CHK_DTTM,
  206. </if>
  207. <if test="leadDep != null and leadDep != ''">
  208. LEAD_DEP,
  209. </if>
  210. <if test="leadDepRespPers != null and leadDepRespPers != ''">
  211. LEAD_DEP_RESP_PERS,
  212. </if>
  213. <if test="chkOrg != null and chkOrg != ''">
  214. CHK_ORG,
  215. </if>
  216. <if test="chkOrgRespPers != null and chkOrgRespPers != ''">
  217. CHK_ORG_RESP_PERS,
  218. </if>
  219. <if test="chkOrgRespPersMobi != null and chkOrgRespPersMobi != ''">
  220. CHK_ORG_RESP_PERS_MOBI,
  221. </if>
  222. <if test="chkResult != null and chkResult != ''">
  223. CHK_RESULT,
  224. </if>
  225. <if test="chkDgerPblm != null and chkDgerPblm != ''">
  226. CHK_DGER_PBLM,
  227. </if>
  228. <if test="chkHandSugg != null and chkHandSugg != ''">
  229. CHK_HAND_SUGG,
  230. </if>
  231. <if test="chkHandEdtm != null">
  232. CHK_HAND_EDTM,
  233. </if>
  234. <if test="chkRectImplInfo != null and chkRectImplInfo != ''">
  235. CHK_RECT_IMPL_INFO,
  236. </if>
  237. <if test="chkRectImplInfoDesc != null and chkRectImplInfoDesc != ''">
  238. CHK_RECT_IMPL_INFO_DESC,
  239. </if>
  240. <if test="chkAcceTm != null">
  241. CHK_ACCE_TM,
  242. </if>
  243. <if test="chkAccePers != null and chkAccePers != ''">
  244. CHK_ACCE_PERS,
  245. </if>
  246. <if test="chkTotalPblmNum != null">
  247. CHK_TOTAL_PBLM_NUM,
  248. </if>
  249. <if test="chkTotalRectNum != null">
  250. CHK_TOTAL_RECT_NUM,
  251. </if>
  252. <if test="chkFillUnit != null and chkFillUnit != ''">
  253. CHK_FILL_UNIT,
  254. </if>
  255. <if test="chkSubmitDept != null and chkSubmitDept != ''">
  256. CHK_SUBMIT_DEPT,
  257. </if>
  258. <if test="chkSubmitDttm != null">
  259. CHK_SUBMIT_DTTM,
  260. </if>
  261. <if test="fillRepoStat != null and fillRepoStat != ''">
  262. FILL_REPO_STAT,
  263. </if>
  264. <if test="note != null and note != ''">
  265. NOTE,
  266. </if>
  267. <if test="persId != null and persId != ''">
  268. PERS_ID,
  269. </if>
  270. <if test="intm != null">
  271. INTM,
  272. </if>
  273. <if test="uptm != null">
  274. UPTM,
  275. </if>
  276. <if test="dataStat != null and dataStat != ''">
  277. DATA_STAT,
  278. </if>
  279. </trim>
  280. <trim prefix="values (" suffix=")" suffixOverrides=",">
  281. <if test="id != null and id != ''">
  282. #{id,jdbcType=VARCHAR},
  283. </if>
  284. <if test="orgId != null and orgId != ''">
  285. #{orgId,jdbcType=VARCHAR},
  286. </if>
  287. <if test="adCode != null and adCode != ''">
  288. #{adCode,jdbcType=VARCHAR},
  289. </if>
  290. <if test="chkMnth != null">
  291. #{chkMnth,jdbcType=DATE},
  292. </if>
  293. <if test='chkProjType != null and "" != chkProjType'>
  294. #{chkProjType},
  295. </if>
  296. <if test="chkDttm != null">
  297. #{chkDttm,jdbcType=DATE},
  298. </if>
  299. <if test="leadDep != null and leadDep != ''">
  300. #{leadDep,jdbcType=VARCHAR},
  301. </if>
  302. <if test="leadDepRespPers != null and leadDepRespPers != ''">
  303. #{leadDepRespPers,jdbcType=VARCHAR},
  304. </if>
  305. <if test="chkOrg != null and chkOrg != ''">
  306. #{chkOrg,jdbcType=VARCHAR},
  307. </if>
  308. <if test="chkOrgRespPers != null and chkOrgRespPers != ''">
  309. #{chkOrgRespPers,jdbcType=VARCHAR},
  310. </if>
  311. <if test="chkOrgRespPersMobi != null and chkOrgRespPersMobi != ''">
  312. #{chkOrgRespPersMobi,jdbcType=VARCHAR},
  313. </if>
  314. <if test="chkResult != null and chkResult != ''">
  315. #{chkResult,jdbcType=VARCHAR},
  316. </if>
  317. <if test="chkDgerPblm != null and chkDgerPblm != ''">
  318. #{chkDgerPblm},
  319. </if>
  320. <if test="chkHandSugg != null and chkHandSugg != ''">
  321. #{chkHandSugg,jdbcType=VARCHAR},
  322. </if>
  323. <if test="chkHandEdtm != null">
  324. #{chkHandEdtm,jdbcType=DATE},
  325. </if>
  326. <if test="chkRectImplInfo != null and chkRectImplInfo != ''">
  327. #{chkRectImplInfo,jdbcType=VARCHAR},
  328. </if>
  329. <if test="chkRectImplInfoDesc != null and chkRectImplInfoDesc != ''">
  330. #{chkRectImplInfoDesc,jdbcType=VARCHAR},
  331. </if>
  332. <if test="chkAcceTm != null">
  333. #{chkAcceTm,jdbcType=DATE},
  334. </if>
  335. <if test="chkAccePers != null and chkAccePers != ''">
  336. #{chkAccePers,jdbcType=VARCHAR},
  337. </if>
  338. <if test="chkTotalPblmNum != null">
  339. #{chkTotalPblmNum,jdbcType=DECIMAL},
  340. </if>
  341. <if test="chkTotalRectNum != null">
  342. #{chkTotalRectNum,jdbcType=DECIMAL},
  343. </if>
  344. <if test="chkFillUnit != null and chkFillUnit != ''">
  345. #{chkFillUnit},
  346. </if>
  347. <if test="chkSubmitDept != null and chkSubmitDept != ''">
  348. #{chkSubmitDept,jdbcType=VARCHAR},
  349. </if>
  350. <if test="chkSubmitDttm != null">
  351. #{chkSubmitDttm,jdbcType=DATE},
  352. </if>
  353. <if test="fillRepoStat != null and fillRepoStat != ''">
  354. #{fillRepoStat,jdbcType=VARCHAR},
  355. </if>
  356. <if test="note != null and note != ''">
  357. #{note,jdbcType=VARCHAR},
  358. </if>
  359. <if test="persId != null and persId != ''">
  360. #{persId,jdbcType=VARCHAR},
  361. </if>
  362. <if test="intm != null">
  363. #{intm,jdbcType=DATE},
  364. </if>
  365. <if test="uptm != null">
  366. #{uptm,jdbcType=DATE},
  367. </if>
  368. <if test="dataStat != null and dataStat != ''">
  369. #{dataStat,jdbcType=VARCHAR},
  370. </if>
  371. </trim>
  372. </insert>
  373. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeProdLedger">
  374. update CHK_SAFE_PROD_LEDGER
  375. <set>
  376. <if test="orgId != null and orgId != ''">
  377. ORG_ID = #{orgId,jdbcType=VARCHAR},
  378. </if>
  379. <if test="adCode != null and adCode != ''">
  380. AD_CODE = #{adCode,jdbcType=VARCHAR},
  381. </if>
  382. <if test="chkMnth != null">
  383. CHK_MNTH = #{chkMnth,jdbcType=DATE},
  384. </if>
  385. <if test='chkProjType != null and "" != chkProjType'>
  386. CHK_PROJ_TYPE = #{chkProjType},
  387. </if>
  388. <if test="chkDttm != null">
  389. CHK_DTTM = #{chkDttm,jdbcType=DATE},
  390. </if>
  391. <if test="leadDep != null and leadDep != ''">
  392. LEAD_DEP = #{leadDep,jdbcType=VARCHAR},
  393. </if>
  394. <if test="leadDepRespPers != null and leadDepRespPers != ''">
  395. LEAD_DEP_RESP_PERS = #{leadDepRespPers,jdbcType=VARCHAR},
  396. </if>
  397. <if test="chkOrg != null and chkOrg != ''">
  398. CHK_ORG = #{chkOrg,jdbcType=VARCHAR},
  399. </if>
  400. <if test="chkOrgRespPers != null and chkOrgRespPers != ''">
  401. CHK_ORG_RESP_PERS = #{chkOrgRespPers,jdbcType=VARCHAR},
  402. </if>
  403. <if test="chkOrgRespPersMobi != null and chkOrgRespPersMobi != ''">
  404. CHK_ORG_RESP_PERS_MOBI = #{chkOrgRespPersMobi,jdbcType=VARCHAR},
  405. </if>
  406. <if test="chkResult != null and chkResult != ''">
  407. CHK_RESULT = #{chkResult,jdbcType=VARCHAR},
  408. </if>
  409. <if test="chkDgerPblm != null and chkDgerPblm != ''">
  410. CHK_DGER_PBLM = #{chkDgerPblm},
  411. </if>
  412. <if test="chkHandSugg != null and chkHandSugg != ''">
  413. CHK_HAND_SUGG = #{chkHandSugg,jdbcType=VARCHAR},
  414. </if>
  415. <if test="chkHandEdtm != null">
  416. CHK_HAND_EDTM = #{chkHandEdtm,jdbcType=DATE},
  417. </if>
  418. <if test="chkRectImplInfo != null and chkRectImplInfo != ''">
  419. CHK_RECT_IMPL_INFO = #{chkRectImplInfo,jdbcType=VARCHAR},
  420. </if>
  421. <if test="chkRectImplInfoDesc != null and chkRectImplInfoDesc != ''">
  422. CHK_RECT_IMPL_INFO_DESC = #{chkRectImplInfoDesc,jdbcType=VARCHAR},
  423. </if>
  424. <if test="chkAcceTm != null">
  425. CHK_ACCE_TM = #{chkAcceTm,jdbcType=DATE},
  426. </if>
  427. <if test="chkAccePers != null and chkAccePers != ''">
  428. CHK_ACCE_PERS = #{chkAccePers,jdbcType=VARCHAR},
  429. </if>
  430. <if test="chkTotalPblmNum != null">
  431. CHK_TOTAL_PBLM_NUM = #{chkTotalPblmNum,jdbcType=DECIMAL},
  432. </if>
  433. <if test="chkTotalRectNum != null">
  434. CHK_TOTAL_RECT_NUM = #{chkTotalRectNum,jdbcType=DECIMAL},
  435. </if>
  436. <if test="chkFillUnit != null and chkFillUnit != ''">
  437. CHK_FILL_UNIT = #{chkFillUnit},
  438. </if>
  439. <if test="chkSubmitDept != null and chkSubmitDept != ''">
  440. CHK_SUBMIT_DEPT = #{chkSubmitDept,jdbcType=VARCHAR},
  441. </if>
  442. <if test="chkSubmitDttm != null">
  443. CHK_SUBMIT_DTTM = #{chkSubmitDttm,jdbcType=DATE},
  444. </if>
  445. <if test="note != null and note != ''">
  446. NOTE = #{note,jdbcType=VARCHAR},
  447. </if>
  448. <if test="persId != null and persId != ''">
  449. PERS_ID = #{persId,jdbcType=VARCHAR},
  450. </if>
  451. <if test="intm != null">
  452. INTM = #{intm,jdbcType=DATE},
  453. </if>
  454. <if test="uptm != null">
  455. UPTM = #{uptm,jdbcType=DATE},
  456. </if>
  457. <if test="dataStat != null and dataStat != ''">
  458. DATA_STAT = #{dataStat,jdbcType=VARCHAR},
  459. </if>
  460. </set>
  461. where ID = #{id,jdbcType=VARCHAR}
  462. </update>
  463. <update id="updateByPrimaryKey" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeProdLedger">
  464. update CHK_SAFE_PROD_LEDGER
  465. set ORG_ID = #{orgId,jdbcType=VARCHAR},
  466. AD_CODE = #{adCode,jdbcType=VARCHAR},
  467. CHK_MNTH = #{chkMnth,jdbcType=DATE},
  468. CHK_PROJ_TYPE = #{chkProjType},
  469. CHK_DTTM = #{chkDttm,jdbcType=DATE},
  470. LEAD_DEP = #{leadDep,jdbcType=VARCHAR},
  471. LEAD_DEP_RESP_PERS = #{leadDepRespPers,jdbcType=VARCHAR},
  472. CHK_ORG = #{chkOrg,jdbcType=VARCHAR},
  473. CHK_ORG_RESP_PERS = #{chkOrgRespPers,jdbcType=VARCHAR},
  474. CHK_ORG_RESP_PERS_MOBI = #{chkOrgRespPersMobi,jdbcType=VARCHAR},
  475. CHK_RESULT = #{chkResult,jdbcType=VARCHAR},
  476. CHK_DGER_PBLM = #{chkDgerPblm},
  477. CHK_HAND_SUGG = #{chkHandSugg,jdbcType=VARCHAR},
  478. CHK_HAND_EDTM = #{chkHandEdtm,jdbcType=DATE},
  479. CHK_RECT_IMPL_INFO = #{chkRectImplInfo,jdbcType=VARCHAR},
  480. CHK_RECT_IMPL_INFO_DESC = #{chkRectImplInfoDesc,jdbcType=VARCHAR},
  481. CHK_ACCE_TM = #{chkAcceTm,jdbcType=DATE},
  482. CHK_ACCE_PERS = #{chkAccePers,jdbcType=VARCHAR},
  483. CHK_TOTAL_PBLM_NUM = #{chkTotalPblmNum,jdbcType=DECIMAL},
  484. CHK_TOTAL_RECT_NUM = #{chkTotalRectNum,jdbcType=DECIMAL},
  485. CHK_FILL_UNIT = #{chkFillUnit},
  486. CHK_SUBMIT_DEPT = #{chkSubmitDept,jdbcType=VARCHAR},
  487. CHK_SUBMIT_DTTM = #{chkSubmitDttm,jdbcType=DATE},
  488. NOTE = #{note,jdbcType=VARCHAR},
  489. PERS_ID = #{persId,jdbcType=VARCHAR},
  490. INTM = #{intm,jdbcType=DATE},
  491. UPTM = #{uptm,jdbcType=DATE},
  492. DATA_STAT = #{dataStat,jdbcType=VARCHAR}
  493. where ID = #{id,jdbcType=VARCHAR}
  494. </update>
  495. <!-- 批量上报 -->
  496. <update id="batchReportByIds" >
  497. update CHK_SAFE_PROD_LEDGER
  498. set FILL_REPO_STAT = '2', UPTM = #{uptm}
  499. where FILL_REPO_STAT = '1' and ID in
  500. <foreach item="id" collection="ids" open="(" separator="," close=")">
  501. #{id}
  502. </foreach>
  503. </update>
  504. <!-- 市级统计查询 -->
  505. <select id="summaryList" resultType="java.util.Map">
  506. select t.*
  507. from
  508. (select to_date(concat(to_char(CHK_DTTM,'YYYY-MM'),'-01') ,'YYYY-MM-DD') as "chkMnth" ,
  509. <!-- 巡查个次 -->
  510. count(ID) as chkNum,
  511. <!-- 隐患数量 检查结果 0 无隐患 1有隐患 -->
  512. SUM( CASE WHEN CHK_RESULT = '1' THEN 1 ELSE 0 END ) as pblmNum ,
  513. <!-- 隐患未整改 -->
  514. SUM( CASE CHK_RECT_IMPL_INFO WHEN '0' THEN 1 ELSE 0 END ) as rectNotNum ,
  515. <!-- 隐患整改 -->
  516. SUM( CASE CHK_RECT_IMPL_INFO WHEN '1' THEN 1 WHEN '2' THEN 1 ELSE 0 END ) as rectDoNum
  517. from CHK_SAFE_PROD_LEDGER
  518. <trim prefix="where" prefixOverrides="and | or ">
  519. FILL_REPO_STAT = '2' and DATA_STAT = '0'
  520. <if test="chkMnth != null">
  521. and to_char(CHK_DTTM,'YYYY-MM') = to_char(#{chkMnth},'YYYY-MM')
  522. </if>
  523. <if test="chkMnthList != null">
  524. and
  525. <foreach item="item" index="index" collection="chkMnthList" open="(" separator="or" close=")">
  526. to_char(CHK_DTTM,'YYYY-MM') = to_char(#{item},'YYYY-MM')
  527. </foreach>
  528. </if>
  529. <if test='chkProjType != null and "" != chkProjType'>
  530. and CHK_PROJ_TYPE = #{chkProjType}
  531. </if>
  532. <!-- 市级 、 县级 行政区过滤 -->
  533. <if test=' null != adCode '>
  534. and
  535. <foreach item="item" index="index" collection="adCode.split(',')" open="(" separator="or" close=")">
  536. AD_CODE like concat('${item}','%')
  537. </foreach>
  538. </if>
  539. </trim>
  540. group by to_date(concat(to_char(CHK_DTTM,'YYYY-MM'),'-01') ,'YYYY-MM-DD')
  541. ) t
  542. order by t."chkMnth" desc
  543. </select>
  544. </mapper>