| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.oa.mapper.CmcTrainApprovalMapper">
-
- <resultMap type="CmcTrainApproval" id="CmcTrainApprovalResult">
- <result property="participateId" column="participate_id" />
- <result property="userId" column="user_id" />
- <result property="deptId" column="dept_id" />
- <result property="reportTime" column="report_time" />
- <result property="trainTime" column="train_time" />
- <result property="trainName" column="train_name" />
- <result property="content" column="content" />
- <result property="document" column="document" />
- <result property="hours" column="hours" />
- <result property="deptUserId" column="dept_user_id" />
- <result property="deptTime" column="dept_time" />
- <result property="deptComment" column="dept_comment" />
- <association property="reportUser" javaType="SysUser" resultMap="ReportUserResult" />
- <association property="deptUser" javaType="SysUser" resultMap="DeptUserResult" />
- <association property="dept" javaType="SysDept" resultMap="SysDeptResult" />
- </resultMap>
-
- <resultMap type="SysUser" id="ReportUserResult">
- <result property="userId" column="user_id" />
- <result property="nickName" column="report_nick_name" />
- </resultMap>
-
- <resultMap type="SysUser" id="DeptUserResult">
- <result property="userId" column="user_id" />
- <result property="nickName" column="dept_nick_name" />
- </resultMap>
-
- <resultMap type="SysDept" id="SysDeptResult">
- <result property="deptId" column="dept_id" />
- <result property="deptName" column="dept_name" />
- </resultMap>
-
- <sql id="selectCmcTrainApprovalVo">
- 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
- left join sys_user as u on u.user_id = ta.user_id
- left join sys_user as u1 on u1.user_id = ta.dept_user_id
- left join sys_dept as d on d.dept_id = ta.dept_id
- </sql>
-
- <select id="selectCmcTrainApprovalList" parameterType="CmcTrainApproval" resultMap="CmcTrainApprovalResult">
- <include refid="selectCmcTrainApprovalVo"/>
- <where>
- <if test="userId != null "> and ta.user_id = #{userId}</if>
- <if test="deptId != null "> and ta.dept_id = #{deptId}</if>
- <if test="reportTime != null "> and YEAR(ta.report_time) = YEAR(#{reportTime})</if>
- <if test="reportTime != null "> and YEAR(ta.train_time) = YEAR(#{trainTime})</if>
- <if test="trainName != null and trainName != ''"> and ta.train_name like concat('%', #{trainName}, '%')</if>
- <if test="content != null and content != ''"> and ta.content = #{content}</if>
- <if test="document != null and document != ''"> and ta.document = #{document}</if>
- <if test="hours != null "> and ta.hours = #{hours}</if>
- <if test="deptUserId != null "> and ta.dept_user_id = #{deptUserId}</if>
- <if test="deptTime != null "> and ta.dept_time = #{deptTime}</if>
- <if test="deptComment != null and deptComment != ''"> and ta.dept_comment = #{deptComment}</if>
- </where>
- order by ta.report_time desc
- </select>
-
- <select id="selectCmcTrainApprovalByParticipateId" parameterType="String" resultMap="CmcTrainApprovalResult">
- <include refid="selectCmcTrainApprovalVo"/>
- where participate_id = #{participateId}
- </select>
-
- <insert id="insertCmcTrainApproval" parameterType="CmcTrainApproval">
- insert into cmc_train_approval
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="participateId != null">participate_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="reportTime != null">report_time,</if>
- <if test="trainTime != null">train_time,</if>
- <if test="trainName != null">train_name,</if>
- <if test="content != null">content,</if>
- <if test="document != null">document,</if>
- <if test="hours != null">hours,</if>
- <if test="deptUserId != null">dept_user_id,</if>
- <if test="deptTime != null">dept_time,</if>
- <if test="deptComment != null">dept_comment,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="participateId != null">#{participateId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="reportTime != null">#{reportTime},</if>
- <if test="trainTime != null">#{trainTime},</if>
- <if test="trainName != null">#{trainName},</if>
- <if test="content != null">#{content},</if>
- <if test="document != null">#{document},</if>
- <if test="hours != null">#{hours},</if>
- <if test="deptUserId != null">#{deptUserId},</if>
- <if test="deptTime != null">#{deptTime},</if>
- <if test="deptComment != null">#{deptComment},</if>
- </trim>
- </insert>
-
- <update id="updateCmcTrainApproval" parameterType="CmcTrainApproval">
- update cmc_train_approval
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="reportTime != null">report_time = #{reportTime},</if>
- <if test="trainTime != null">train_time = #{trainTime},</if>
- <if test="trainName != null">train_name = #{trainName},</if>
- <if test="content != null">content = #{content},</if>
- <if test="document != null">document = #{document},</if>
- <if test="hours != null">hours = #{hours},</if>
- <if test="deptUserId != null">dept_user_id = #{deptUserId},</if>
- <if test="deptTime != null">dept_time = #{deptTime},</if>
- <if test="deptComment != null">dept_comment = #{deptComment},</if>
- </trim>
- where participate_id = #{participateId}
- </update>
-
- <delete id="deleteCmcTrainApprovalByParticipateId" parameterType="String">
- delete from cmc_train_approval where participate_id = #{participateId}
- </delete>
-
- <delete id="deleteCmcTrainApprovalByParticipateIds" parameterType="String">
- delete from cmc_train_approval where participate_id in
- <foreach item="participateId" collection="array" open="(" separator="," close=")">
- #{participateId}
- </foreach>
- </delete>
- </mapper>
|