TStaffmgrMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.plant.mapper.TStaffmgrMapper">
  6. <resultMap type="TStaffmgr" id="TStaffmgrResult">
  7. <result property="id" column="id" />
  8. <result property="plantCode" column="plant_code" />
  9. <result property="staffid" column="staffid" />
  10. <result property="name" column="name" />
  11. <result property="sex" column="sex" />
  12. <result property="birthday" column="birthday" />
  13. <result property="unit" column="unit" />
  14. <result property="team" column="team" />
  15. <result property="actualpost" column="actualpost" />
  16. <result property="contact" column="contact" />
  17. <result property="delFlag" column="del_flag" />
  18. <result property="createrCode" column="creater_code" />
  19. <result property="createdate" column="createdate" />
  20. <result property="updaterCode" column="updater_code" />
  21. <result property="updatedate" column="updatedate" />
  22. <result property="deptId" column="dept_id" />
  23. <result property="remarks" column="remarks" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="education" column="education" />
  26. <result property="enAbility" column="en_ability" />
  27. <result property="mail" column="mail" />
  28. <result property="skillScore" column="skill_score" />
  29. <result property="accidentNum" column="accident_num" />
  30. <result property="photo" column="photo" />
  31. <result property="pId" column="p_id" />
  32. <result property="specialDuty" column="special_duty" />
  33. </resultMap>
  34. <sql id="selectTStaffmgrVo">
  35. select d.id, d.plant_code, d.staffid, d.name, d.photo, d.sex, d.birthday, d.unit, d.team, d.actualpost, d.contact, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.education, d.en_ability, d.accident_num, d.mail, d.skill_score, d.p_id , d.special_duty, s.dept_name from t_staffmgr d
  36. left join sys_dept s on s.dept_id = d.dept_id
  37. </sql>
  38. <select id="selectTStaffmgrList" parameterType="TStaffmgr" resultMap="TStaffmgrResult">
  39. <include refid="selectTStaffmgrVo"/>
  40. Left join SYS_DICT_DATA s0 on d.UNIT = s0.DICT_VALUE and s0.DICT_TYPE ='STAFF_UNIT'
  41. LEFT JOIN SYS_DICT_DATA s on d.ACTUALPOST = s.DICT_VALUE and s.DICT_TYPE = 'ACTUALPOST'
  42. LEFT JOIN SYS_DICT_DATA s1 on d.team = s1.DICT_VALUE and s1.DICT_TYPE = 'TEAM_DIVIDE'
  43. <where>
  44. <if test="name != null and name != ''"> and name like concat(concat('%', #{name}), '%')</if>
  45. <if test="sex != null and sex != ''"> and sex = #{sex}</if>
  46. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  47. <if test="specialDuty != null and specialDuty != ''"> and special_duty like concat(concat('%', #{specialDuty}), '%')</if>
  48. <if test="units != null and units != ''">
  49. and
  50. unit in
  51. <foreach collection="units.split(',')" item="item" index="index"
  52. open="(" close=")" separator=",">
  53. #{item}
  54. </foreach>
  55. </if>
  56. <if test="team != null and team != ''"> and team = #{team}</if>
  57. <if test="teams != null and teams != ''">
  58. and
  59. team in
  60. <foreach collection="teams.split(',')" item="item" index="index"
  61. open="(" close=")" separator=",">
  62. #{item}
  63. </foreach>
  64. </if>
  65. <if test="actualpost != null and actualpost != ''"> and actualpost = #{actualpost}</if>
  66. <if test="actualposts != null and actualposts != ''">
  67. and
  68. actualpost in
  69. <foreach collection="actualposts.split(',')" item="item" index="index"
  70. open="(" close=")" separator=",">
  71. #{item}
  72. </foreach>
  73. </if>
  74. <if test="education != null and education != ''"> and education = #{education}</if>
  75. <if test="educations != null and educations != ''">
  76. and
  77. education in
  78. <foreach collection="educations.split(',')" item="item" index="index"
  79. open="(" close=")" separator=",">
  80. #{item}
  81. </foreach>
  82. </if>
  83. <if test="enAbility != null and enAbility != ''"> and en_ability = #{enAbility}</if>
  84. <if test="enAbilitys != null and enAbilitys != ''">
  85. and
  86. en_ability in
  87. <foreach collection="enAbilitys.split(',')" item="item" index="index"
  88. open="(" close=")" separator=",">
  89. #{item}
  90. </foreach>
  91. </if>
  92. <if test="haveEmail != null and haveEmail != ''"> and mail IS NOT NULL</if>
  93. <if test="skillevaluation != null"> and team = 10
  94. or team = 12
  95. or team = 14
  96. or team = 16
  97. </if>
  98. and d.del_flag = 0
  99. </where>
  100. <!-- 数据范围过滤 -->
  101. ${params.dataScope}
  102. ORDER BY s0.DICT_SORT, s1.DICT_SORT ,s.DICT_SORT
  103. </select>
  104. <select id="selectRecordList" parameterType="TStaffmgr" resultMap="TStaffmgrResult">
  105. <include refid="selectTStaffmgrVo"/>
  106. LEFT JOIN SYS_DICT_DATA s on d.ACTUALPOST = s.DICT_VALUE and s.DICT_TYPE = 'ACTUALPOST'
  107. <where>
  108. <if test="units != null and units != ''">
  109. and
  110. unit in
  111. <foreach collection="units.split(',')" item="item" index="index"
  112. open="(" close=")" separator=",">
  113. #{item}
  114. </foreach>
  115. </if>
  116. and d.del_flag = 0
  117. </where>
  118. <!-- 数据范围过滤 -->
  119. ${params.dataScope}
  120. ORDER BY s.DICT_SORT, d.id
  121. </select>
  122. <select id="selectList" parameterType="TStaffmgr" resultMap="TStaffmgrResult">
  123. <include refid="selectTStaffmgrVo"/>
  124. <where>
  125. and d.del_flag = 0
  126. </where>
  127. <!-- 数据范围过滤 -->
  128. ${params.dataScope}
  129. </select>
  130. <select id="selectLeftTStaffmgrList" parameterType="TStaffmgr" resultMap="TStaffmgrResult">
  131. <include refid="selectTStaffmgrVo"/>
  132. <where>
  133. and d.del_flag = 9
  134. </where>
  135. <!-- 数据范围过滤 -->
  136. ${params.dataScope}
  137. </select>
  138. <select id="selectTStaffmgrById" parameterType="Long" resultMap="TStaffmgrResult">
  139. <include refid="selectTStaffmgrVo"/>
  140. where id = #{id}
  141. </select>
  142. <select id="selectTStaffmgrByStaffId" parameterType="String" resultMap="TStaffmgrResult">
  143. <include refid="selectTStaffmgrVo"/>
  144. where staffid = #{staffid}
  145. </select>
  146. <insert id="insertTStaffmgr" parameterType="TStaffmgr" useGeneratedKeys="true" keyProperty="id">
  147. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  148. SELECT seq_t_staffmgr.NEXTVAL as id FROM DUAL
  149. </selectKey>
  150. insert into t_staffmgr
  151. <trim prefix="(" suffix=")" suffixOverrides=",">
  152. <if test="id != null">id,</if>
  153. <if test="plantCode != null and plantCode != ''">plant_code,</if>
  154. <if test="staffid != null and staffid != ''">staffid,</if>
  155. <if test="name != null and name != ''">name,</if>
  156. <if test="sex != null and sex != ''">sex,</if>
  157. <if test="birthday != null">birthday,</if>
  158. <if test="unit != null">unit,</if>
  159. <if test="team != null">team,</if>
  160. <if test="actualpost != null">actualpost,</if>
  161. <if test="contact != null">contact,</if>
  162. <if test="education != null">education,</if>
  163. <if test="enAbility != null">en_ability,</if>
  164. <if test="mail != null">mail,</if>
  165. <if test="accidentNum != null">accident_num,</if>
  166. <if test="delFlag != null">del_flag,</if>
  167. <if test="createrCode != null">creater_code,</if>
  168. <if test="createdate != null">createdate,</if>
  169. <if test="updaterCode != null">updater_code,</if>
  170. <if test="updatedate != null">updatedate,</if>
  171. <if test="deptId != null">dept_id,</if>
  172. <if test="remarks != null">remarks,</if>
  173. <if test="skillScore != null">skill_score,</if>
  174. <if test="photo != null">photo,</if>
  175. <if test="pId != null">p_id,</if>
  176. <if test="specialDuty != null">special_duty,</if>
  177. </trim>
  178. <trim prefix="values (" suffix=")" suffixOverrides=",">
  179. <if test="id != null">#{id},</if>
  180. <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
  181. <if test="staffid != null and staffid != ''">#{staffid},</if>
  182. <if test="name != null and name != ''">#{name},</if>
  183. <if test="sex != null and sex != ''">#{sex},</if>
  184. <if test="birthday != null">#{birthday},</if>
  185. <if test="unit != null">#{unit},</if>
  186. <if test="team != null">#{team},</if>
  187. <if test="actualpost != null">#{actualpost},</if>
  188. <if test="contact != null">#{contact},</if>
  189. <if test="education != null">#{education},</if>
  190. <if test="enAbility != null">#{enAbility},</if>
  191. <if test="mail != null">#{mail},</if>
  192. <if test="accidentNum != null">#{accidentNum},</if>
  193. <if test="delFlag != null">#{delFlag},</if>
  194. <if test="createrCode != null">#{createrCode},</if>
  195. <if test="createdate != null">#{createdate},</if>
  196. <if test="updaterCode != null">#{updaterCode},</if>
  197. <if test="updatedate != null">#{updatedate},</if>
  198. <if test="deptId != null">#{deptId},</if>
  199. <if test="remarks != null">#{remarks},</if>
  200. <if test="skillScore != null">#{skillScore},</if>
  201. <if test="photo != null">#{photo},</if>
  202. <if test="pId != null">#{pId},</if>
  203. <if test="specialDuty != null">#{specialDuty},</if>
  204. </trim>
  205. </insert>
  206. <update id="updateTStaffmgr" parameterType="TStaffmgr">
  207. update t_staffmgr
  208. <trim prefix="SET" suffixOverrides=",">
  209. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  210. <if test="staffid != null and staffid != ''">staffid = #{staffid},</if>
  211. <if test="name != null and name != ''">name = #{name},</if>
  212. <if test="sex != null and sex != ''">sex = #{sex},</if>
  213. <if test="birthday != null">birthday = #{birthday},</if>
  214. <if test="unit != null">unit = #{unit},</if>
  215. <if test="team != null">team = #{team},</if>
  216. <if test="actualpost != null">actualpost = #{actualpost},</if>
  217. <if test="contact != null">contact = #{contact},</if>
  218. <if test="education != null">education = #{education},</if>
  219. <if test="enAbility != null">en_ability = #{enAbility},</if>
  220. <if test="accidentNum != null">accident_num = #{accidentNum},</if>
  221. <if test="mail != null">mail = #{mail},</if>
  222. <if test="skillScore != null">skill_score = #{skillScore},</if>
  223. <if test="delFlag != null">del_flag = #{delFlag},</if>
  224. <if test="createrCode != null">creater_code = #{createrCode},</if>
  225. <if test="createdate != null">createdate = #{createdate},</if>
  226. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  227. <if test="updatedate != null">updatedate = #{updatedate},</if>
  228. <if test="deptId != null">dept_id = #{deptId},</if>
  229. <if test="remarks != null">remarks = #{remarks},</if>
  230. <if test="photo != null">photo = #{photo},</if>
  231. <if test="pId != null">p_id = #{pId},</if>
  232. <if test="specialDuty != null">special_duty = #{specialDuty},</if>
  233. </trim>
  234. where id = #{id}
  235. </update>
  236. <update id="deleteTStaffmgrById" parameterType="Long">
  237. update t_staffmgr set del_flag = 2 where id = #{id}
  238. </update>
  239. <update id="deleteLeftTStaffmgrByIds" parameterType="Long">
  240. update t_staffmgr set del_flag = 9 where id = #{id}
  241. </update>
  242. <update id="reLeftTStaffmgrByIds" parameterType="Long">
  243. update t_staffmgr set del_flag = 0 where id = #{id}
  244. </update>
  245. <update id="deleteTStaffmgrByIds" parameterType="String">
  246. update t_staffmgr set del_flag = 2 where id in
  247. <foreach item="id" collection="array" open="(" separator="," close=")">
  248. #{id}
  249. </foreach>
  250. </update>
  251. <select id="selectEduData" resultType="com.ruoyi.project.common.domain.DataEntity">
  252. SELECT count(1) as dataNum,d.EDUCATION as dataName FROM "T_STAFFMGR" d
  253. <where>
  254. <if test="name != null and name != ''"> and name like concat(concat('%', #{name}), '%')</if>
  255. <if test="sex != null and sex != ''"> and sex = #{sex}</if>
  256. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  257. <if test="team != null and team != ''"> and team = #{team}</if>
  258. <if test="actualpost != null and actualpost != ''"> and actualpost = #{actualpost}</if>
  259. <if test="education != null and education != ''"> and education = #{education}</if>
  260. <if test="enAbility != null and enAbility != ''"> and en_ability = #{enAbility}</if>
  261. and d.del_flag = 0
  262. </where>
  263. <!-- 数据范围过滤 -->
  264. ${params.dataScope}
  265. GROUP BY EDUCATION
  266. order by dataName
  267. </select>
  268. <select id="selectEngData" resultType="com.ruoyi.project.common.domain.DataEntity">
  269. SELECT count(1) as dataNum,d.en_ability as dataName FROM "T_STAFFMGR" d
  270. <where>
  271. <if test="name != null and name != ''"> and name like concat(concat('%', #{name}), '%')</if>
  272. <if test="sex != null and sex != ''"> and sex = #{sex}</if>
  273. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  274. <if test="team != null and team != ''"> and team = #{team}</if>
  275. <if test="actualpost != null and actualpost != ''"> and actualpost = #{actualpost}</if>
  276. <if test="education != null and education != ''"> and education = #{education}</if>
  277. <if test="enAbility != null and enAbility != ''"> and en_ability = #{enAbility}</if>
  278. and d.del_flag = 0
  279. </where>
  280. <!-- 数据范围过滤 -->
  281. ${params.dataScope}
  282. GROUP BY en_ability
  283. order by dataName
  284. </select>
  285. <select id="selectTeamData" resultType="com.ruoyi.project.common.domain.DataEntity">
  286. SELECT count(1) as dataNum,d.team as dataName FROM "T_STAFFMGR" d
  287. <where>
  288. <if test="name != null and name != ''"> and name like concat(concat('%', #{name}), '%')</if>
  289. <if test="sex != null and sex != ''"> and sex = #{sex}</if>
  290. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  291. <if test="team != null and team != ''"> and team = #{team}</if>
  292. <if test="actualpost != null and actualpost != ''"> and actualpost = #{actualpost}</if>
  293. <if test="education != null and education != ''"> and education = #{education}</if>
  294. <if test="enAbility != null and enAbility != ''"> and en_ability = #{enAbility}</if>
  295. and d.del_flag = 0
  296. </where>
  297. <!-- 数据范围过滤 -->
  298. ${params.dataScope}
  299. GROUP BY team
  300. order by dataName
  301. </select>
  302. </mapper>