综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcTrainApprovalMapper.xml 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.oa.mapper.CmcTrainApprovalMapper">
  6. <resultMap type="CmcTrainApproval" id="CmcTrainApprovalResult">
  7. <result property="participateId" column="participate_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="deptId" column="dept_id" />
  10. <result property="reportTime" column="report_time" />
  11. <result property="trainTime" column="train_time" />
  12. <result property="trainName" column="train_name" />
  13. <result property="content" column="content" />
  14. <result property="document" column="document" />
  15. <result property="hours" column="hours" />
  16. <result property="deptUserId" column="dept_user_id" />
  17. <result property="deptTime" column="dept_time" />
  18. <result property="deptComment" column="dept_comment" />
  19. <association property="reportUser" javaType="SysUser" resultMap="ReportUserResult" />
  20. <association property="deptUser" javaType="SysUser" resultMap="DeptUserResult" />
  21. <association property="dept" javaType="SysDept" resultMap="SysDeptResult" />
  22. </resultMap>
  23. <resultMap type="SysUser" id="ReportUserResult">
  24. <result property="userId" column="user_id" />
  25. <result property="nickName" column="report_nick_name" />
  26. </resultMap>
  27. <resultMap type="SysUser" id="DeptUserResult">
  28. <result property="userId" column="user_id" />
  29. <result property="nickName" column="dept_nick_name" />
  30. </resultMap>
  31. <resultMap type="SysDept" id="SysDeptResult">
  32. <result property="deptId" column="dept_id" />
  33. <result property="deptName" column="dept_name" />
  34. </resultMap>
  35. <sql id="selectCmcTrainApprovalVo">
  36. select ta.participate_id, ta.user_id, u.nick_name as report_nick_name, ta.dept_id, d.dept_name, ta.report_time, ta.train_time, ta.train_name, ta.content,ta.document, ta.hours, ta.dept_user_id, u1.nick_name as dept_nick_name, ta.dept_time, ta.dept_comment from cmc_train_approval as ta
  37. left join sys_user as u on u.user_id = ta.user_id
  38. left join sys_user as u1 on u1.user_id = ta.dept_user_id
  39. left join sys_dept as d on d.dept_id = ta.dept_id
  40. </sql>
  41. <select id="selectCmcTrainApprovalList" parameterType="CmcTrainApproval" resultMap="CmcTrainApprovalResult">
  42. <include refid="selectCmcTrainApprovalVo"/>
  43. <where>
  44. <if test="userId != null "> and ta.user_id = #{userId}</if>
  45. <if test="deptId != null "> and ta.dept_id = #{deptId}</if>
  46. <if test="reportTime != null "> and YEAR(ta.report_time) = YEAR(#{reportTime})</if>
  47. <if test="reportTime != null "> and YEAR(ta.train_time) = YEAR(#{trainTime})</if>
  48. <if test="trainName != null and trainName != ''"> and ta.train_name like concat('%', #{trainName}, '%')</if>
  49. <if test="content != null and content != ''"> and ta.content = #{content}</if>
  50. <if test="document != null and document != ''"> and ta.document = #{document}</if>
  51. <if test="hours != null "> and ta.hours = #{hours}</if>
  52. <if test="deptUserId != null "> and ta.dept_user_id = #{deptUserId}</if>
  53. <if test="deptTime != null "> and ta.dept_time = #{deptTime}</if>
  54. <if test="deptComment != null and deptComment != ''"> and ta.dept_comment = #{deptComment}</if>
  55. </where>
  56. order by ta.report_time desc
  57. </select>
  58. <select id="selectCmcTrainApprovalByParticipateId" parameterType="String" resultMap="CmcTrainApprovalResult">
  59. <include refid="selectCmcTrainApprovalVo"/>
  60. where participate_id = #{participateId}
  61. </select>
  62. <insert id="insertCmcTrainApproval" parameterType="CmcTrainApproval">
  63. insert into cmc_train_approval
  64. <trim prefix="(" suffix=")" suffixOverrides=",">
  65. <if test="participateId != null">participate_id,</if>
  66. <if test="userId != null">user_id,</if>
  67. <if test="deptId != null">dept_id,</if>
  68. <if test="reportTime != null">report_time,</if>
  69. <if test="trainTime != null">train_time,</if>
  70. <if test="trainName != null">train_name,</if>
  71. <if test="content != null">content,</if>
  72. <if test="document != null">document,</if>
  73. <if test="hours != null">hours,</if>
  74. <if test="deptUserId != null">dept_user_id,</if>
  75. <if test="deptTime != null">dept_time,</if>
  76. <if test="deptComment != null">dept_comment,</if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="participateId != null">#{participateId},</if>
  80. <if test="userId != null">#{userId},</if>
  81. <if test="deptId != null">#{deptId},</if>
  82. <if test="reportTime != null">#{reportTime},</if>
  83. <if test="trainTime != null">#{trainTime},</if>
  84. <if test="trainName != null">#{trainName},</if>
  85. <if test="content != null">#{content},</if>
  86. <if test="document != null">#{document},</if>
  87. <if test="hours != null">#{hours},</if>
  88. <if test="deptUserId != null">#{deptUserId},</if>
  89. <if test="deptTime != null">#{deptTime},</if>
  90. <if test="deptComment != null">#{deptComment},</if>
  91. </trim>
  92. </insert>
  93. <update id="updateCmcTrainApproval" parameterType="CmcTrainApproval">
  94. update cmc_train_approval
  95. <trim prefix="SET" suffixOverrides=",">
  96. <if test="userId != null">user_id = #{userId},</if>
  97. <if test="deptId != null">dept_id = #{deptId},</if>
  98. <if test="reportTime != null">report_time = #{reportTime},</if>
  99. <if test="trainTime != null">train_time = #{trainTime},</if>
  100. <if test="trainName != null">train_name = #{trainName},</if>
  101. <if test="content != null">content = #{content},</if>
  102. <if test="document != null">document = #{document},</if>
  103. <if test="hours != null">hours = #{hours},</if>
  104. <if test="deptUserId != null">dept_user_id = #{deptUserId},</if>
  105. <if test="deptTime != null">dept_time = #{deptTime},</if>
  106. <if test="deptComment != null">dept_comment = #{deptComment},</if>
  107. </trim>
  108. where participate_id = #{participateId}
  109. </update>
  110. <delete id="deleteCmcTrainApprovalByParticipateId" parameterType="String">
  111. delete from cmc_train_approval where participate_id = #{participateId}
  112. </delete>
  113. <delete id="deleteCmcTrainApprovalByParticipateIds" parameterType="String">
  114. delete from cmc_train_approval where participate_id in
  115. <foreach item="participateId" collection="array" open="(" separator="," close=")">
  116. #{participateId}
  117. </foreach>
  118. </delete>
  119. </mapper>