Files
zhxg_java/srs-flowable/src/main/resources/mapper/LeaveMapper.xml

158 lines
8.7 KiB
XML

<?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.srs.flowable.mapper.LeaveMapper">
<resultMap type="RtStuLeaveApplication" id="RtStuLeaveApplicationResult">
<result property="leaveApplicationId" column="leave_application_id" />
<result property="stuId" column="stu_id" />
<result property="reason" column="reason" />
<result property="leaveType" column="leave_type" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="leaveDays" column="leave_days" />
<result property="destination" column="destination" />
<result property="destinationDetails" column="destination_details" />
<result property="safetyPromise" column="safety_promise" />
<result property="applicantSignature" column="applicant_signature" />
<result property="attachment" column="attachment" />
<result property="counselorComments" column="counselor_comments" />
<result property="cancellation" column="cancellation" />
<result property="leaveStatus" column="leave_status" />
<result property="leavingGx" column="leaving_gx" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="processInstanceId" column="process_instance_id" />
</resultMap>
<sql id="selectRtStuLeaveApplicationVo">
select leave_application_id, stu_id, reason, leave_type, start_date, end_date, leave_days, destination, destination_details, safety_promise, applicant_signature, attachment, counselor_comments, cancellation, leave_status, leaving_gx, status, create_by, create_time, update_by, update_time, remark ,process_instance_id from rt_stu_leave_application
</sql>
<select id="getCounselorInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT d.user_id userId, d.dept_id deptId, d.user_name userName, d.nick_name nickName
FROM srs_student a
LEFT JOIN srs_class b ON a.class_id = b.class_id
LEFT JOIN cph_teacher c ON b.teacher_id = c.teacher_id
LEFT JOIN sys_user d ON c.employee_id = d.user_name
WHERE a.stu_id = #{stuId}
</select>
<select id="getSecondaryLeaderInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT a.user_id userId,a.dept_id deptId,a.nick_name userNick,a.user_name userName FROM sys_user a
LEFT JOIN sys_user_post b ON a.user_id = b.user_id
LEFT JOIN sys_post c ON b.post_id=c.post_id
WHERE a.dept_id=#{deptId} AND c.post_code='ejxysj'
</select>
<select id="selectRtStuLeaveApplicationByLeaveApplicationId"
resultType="com.srs.flowable.domain.StuLeaveApplication">
<include refid="selectRtStuLeaveApplicationVo"/>
where leave_application_id = #{leaveApplicationId}
</select>
<!-- 获取审批人的部门id -->
<select id="getUpdateDeptId" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT a.user_id userId,a.dept_id deptId,a.nick_name userNick,a.user_name userName
FROM sys_user a where a.user_id=#{userId}
</select>
<!-- 获取学工用户信息 -->
<select id="getUpdateDeptIdInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT a.user_id userId,a.dept_id deptId,a.nick_name userNick,a.user_name userName FROM sys_user a
LEFT JOIN sys_user_post b ON a.user_id = b.user_id
LEFT JOIN sys_post c ON b.post_id=c.post_id
WHERE a.dept_id=#{deptId} AND c.post_code='jwcgl'
</select>
<!-- 获取审批用户信息 -->
<select id="getShenDataInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT a.user_id userId,a.dept_id deptId,a.nick_name userNick,a.user_name userName FROM sys_user a
LEFT JOIN sys_user_role b ON a.user_id = b.user_id
LEFT JOIN sys_role c ON b.role_id=c.role_id
WHERE c.role_key=#{roleKey}
</select>
<!-- 查询学生用户信息 -->
<select id="getShenUserInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT d.user_id userId, d.dept_id deptId, d.user_name userName, d.nick_name nickName
FROM srs_student a
LEFT JOIN sys_user d ON a.stu_no = d.user_name
WHERE a.stu_id = #{stuId}
</select>
<!-- 查询指定收件人所对应的通知信息 -->
<select id="selectCphMsgListForFlowable" parameterType="NotificationManage" resultType="com.srs.flowable.domain.NotificationManage">
select id, sender, receiver, content, create_by, create_time, update_by, update_time from cph_msg
<where>
<if test="receiver != null "> and receiver = #{receiver}</if>
<if test="content != null and content != ''">
and content LIKE CONCAT('%', #{content}, '%')
</if>
</where>
</select>
<!-- 添加通知信息到cph_msg表中用于工作台中我的消息进行展示 -->
<insert id="insertCphMsg" parameterType="NotificationManage" useGeneratedKeys="true" keyProperty="id">
insert into cph_msg
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sender != null">sender,</if>
<if test="receiver != null">receiver,</if>
<if test="content != null">content,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sender != null">#{sender},</if>
<if test="receiver != null">#{receiver},</if>
<if test="content != null">#{content},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateRtStuLeaveApplication" parameterType="RtStuLeaveApplication">
update rt_stu_leave_application
<trim prefix="SET" suffixOverrides=",">
<if test="stuId != null">stu_id = #{stuId},</if>
<if test="reason != null and reason != ''">reason = #{reason},</if>
<if test="leaveType != null and leaveType != ''">leave_type = #{leaveType},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="leaveDays != null">leave_days = #{leaveDays},</if>
<if test="destination != null and destination != ''">destination = #{destination},</if>
<if test="destinationDetails != null">destination_details = #{destinationDetails},</if>
<if test="safetyPromise != null and safetyPromise != ''">safety_promise = #{safetyPromise},</if>
<if test="applicantSignature != null and applicantSignature != ''">applicant_signature = #{applicantSignature},</if>
<if test="attachment != null">attachment = #{attachment},</if>
<if test="counselorComments != null">counselor_comments = #{counselorComments},</if>
<if test="cancellation != null">cancellation = #{cancellation},</if>
<if test="leaveStatus != null and leaveStatus != ''">leave_status = #{leaveStatus},</if>
<if test="leavingGx != null and leavingGx != ''">leaving_gx = #{leavingGx},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="processInstanceId != null">process_instance_id = #{processInstanceId},</if>
</trim>
where leave_application_id = #{leaveApplicationId}
</update>
<!-- 根据id删除指定通知 -->
<delete id="deleteCphMsgById" parameterType="Long">
delete from cph_msg where id = #{id}
</delete>
</mapper>