<?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.system.mapper.TdLeaveMapper"> <resultMap type="TdLeave" id="TdLeaveResult"> <result property="id" column="id" /> <result property="userId" column="user_id" /> <result property="userName" column="user_name" /> <result property="country" column="country" /> <result property="areaname" column="areaname" /> <result property="leavereason" column="leavereason" /> <result property="depart" column="depart" /> <result property="leavedate" column="leavedate" /> <result property="workstate" column="workstate" /> <result property="leavestate" column="leavestate" /> <result property="examinename" column="examinename" /> <result property="examinedate" column="examinedate" /> <result property="examinestate" column="examinestate" /> <result property="deptId" column="dept_id" jdbcType="INTEGER"/> </resultMap> <sql id="selectTdLeaveVo"> select u.id, u.user_id, u.user_name, u.country, u.areaname, u.leavereason, u.depart, u.leavedate, u.workstate, u.leavestate, u.examinename, u.examinedate, u.examinestate,dept_id from td_leave u </sql> <select id="selectTdLeaveList" parameterType="TdLeave" resultMap="TdLeaveResult"> <include refid="selectTdLeaveVo"/> <trim prefix="where" prefixOverrides="and|or"> <if test="userId != null and userId != ''"> and u.user_id = #{userId}</if> <if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if> <if test="country != null and country != ''"> and u.country = #{country}</if> <if test="areaname != null and areaname != ''"> and u.areaname like concat('%', #{areaname}, '%')</if> <if test="leavereason != null and leavereason != ''"> and u.leavereason = #{leavereason}</if> <if test="depart != null and depart != ''"> and u.depart = #{depart}</if> <if test="leavedate != null "> and u.leavedate = #{leavedate}</if> <if test="workstate != null and workstate != ''"> and u.workstate = #{workstate}</if> <if test="leavestate != null and leavestate != ''"> and u.leavestate = #{leavestate}</if> <if test="examinename != null and examinename != ''"> and u.examinename like concat('%', #{examinename}, '%')</if> <if test="examinedate != null "> and u.examinedate = #{examinedate}</if> <if test="examinestate != null and examinestate != ''"> and u.examinestate = #{examinestate}</if> <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> <!-- 数据范围过滤 --> ${params.dataScope} </trim> ORDER BY examinedate ASC </select> <select id="selectTdLeaveById" parameterType="Long" resultMap="TdLeaveResult"> <include refid="selectTdLeaveVo"/> where id = #{id} </select> <insert id="insertTdLeave" parameterType="TdLeave" useGeneratedKeys="true" keyProperty="id"> insert into td_leave <trim prefix="(" suffix=")" suffixOverrides=","> <if test="userId != null">user_id,</if> <if test="userName != null">user_name,</if> <if test="country != null">country,</if> <if test="areaname != null">areaname,</if> <if test="leavereason != null">leavereason,</if> <if test="depart != null">depart,</if> <if test="leavedate != null">leavedate,</if> <if test="workstate != null">workstate,</if> <if test="leavestate != null">leavestate,</if> <if test="examinename != null">examinename,</if> <if test="examinedate != null">examinedate,</if> <if test="examinestate != null">examinestate,</if> <if test="deptId != null">dept_id,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="userId != null">#{userId},</if> <if test="userName != null">#{userName},</if> <if test="country != null">#{country},</if> <if test="areaname != null">#{areaname},</if> <if test="leavereason != null">#{leavereason},</if> <if test="depart != null">#{depart},</if> <if test="leavedate != null">#{leavedate},</if> <if test="workstate != null">#{workstate},</if> <if test="leavestate != null">#{leavestate},</if> <if test="examinename != null">#{examinename},</if> <if test="examinedate != null">#{examinedate},</if> <if test="examinestate != null">#{examinestate},</if> <if test="deptId != null">#{deptId},</if> </trim> </insert> <update id="updateTdLeave" parameterType="TdLeave"> update td_leave <trim prefix="SET" suffixOverrides=","> <if test="userId != null">user_id = #{userId},</if> <if test="userName != null">user_name = #{userName},</if> <if test="country != null">country = #{country},</if> <if test="areaname != null">areaname = #{areaname},</if> <if test="leavereason != null">leavereason = #{leavereason},</if> <if test="depart != null">depart = #{depart},</if> <if test="leavedate != null">leavedate = #{leavedate},</if> <if test="workstate != null">workstate = #{workstate},</if> <if test="leavestate != null">leavestate = #{leavestate},</if> <if test="examinename != null">examinename = #{examinename},</if> <if test="examinedate != null">examinedate = #{examinedate},</if> <if test="examinestate != null">examinestate = #{examinestate},</if> <if test="deptId != null">dept_id = #{deptId},</if> </trim> where id = #{id} </update> <delete id="deleteTdLeaveById" parameterType="Long"> delete from td_leave where id = #{id} </delete> <delete id="deleteTdLeaveByIds" parameterType="String"> delete from td_leave where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>