EsmSocialSecurityMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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="com.ydtech.modules.esm.dao.EsmSocialSecurityDao">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.esm.model.EsmSocialSecurity">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
  7. <result column="dept_name" jdbcType="VARCHAR" property="deptName"/>
  8. <result column="user_id" jdbcType="VARCHAR" property="userId"/>
  9. <result column="user_name" jdbcType="VARCHAR" property="userName"/>
  10. <result column="pay_year" jdbcType="VARCHAR" property="payYear"/>
  11. <result column="pay_month" jdbcType="VARCHAR" property="payMonth"/>
  12. <result column="pension_com" jdbcType="VARCHAR" property="pensionCom"/>
  13. <result column="pension_self" jdbcType="VARCHAR" property="pensionSelf"/>
  14. <result column="pension_com2" jdbcType="VARCHAR" property="pensionCom2"/>
  15. <result column="pension_self2" jdbcType="VARCHAR" property="pensionSelf2"/>
  16. <result column="medical_com" jdbcType="VARCHAR" property="medicalCom"/>
  17. <result column="medical_self" jdbcType="VARCHAR" property="medicalSelf"/>
  18. <result column="medical_com2" jdbcType="VARCHAR" property="medicalCom2"/>
  19. <result column="medical_self2" jdbcType="VARCHAR" property="medicalSelf2"/>
  20. <result column="dabing_com" jdbcType="VARCHAR" property="dabingCom"/>
  21. <result column="dabing_com2" jdbcType="VARCHAR" property="dabingCom2"/>
  22. <result column="injury_com" jdbcType="VARCHAR" property="injuryCom"/>
  23. <result column="injury_com2" jdbcType="VARCHAR" property="injuryCom2"/>
  24. <result column="bear_com" jdbcType="VARCHAR" property="bearCom"/>
  25. <result column="bear_com2" jdbcType="VARCHAR" property="bearCom2"/>
  26. <result column="jobless_com" jdbcType="VARCHAR" property="joblessCom"/>
  27. <result column="jobless_self" jdbcType="VARCHAR" property="joblessSelf"/>
  28. <result column="jobless_com2" jdbcType="VARCHAR" property="joblessCom2"/>
  29. <result column="jobless_self2" jdbcType="VARCHAR" property="joblessSelf2"/>
  30. <result column="accu_fund_com" jdbcType="VARCHAR" property="accuFundCom"/>
  31. <result column="accu_fund_self" jdbcType="VARCHAR" property="accuFundSelf"/>
  32. <result column="accu_fund_com2" jdbcType="VARCHAR" property="accuFundCom2"/>
  33. <result column="accu_fund_self2" jdbcType="VARCHAR" property="accuFundSelf2"/>
  34. <result column="comment" jdbcType="VARCHAR" property="comment"/>
  35. <result column="create_user" jdbcType="VARCHAR" property="createUser"/>
  36. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  37. <result column="reviewer" jdbcType="VARCHAR" property="reviewer"/>
  38. <result column="review_time" jdbcType="TIMESTAMP" property="reviewTime"/>
  39. <result column="review_status" jdbcType="VARCHAR" property="reviewStatus"/>
  40. <result column="submit_time" jdbcType="TIMESTAMP" property="submittime"/>
  41. <result column="submit_checkid" jdbcType="VARCHAR" property="submitcheckid"/>
  42. </resultMap>
  43. <sql id="Base_Column_List">
  44. id, dept_id, dept_name, user_id, user_name, pay_year, pay_month, pension_com, pension_self,
  45. pension_com2, pension_self2, medical_com, medical_self, medical_com2, medical_self2, dabing_com, dabing_com2,
  46. injury_com, injury_com2, bear_com, bear_com2, jobless_com, jobless_self, jobless_com2, jobless_self2, accu_fund_com,
  47. accu_fund_self, accu_fund_com2, accu_fund_self2, comment, create_user, create_time,
  48. reviewer, review_time, review_status, submit_time, submit_checkid
  49. </sql>
  50. <delete id="batchDelete">
  51. delete from esm_social_security where (pay_year, pay_month, user_id) in
  52. <foreach collection="voList" item="item" index="index" separator="," open="(" close=")">
  53. (#{item.payYear, jdbcType=VARCHAR}, cast(#{item.payMonth, jdbcType=VARCHAR} AS SIGNED),
  54. #{item.userId, jdbcType=VARCHAR} )
  55. </foreach>
  56. </delete>
  57. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  58. select
  59. <include refid="Base_Column_List"/>
  60. from esm_social_security
  61. where id = #{id,jdbcType=BIGINT}
  62. </select>
  63. <insert id="batchInsert">
  64. insert into esm_social_security (dept_id, dept_name,
  65. user_id, user_name, pay_year,
  66. pay_month, pension_com, pension_self,
  67. pension_com2, pension_self2, medical_com,
  68. medical_self, medical_com2, medical_self2,dabing_com, dabing_com2,
  69. injury_com, injury_com2, bear_com,
  70. bear_com2, jobless_com, jobless_self, jobless_com2, jobless_self2,
  71. accu_fund_com, accu_fund_self, accu_fund_com2,
  72. accu_fund_self2, comment, create_user
  73. ) VALUES
  74. <foreach collection="list" index="i" item="item" separator=",">
  75. (
  76. #{item.deptId},
  77. #{item.deptName},
  78. #{item.userId},
  79. #{item.userName},
  80. #{item.payYear},
  81. #{item.payMonth},
  82. #{item.pensionCom},
  83. #{item.pensionSelf},
  84. #{item.pensionCom2},
  85. #{item.pensionSelf2},
  86. #{item.medicalCom},
  87. #{item.medicalSelf},
  88. #{item.medicalCom2},
  89. #{item.medicalSelf2},
  90. #{item.dabingCom},
  91. #{item.dabingCom2},
  92. #{item.injuryCom},
  93. #{item.injuryCom2},
  94. #{item.bearCom},
  95. #{item.bearCom2},
  96. #{item.joblessCom},
  97. #{item.joblessSelf},
  98. #{item.joblessCom2},
  99. #{item.joblessSelf2},
  100. #{item.accuFundCom},
  101. #{item.accuFundSelf},
  102. #{item.accuFundCom2},
  103. #{item.accuFundSelf2},
  104. #{item.comment},
  105. #{createUser}
  106. )
  107. </foreach>
  108. </insert>
  109. <select id="listPage" resultMap="BaseResultMap">
  110. select
  111. <include refid="Base_Column_List"/>
  112. from esm_social_security
  113. <where>
  114. <trim prefixOverrides="and">
  115. <if test='reviewStatus != null and reviewStatus != ""'>
  116. review_status = #{reviewStatus}
  117. </if>
  118. <if test='userName != null and userName != ""'>
  119. and user_name like CONCAT('%', #{userName}, '%')
  120. </if>
  121. <if test='payYearList != null'>
  122. and pay_year in
  123. <foreach collection="payYearList" index="i" item="item" separator="," open="(" close=")">
  124. #{item}
  125. </foreach>
  126. </if>
  127. <if test='payMonthList != null'>
  128. and pay_month in
  129. <foreach collection="payMonthList" index="i" item="item" separator="," open="(" close=")">
  130. cast(#{item} AS SIGNED)
  131. </foreach>
  132. </if>
  133. <if test='deptId != null and deptId != ""'>
  134. and dept_id like CONCAT(#{deptId}, '%')
  135. </if>
  136. </trim>
  137. </where>
  138. order by create_time desc
  139. </select>
  140. <select id="getSocialByUserIdAndYearAndMonth" resultMap="BaseResultMap">
  141. select
  142. <include refid="Base_Column_List"/>
  143. from esm_social_security
  144. <where>
  145. review_status != '2' and
  146. <trim prefixOverrides="and">
  147. <if test='userId != null and userId != ""'>
  148. and user_id = #{userId}
  149. </if>
  150. <if test='payYear != null and payYear != ""'>
  151. and pay_year = #{payYear}
  152. </if>
  153. <if test='payMonth != null and payMonth != ""'>
  154. and pay_month = cast(#{payMonth} AS SIGNED)
  155. </if>
  156. </trim>
  157. </where>
  158. </select>
  159. <select id="batchSelect" resultMap="BaseResultMap">
  160. select
  161. <include refid="Base_Column_List"/>
  162. from
  163. esm_social_security
  164. where review_status in('0','1')
  165. and id in
  166. <foreach collection="ids" item="item" open="(" close=")" separator=",">
  167. #{item}
  168. </foreach>
  169. </select>
  170. <select id="listSocialCheck" resultType="com.ydtech.modules.esm.model.vo.res.EsmSocialSecurityRes">
  171. select
  172. distinct
  173. SUBSTR(dept_id, 1, 5) deptId,
  174. IF(SUBSTR(dept_id, 1, 5) like '%D%',
  175. (select a.name from sys_dept a where a.parent_id ='100' and a.id=dept_id),
  176. (select a.name from sys_dept a where a.parent_id ='100' and a.id=(SUBSTR(dept_id, 1, 5)))) deptName,
  177. /*pay_year payYear,
  178. pay_month payMonth,*/
  179. create_user createUser,
  180. (select name from sys_user where id = create_user)createUserName,
  181. submit_time submittime,
  182. submit_checkid submitcheckid,
  183. reviewer reviewer,
  184. (select name from sys_user where id = reviewer)reviewerName,
  185. review_time reviewTime,
  186. review_status reviewStatus
  187. from esm_social_security
  188. <where>
  189. <trim prefixOverrides="and">
  190. <if test='reviewStatus != null and reviewStatus != ""'>
  191. review_status = #{reviewStatus}
  192. </if>
  193. <if test='payYearList != null'>
  194. and pay_year in
  195. <foreach collection="payYearList" index="i" item="item" separator="," open="(" close=")">
  196. #{item}
  197. </foreach>
  198. </if>
  199. <if test='payMonthList != null'>
  200. and pay_month in
  201. <foreach collection="payMonthList" index="i" item="item" separator="," open="(" close=")">
  202. cast(#{item} AS SIGNED)
  203. </foreach>
  204. </if>
  205. <if test='deptId != null and deptId != ""'>
  206. and dept_id like CONCAT(#{deptId}, '%')
  207. </if>
  208. </trim>
  209. </where>
  210. order by submit_checkid desc
  211. </select>
  212. <select id="selectByCheckId" resultMap="BaseResultMap">
  213. select
  214. <include refid="Base_Column_List"/>
  215. from esm_social_security
  216. where submit_checkid=#{submitcheckid}
  217. </select>
  218. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.esm.model.EsmSocialSecurity">
  219. update esm_social_security
  220. <set>
  221. <if test="deptId != null">
  222. dept_id = #{deptId,jdbcType=VARCHAR},
  223. </if>
  224. <if test="deptName != null">
  225. dept_name = #{deptName,jdbcType=VARCHAR},
  226. </if>
  227. <if test="userId != null">
  228. user_id = #{userId,jdbcType=VARCHAR},
  229. </if>
  230. <if test="userName != null">
  231. user_name = #{userName,jdbcType=VARCHAR},
  232. </if>
  233. <if test="payYear != null">
  234. pay_year = #{payYear,jdbcType=VARCHAR},
  235. </if>
  236. <if test="payMonth != null">
  237. pay_month = cast(#{payMonth,jdbcType=VARCHAR} AS SIGNED),
  238. </if>
  239. <if test="pensionCom != null">
  240. pension_com = #{pensionCom,jdbcType=VARCHAR},
  241. </if>
  242. <if test="pensionSelf != null">
  243. pension_self = #{pensionSelf,jdbcType=VARCHAR},
  244. </if>
  245. <if test="pensionCom2 != null">
  246. pension_com2 = #{pensionCom2,jdbcType=VARCHAR},
  247. </if>
  248. <if test="pensionSelf2 != null">
  249. pension_self2 = #{pensionSelf2,jdbcType=VARCHAR},
  250. </if>
  251. <if test="medicalCom != null">
  252. medical_com = #{medicalCom,jdbcType=VARCHAR},
  253. </if>
  254. <if test="medicalSelf != null">
  255. medical_self = #{medicalSelf,jdbcType=VARCHAR},
  256. </if>
  257. <if test="medicalCom2 != null">
  258. medical_com2 = #{medicalCom2,jdbcType=VARCHAR},
  259. </if>
  260. <if test="medicalSelf2 != null">
  261. medical_self2 = #{medicalSelf2,jdbcType=VARCHAR},
  262. </if>
  263. <if test="dabingCom != null">
  264. dabing_com = #{dabingCom,jdbcType=VARCHAR},
  265. </if>
  266. <if test="dabingCom2 != null">
  267. dabing_com2 = #{dabingCom2,jdbcType=VARCHAR},
  268. </if>
  269. <if test="injuryCom != null">
  270. injury_com = #{injuryCom,jdbcType=VARCHAR},
  271. </if>
  272. <if test="injuryCom2 != null">
  273. injury_com2 = #{injuryCom2,jdbcType=VARCHAR},
  274. </if>
  275. <if test="bearCom != null">
  276. bear_com = #{bearCom,jdbcType=VARCHAR},
  277. </if>
  278. <if test="bearCom2 != null">
  279. bear_com2 = #{bearCom2,jdbcType=VARCHAR},
  280. </if>
  281. <if test="joblessCom != null">
  282. jobless_com = #{joblessCom,jdbcType=VARCHAR},
  283. </if>
  284. <if test="joblessSelf != null">
  285. jobless_self = #{joblessSelf,jdbcType=VARCHAR},
  286. </if>
  287. <if test="joblessCom2 != null">
  288. jobless_com2 = #{joblessCom2,jdbcType=VARCHAR},
  289. </if>
  290. <if test="joblessSelf2 != null">
  291. jobless_self2 = #{joblessSelf2,jdbcType=VARCHAR},
  292. </if>
  293. <if test="accuFundCom != null">
  294. accu_fund_com = #{accuFundCom,jdbcType=VARCHAR},
  295. </if>
  296. <if test="accuFundSelf != null">
  297. accu_fund_self = #{accuFundSelf,jdbcType=VARCHAR},
  298. </if>
  299. <if test="accuFundCom2 != null">
  300. accu_fund_com2 = #{accuFundCom2,jdbcType=VARCHAR},
  301. </if>
  302. <if test="accuFundSelf2 != null">
  303. accu_fund_self2 = #{accuFundSelf2,jdbcType=VARCHAR},
  304. </if>
  305. <if test="comment != null">
  306. comment = #{comment,jdbcType=VARCHAR},
  307. </if>
  308. <if test="createUser != null">
  309. create_user = #{createUser,jdbcType=VARCHAR},
  310. </if>
  311. <if test="createTime != null">
  312. create_time = #{createTime,jdbcType=TIMESTAMP},
  313. </if>
  314. <if test="reviewer != null">
  315. reviewer = #{reviewer,jdbcType=VARCHAR},
  316. </if>
  317. <if test="reviewTime != null">
  318. review_time = #{reviewTime,jdbcType=TIMESTAMP},
  319. </if>
  320. <if test="reviewStatus != null">
  321. review_status = #{reviewStatus,jdbcType=VARCHAR},
  322. </if>
  323. <if test="submittime != null">
  324. submit_time = #{submittime,jdbcType=TIMESTAMP},
  325. </if>
  326. <if test="submitcheckid != null">
  327. submit_checkid = #{submitcheckid,jdbcType=VARCHAR},
  328. </if>
  329. </set>
  330. where id = #{id,jdbcType=BIGINT}
  331. </update>
  332. <update id="updateReview" parameterType="com.ydtech.modules.esm.model.EsmSocialSecurity">
  333. update esm_social_security
  334. set reviewer = #{model.reviewer},
  335. review_status = #{model.reviewStatus},
  336. review_time = #{model.reviewTime}
  337. where submit_checkid = #{model.submitcheckid}
  338. </update>
  339. <update id="submitAuditSocial">
  340. update esm_social_security set
  341. review_status = '0',
  342. submit_time = #{social.submittime,jdbcType=TIMESTAMP },
  343. submit_checkid = #{social.submitcheckid,jdbcType=VARCHAR }
  344. where id in
  345. <foreach collection="idList" item="item" open="(" close=")" separator=",">
  346. #{item}
  347. </foreach>
  348. </update>
  349. </mapper>