evo-Financial-pc/evo-admin/target/classes/mapper/personnelMatters/RzOverTimeMapper.xml
2025-05-04 11:02:42 +08:00

98 lines
4.8 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.evo.personnelMatters.mapper.RzOverTimeMapper">
<resultMap type="RzOverTime" id="RzOverTimeResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="name" column="name" />
<result property="overTimeMonth" column="over_time_month" />
<result property="overHours" column="over_hours" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectRzOverTimeVo">
select id, dept_id,user_id, name, over_time_month, over_hours, del_flag, create_by, create_time, update_by, update_time from rz_over_time
</sql>
<select id="selectRzOverTimeList" parameterType="RzOverTime" resultMap="RzOverTimeResult">
select id, dept_id,user_id, name, over_time_month, over_hours, del_flag, create_by, create_time, update_by, update_time from rz_over_time d
<where>
d.del_flag = '0'
<if test="name != null and name != ''"> and name like concat('%',#{name},'%')</if>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
<choose>
<when test="overTimeMonth != null ">
and DATE_FORMAT( d.over_time_month, '%Y%m' ) = DATE_FORMAT( #{overTimeMonth} , '%Y%m' )
</when>
<otherwise>
and DATE_FORMAT( d.over_time_month, '%Y%m' ) = DATE_FORMAT( NOW() , '%Y%m' )
</otherwise>
</choose>
${params.dataScope}
</where>
</select>
<select id="selectRzOverTimeById" parameterType="Long" resultMap="RzOverTimeResult">
<include refid="selectRzOverTimeVo"/>
where id = #{id}
</select>
<insert id="insertRzOverTime" parameterType="RzOverTime" useGeneratedKeys="true" keyProperty="id">
insert into rz_over_time
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="name != null">name,</if>
<if test="overTimeMonth != null">over_time_month,</if>
<if test="overHours != null">over_hours,</if>
<if test="delFlag != null">del_flag,</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="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="name != null">#{name},</if>
<if test="overTimeMonth != null">#{overTimeMonth},</if>
<if test="overHours != null">#{overHours},</if>
<if test="delFlag != null">#{delFlag},</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="updateRzOverTime" parameterType="RzOverTime">
update rz_over_time
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="name != null">name = #{name},</if>
<if test="overTimeMonth != null">over_time_month = #{overTimeMonth},</if>
<if test="overHours != null">over_hours = #{overHours},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<!-- 根据姓名,部门,月份查询数据 -->
<select id="selectRzOverTimeByNameAndMonth" resultMap="RzOverTimeResult">
<include refid="selectRzOverTimeVo"/>
where del_flag = '0' and user_id = #{userId} and DATE_FORMAT(over_time_month, '%Y%m' ) = DATE_FORMAT( #{overTimeMonth} , '%Y%m' )
</select>
</mapper>