103 lines
4.9 KiB
XML
103 lines
4.9 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.attendance.mapper.RzAbnormalMapper">
|
|
|
|
<resultMap type="RzAbnormal" id="RzAbnormalResult">
|
|
<result property="id" column="id" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="name" column="name" />
|
|
<result property="month" column="month" />
|
|
<result property="number" column="number" />
|
|
<result property="money" column="money" />
|
|
<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="selectRzAbnormalVo">
|
|
select id, dept_id, user_id, name, month, number, money, del_flag, create_by, create_time, update_by, update_time from rz_abnormal
|
|
</sql>
|
|
|
|
<select id="selectRzAbnormalList" parameterType="RzAbnormal" resultMap="RzAbnormalResult">
|
|
<include refid="selectRzAbnormalVo"/>
|
|
<where>
|
|
del_flag = '0'
|
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
<if test="userId != null"> and user_id = #{userId}</if>
|
|
<if test="name != null and name != ''"> and name like concat('%',#{name},'%')</if>
|
|
<choose>
|
|
<when test="month != null">
|
|
and date_format(month,'%y%m') = date_format(#{month},'%y%m')
|
|
</when>
|
|
<otherwise>
|
|
and date_format(month,'%y%m') = date_format(NOW(),'%y%m')
|
|
</otherwise>
|
|
</choose>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectRzAbnormalById" parameterType="Long" resultMap="RzAbnormalResult">
|
|
<include refid="selectRzAbnormalVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertRzAbnormal" parameterType="RzAbnormal" useGeneratedKeys="true" keyProperty="id">
|
|
insert into rz_abnormal
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="deptId != null">dept_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="name != null and name != ''">name,</if>
|
|
<if test="month != null">month,</if>
|
|
<if test="number != null">number,</if>
|
|
<if test="money != null">money,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">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 and name != ''">#{name},</if>
|
|
<if test="month != null">#{month},</if>
|
|
<if test="number != null">#{number},</if>
|
|
<if test="money != null">#{money},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateRzAbnormal" parameterType="RzAbnormal">
|
|
update rz_abnormal
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="name != null and name != ''">name = #{name},</if>
|
|
<if test="month != null">month = #{month},</if>
|
|
<if test="number != null">number = #{number},</if>
|
|
<if test="money != null">money = #{money},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<!-- 查询员工迟到情况 -->
|
|
<select id="selectRzAbnormalByUserId" resultMap="RzAbnormalResult">
|
|
<include refid="selectRzAbnormalVo"/>
|
|
where del_flag = '0' and user_id = #{userId} and date_format(month,'%y%m') = date_format(#{month},'%y%m')
|
|
</select>
|
|
|
|
</mapper>
|