109 lines
5.3 KiB
XML
109 lines
5.3 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>
|
|
<if test="month != null">and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</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>
|
|
|
|
|
|
<select id="selectRzRestaurantDetailListMap" resultType="java.util.Map">
|
|
select count(id) as num,staff_id as staffId,sign as type from rz_restaurant_detail where del_flag = '0' and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )
|
|
GROUP BY staff_id,sign
|
|
</select>
|
|
<select id="checkDinnerByStaffIdAndDateAndSign" resultType="java.lang.Long">
|
|
select count(id)
|
|
from rz_restaurant_detail
|
|
where del_flag = '0'
|
|
and DATE_FORMAT( date, '%Y%m%d' ) = DATE_FORMAT( #{date} , '%Y%m%d' )
|
|
and staff_id = #{staffId}
|
|
and sign = #{sign}
|
|
</select>
|
|
|
|
<select id="selectDetailAllListMap" resultType="java.util.Map">
|
|
SELECT
|
|
count(rd.id) as faceScanNum,
|
|
rd.sign as productName,
|
|
if(dd.dict_label is null or dd.dict_label='外包',"河北伊特",dd.dict_label)as companyName,
|
|
ddr.dict_value as unitPrice
|
|
from rz_restaurant_detail rd
|
|
left join sys_staff s on s.user_id = rd.staff_id
|
|
left join sys_dict_data dd on dd.dict_value = s.company_name and dd.dict_type = 'sys_company'
|
|
left join sys_dict_data ddr on ddr.dict_label = CONCAT(rd.sign,'消费') and ddr.dict_type = 'sys_restaurant'
|
|
where DATE_FORMAT(rd.date,'%Y-%m') = #{month} group by rd.sign,companyName,unitPrice
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|