ChkSafeProdLedgerDao.xml 21 KB

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