济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

190 lines
10 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,shifts.station,
employees.name,employees.contact_number,post.post_name,organization.organization_name,
shifts.date, shifts.start_time, shifts.end_time,shifts.scheduling,
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
left join dc_organization as organization on organization.id=shifts.station
</sql>
<select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult">
select DISTINCT shifts.id,
shifts.station,organization.organization_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
left join dc_organization as organization on organization.id=shifts.station
<where>
<if test="station != null "> and shifts.station = #{station}</if>
<if test="employeesId != null "> and shifts.employees_id = #{employeesId}</if>
<if test="date != null "> and shifts.date = #{date}</if>
<if test="name != null and name != ''"> and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%')</if>
</where>
GROUP BY shifts.date,shifts.station
order by shifts.date desc
</select>
<select id="selectDcShiftsById" parameterType="Long" resultMap="DcShiftsResult">
<include refid="selectDcShiftsVo"/>
where shifts.id = #{id}
</select>
<select id="selectDcShiftsByStationId" resultMap="DcShiftsResult">
select DISTINCT shifts.scheduling,shifts.employees_id,shifts.station,shifts.id,employees.contact_number,
organization.organization_name ,employees.name from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
left join dc_organization as organization on organization.id=shifts.station
where shifts.station = #{station}
and shifts.date =#{date}
</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.station,
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
<where>
<if test="date != null "> and record.shifts_date = #{date}</if>
<if test="station != null and station !='' "> and record.station = #{station}</if>
</where>
</select>
<select id="selectStation" resultType="java.util.HashMap">
select shifts.scheduling,shifts.employees_id employeesId,shifts.station,shifts.id,
organization.organization_name organizationName,employees.name from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
left join dc_organization as organization on organization.id=shifts.station
where shifts.date=#{date} and station=#{station}
</select>
<select id="selectStationDate" resultType="com.zc.business.domain.DcShiftsList">
select DISTINCT shifts.scheduling,shifts.employees_id,shifts.station,shifts.id,employees.contact_number,
organization.organization_name ,employees.name from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
left join dc_organization as organization on organization.id=shifts.station
where shifts.date=#{date} and station=#{station}
<if test="name != null and name != ''"> and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%')</if>
</select>
<select id="selectExist" resultType="java.lang.Long">
select count(1) from dc_shifts where date=#{date}
and employees_id=#{employeesId} and scheduling=#{scheduling} and station=#{station}
</select>
<select id="selectDcShiftsDeleteList" resultType="com.zc.business.domain.DcShifts">
select id from dc_shifts where date=#{date} and station=#{station}
</select>
<select id="selectEmp" resultType="java.util.HashMap">
select id from dc_employees where organization_id=#{organizationId} and name=#{name}
</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>
<if test="scheduling != null">scheduling,</if>
<if test="station != null">station,</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>
<if test="scheduling != null">#{scheduling},</if>
<if test="station != null">#{station},</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>
<if test="station != null">station,</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>
<if test="station != null">#{station},</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>
<if test="scheduling != null">scheduling = #{scheduling},</if>
<if test="station != null">station = #{station},</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>