172 lines
10 KiB
XML
172 lines
10 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.bonus.canteen.core.kitchen.mapper.KitchenStaffInfoMapper">
|
|
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo" id="KitchenStaffInfoResult">
|
|
<result property="staffId" column="staff_id" />
|
|
<result property="canteenId" column="canteen_id" />
|
|
<result property="staffNo" column="staff_no" />
|
|
<result property="staffName" column="staff_name" />
|
|
<result property="postName" column="post_name" />
|
|
<result property="mobile" column="mobile" />
|
|
<result property="password" column="password" />
|
|
<result property="sex" column="sex" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="faceUrl" column="photo_url" />
|
|
<result property="faceState" column="face_state" />
|
|
<result property="canteenName" column="canteen_name" />
|
|
<result property="areaName" column="area_name" />
|
|
<result property="healthCertExpire" column="health_cert_expire" />
|
|
<result property="healthCertFrontImg" column="health_cert_front_img" />
|
|
<result property="healthCertBackImg" column="health_cert_back_img" />
|
|
<result property="nutrityCertExpire" column="nutrity_cert_expire" />
|
|
<result property="safetyCertExpire" column="safety_cert_expire" />
|
|
<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="selectKitchenStaffInfoVo">
|
|
select kst.staff_id, kst.canteen_id, staff_no, staff_name, post_name, mobile, password, sex, kst.area_id, health_cert_expire,
|
|
health_cert_front_img, health_cert_back_img, nutrity_cert_expire,
|
|
safety_cert_expire, kst.create_by, kst.create_time, kst.update_by, kst.update_time,
|
|
ksf.photo_url, ksf.face_state, bc.canteen_name, ba.area_name
|
|
from kitchen_staff_info kst
|
|
left join kitchen_staff_face ksf on kst.staff_id = ksf.staff_id
|
|
left join basic_canteen bc on kst.canteen_id = bc.canteen_id
|
|
left join basic_area ba on kst.area_id = ba.area_id
|
|
</sql>
|
|
|
|
<select id="selectKitchenStaffInfoList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo" resultMap="KitchenStaffInfoResult">
|
|
<include refid="selectKitchenStaffInfoVo"/>
|
|
<where>
|
|
<if test="staffNo != null and staffNo != ''"> and staff_no = #{staffNo}</if>
|
|
<if test="staffName != null and staffName != ''"> and staff_name = #{staffNo}</if>
|
|
<if test="postName != null and postName != ''"> and post_name like CONCAT('%',#{postName},'%')</if>
|
|
<if test="sex != null"> and sex = #{sex}</if>
|
|
<if test="areaId != null"> and kst.area_id = #{areaId}</if>
|
|
<if test="healthCertExpire != null "> and health_cert_expire = #{healthCertExpire}</if>
|
|
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
|
|
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
|
|
<if test="mobile != null and mobile != ''">mobile = #{mobile}</if>
|
|
<if test="faceState != null">
|
|
and ksf.face_state = #{faceState}</if>
|
|
<if test="healthCertStatus != null ">
|
|
and case
|
|
when #{healthCertStatus} = 1 then
|
|
(
|
|
DATE_SUB(kst.health_cert_expire,
|
|
INTERVAL (select bs.item_value from kitchen_setting bs where bs.item_name = 'staff_health_cert_left_day_reminder') DAY)
|
|
<![CDATA[ >= ]]> now()
|
|
)
|
|
when #{healthCertStatus} = 2 then
|
|
(
|
|
kst.health_cert_expire <![CDATA[ < ]]> now()
|
|
)
|
|
when #{healthCertStatus} = 3 then
|
|
(
|
|
health_cert_front_img is null
|
|
)
|
|
when #{healthCertStatus} = 4 then
|
|
(
|
|
DATE_SUB(kst.health_cert_expire,
|
|
INTERVAL (select bs.item_value from kitchen_setting bs where bs.item_name = 'staff_health_cert_left_day_reminder') DAY)
|
|
<![CDATA[ < ]]> now()
|
|
and kst.health_cert_expire > now()
|
|
)
|
|
end
|
|
</if>
|
|
<if test="searchValue != null and searchValue != ''">
|
|
and (kst.staff_name like CONCAT('%',#{searchValue},'%')
|
|
or kst.mobile like CONCAT('%',#{searchValue},'%')
|
|
or kst.staff_no like CONCAT('%',#{searchValue},'%')
|
|
)
|
|
</if>
|
|
</where>
|
|
order by kst.update_time desc
|
|
</select>
|
|
|
|
<select id="selectKitchenStaffInfoByStaffId" parameterType="Long" resultMap="KitchenStaffInfoResult">
|
|
<include refid="selectKitchenStaffInfoVo"/>
|
|
where kst.staff_id = #{staffId}
|
|
</select>
|
|
|
|
<insert id="insertKitchenStaffInfo" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo" useGeneratedKeys="true" keyProperty="staffId">
|
|
insert into kitchen_staff_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="staffNo != null and staffNo != ''">staff_no,</if>
|
|
<if test="staffName != null and staffName != ''">staff_name,</if>
|
|
<if test="postName != null and postName != ''">post_name,</if>
|
|
<if test="mobile != null and mobile != ''">mobile,</if>
|
|
<if test="password != null and password != ''">password,</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="canteenId != null">canteen_id,</if>
|
|
<if test="healthCertExpire != null">health_cert_expire,</if>
|
|
<if test="healthCertFrontImg != null">health_cert_front_img,</if>
|
|
<if test="healthCertBackImg != null">health_cert_back_img,</if>
|
|
<if test="nutrityCertExpire != null">nutrity_cert_expire,</if>
|
|
<if test="safetyCertExpire != null">safety_cert_expire,</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="staffNo != null and staffNo != ''">#{staffNo},</if>
|
|
<if test="staffName != null and staffName != ''">#{staffName},</if>
|
|
<if test="postName != null and postName != ''">#{postName},</if>
|
|
<if test="mobile != null and mobile != ''">#{mobile},</if>
|
|
<if test="password != null and password != ''">#{password},</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="canteenId != null">#{canteenId},</if>
|
|
<if test="healthCertExpire != null">#{healthCertExpire},</if>
|
|
<if test="healthCertFrontImg != null">#{healthCertFrontImg},</if>
|
|
<if test="healthCertBackImg != null">#{healthCertBackImg},</if>
|
|
<if test="nutrityCertExpire != null">#{nutrityCertExpire},</if>
|
|
<if test="safetyCertExpire != null">#{safetyCertExpire},</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="updateKitchenStaffInfo" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo">
|
|
update kitchen_staff_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="staffNo != null and staffNo != ''">staff_no = #{staffNo},</if>
|
|
<if test="staffName != null and staffName != ''">staff_name = #{staffName},</if>
|
|
<if test="postName != null and postName != ''">post_name = #{postName},</if>
|
|
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
|
|
<if test="password != null and password != ''">password = #{password},</if>
|
|
<if test="sex != null">sex = #{sex},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="canteenId != null">canteen_id = #{canteenId},</if>
|
|
<if test="healthCertExpire != null">health_cert_expire = #{healthCertExpire},</if>
|
|
<if test="healthCertFrontImg != null">health_cert_front_img = #{healthCertFrontImg},</if>
|
|
<if test="healthCertBackImg != null">health_cert_back_img = #{healthCertBackImg},</if>
|
|
<if test="nutrityCertExpire != null">nutrity_cert_expire = #{nutrityCertExpire},</if>
|
|
<if test="safetyCertExpire != null">safety_cert_expire = #{safetyCertExpire},</if>
|
|
<if test="createBy != null">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 staff_id = #{staffId}
|
|
</update>
|
|
|
|
<delete id="deleteKitchenStaffInfoByStaffId" parameterType="Long">
|
|
delete from kitchen_staff_info where staff_id = #{staffId}
|
|
</delete>
|
|
|
|
<delete id="deleteKitchenStaffInfoByStaffIds" parameterType="String">
|
|
delete from kitchen_staff_info where staff_id in
|
|
<foreach item="staffId" collection="array" open="(" separator="," close=")">
|
|
#{staffId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |