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

78 lines
3.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.restaurant.mapper.RzRestaurantDetailMapper">
<resultMap type="RzRestaurantDetail" id="RzRestaurantDetailResult">
<result property="id" column="id" />
<result property="staffId" column="staff_id" />
<result property="name" column="name" />
<result property="date" column="date" />
<result property="time" column="time" />
<result property="sign" column="sign" />
<result property="number" column="number" />
<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="selectRzRestaurantDetailVo">
select id, staff_id,name, date, time, sign, del_flag, create_by, create_time, update_by, update_time from rz_restaurant_detail
</sql>
<select id="selectRzRestaurantDetailList" parameterType="RzRestaurantDetail" resultMap="RzRestaurantDetailResult">
<include refid="selectRzRestaurantDetailVo"/>
<where>
del_flag = '0'
<if test="staffId != null"> and staff_id = #{staffId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sign != null and sign != ''"> and sign = #{sign}</if>
<if test="date != null">and DATE_FORMAT( date, '%Y%m%d' ) = DATE_FORMAT(#{date} , '%Y%m%d' )</if>
<choose>
<when test="month != null">and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</when>
<otherwise>
and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( NOW() , '%Y%m' )
</otherwise>
</choose>
</where>
order by create_time desc
</select>
<!-- 根据姓名查询最后一次的打卡信息 -->
<select id="selectRzRestaurantDetailByName" parameterType="Long" resultMap="RzRestaurantDetailResult">
<include refid="selectRzRestaurantDetailVo"/>
where staff_id = #{staffId} and del_flag = '0' order by time desc limit 1
</select>
<insert id="insertRzRestaurantDetail" parameterType="RzRestaurantDetail" useGeneratedKeys="true" keyProperty="id">
insert into rz_restaurant_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="staffId != null">staff_id,</if>
<if test="name != null">name,</if>
<if test="date != null">date,</if>
<if test="time != null">time,</if>
<if test="sign != null">sign,</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="staffId != null">#{staffId},</if>
<if test="name != null">#{name},</if>
<if test="date != null">#{date},</if>
<if test="time != null">#{time},</if>
<if test="sign != null">#{sign},</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>
</mapper>