138 lines
6.6 KiB
138 lines
6.6 KiB
<?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.zc.business.mapper.DcShiftsMapper">
|
|
|
|
<resultMap type="DcShifts" id="DcShiftsResult">
|
|
<result property="id" column="id" />
|
|
|
|
<result property="employeesId" column="employees_id" />
|
|
<result property="date" column="date" />
|
|
<result property="startTime" column="start_time" />
|
|
<result property="endTime" column="end_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="name" column="name" />
|
|
<result property="contactNumber" column="contact_number" />
|
|
<result property="postName" column="post_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectDcShiftsVo">
|
|
select shifts.id, shifts.employees_id,
|
|
employees.name,employees.contact_number,post.post_name,
|
|
shifts.date, shifts.start_time, shifts.end_time,
|
|
shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts
|
|
left join dc_employees as employees on employees.id=shifts.employees_id
|
|
left join sys_post as post on employees.post_id=post.post_id
|
|
</sql>
|
|
|
|
<select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult">
|
|
<include refid="selectDcShiftsVo"/>
|
|
<where>
|
|
<if test="employeesId != null "> and shifts.employees_id = #{employeesId}</if>
|
|
<if test="date != null "> and shifts.date = #{date}</if>
|
|
</where>
|
|
order by date desc
|
|
</select>
|
|
|
|
<select id="selectDcShiftsById" parameterType="Long" resultMap="DcShiftsResult">
|
|
<include refid="selectDcShiftsVo"/>
|
|
where shifts.id = #{id}
|
|
</select>
|
|
<select id="selectDcShiftsByEmployeesId" parameterType="Long" resultMap="DcShiftsResult">
|
|
<include refid="selectDcShiftsVo"/>
|
|
where shifts.employees_id = #{id}
|
|
</select>
|
|
<select id="contactNumber" resultType="java.util.HashMap">
|
|
select id from dc_employees where contact_number=#{contactNumber}
|
|
</select>
|
|
<select id="selectStationId" resultType="java.util.HashMap">
|
|
select id from dc_organization where organization_name=#{stationName}
|
|
</select>
|
|
<select id="selectDcShiftsByCreateTime" resultType="com.zc.business.domain.DcShifts">
|
|
select shifts.id, shifts.employees_id,
|
|
employees.name,employees.contact_number,post.post_name,
|
|
shifts.date, shifts.start_time, shifts.end_time,
|
|
shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts
|
|
left join dc_employees as employees on employees.id=shifts.employees_id
|
|
left join sys_post as post on employees.post_id=post.post_id
|
|
where shifts.id=#{id}
|
|
</select>
|
|
<select id="selectDcShiftsRecord" resultType="com.zc.business.domain.DcShiftsRecord">
|
|
select record.id ,record.operator,record.operation_type,
|
|
user.nick_name,
|
|
record.operation_time,record.modify_content,
|
|
record.shifts_date from dc_shifts_record as record
|
|
left join sys_user as user on record.operator=user.user_id
|
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertDcShifts" parameterType="DcShifts" useGeneratedKeys="true" keyProperty="id">
|
|
insert into dc_shifts
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="employeesId != null">employees_id,</if>
|
|
<if test="date != null">date,</if>
|
|
<if test="startTime != null">start_time,</if>
|
|
<if test="endTime != null">end_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="employeesId != null">#{employeesId},</if>
|
|
<if test="date != null">#{date},</if>
|
|
<if test="startTime != null">#{startTime},</if>
|
|
<if test="endTime != null">#{endTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="insertDcShiftsRecord" parameterType="DcShiftsRecord">
|
|
insert into dc_shifts_record
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="operator != null">operator,</if>
|
|
<if test="operationType != null and operationType != ''">operation_type,</if>
|
|
<if test="operationTime != null">operation_time,</if>
|
|
<if test="modifyContent != null and modifyContent != ''">modify_content,</if>
|
|
<if test="shiftsDate != null">shifts_date,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="operator != null">#{operator},</if>
|
|
<if test="operationType != null and operationType != ''">#{operationType},</if>
|
|
<if test="operationTime != null">#{operationTime},</if>
|
|
<if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if>
|
|
<if test="shiftsDate != null">#{shiftsDate},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateDcShifts" parameterType="DcShifts">
|
|
update dc_shifts
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="employeesId != null">employees_id = #{employeesId},</if>
|
|
<if test="date != null">date = #{date},</if>
|
|
<if test="startTime != null">start_time = #{startTime},</if>
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteDcShiftsById" parameterType="Long">
|
|
delete from dc_shifts where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteDcShiftsByIds" parameterType="String">
|
|
delete from dc_shifts where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|