|
|
|
<?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.shxy.xymanager_dao.dao.SchedulesDao">
|
|
|
|
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.Schedules">
|
|
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap id="ScheduleAndRule" type="com.shxy.xymanager_common.dto.ScheduleAndRuleDto">
|
|
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
|
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.ScheduleDetailsDto">
|
|
|
|
<id column="ruleid" jdbcType="INTEGER" property="id"/>
|
|
|
|
<result column="schedule_id" jdbcType="INTEGER" property="scheduleId"/>
|
|
|
|
<result column="hour" jdbcType="INTEGER" property="hour"/>
|
|
|
|
<result column="minute" jdbcType="INTEGER" property="minute"/>
|
|
|
|
<result column="preset" jdbcType="INTEGER" property="preset"/>
|
|
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
id, name,remark,status,create_time, update_time
|
|
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
|
select
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from schedules
|
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectAll" resultMap="ScheduleAndRule">
|
|
|
|
select
|
|
|
|
x.id as id,
|
|
|
|
x.name as name,
|
|
|
|
x.remark as remark,
|
|
|
|
x.status as status,
|
|
|
|
y.id as ruleid,
|
|
|
|
y.schedule_id as schedule_id,
|
|
|
|
y.hour as hour,
|
|
|
|
y.minute as minute,
|
|
|
|
y.preset as preset
|
|
|
|
from schedules x,
|
|
|
|
schedule_detailss y
|
|
|
|
where y.schedule_id = x.id and x.status = #{status} order by x.create_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSingle" resultMap="ScheduleAndRule">
|
|
|
|
select
|
|
|
|
x.id as id,
|
|
|
|
x.name as name,
|
|
|
|
x.remark as remark,
|
|
|
|
x.status as status,
|
|
|
|
y.id as ruleid,
|
|
|
|
y.schedule_id as schedule_id,
|
|
|
|
y.hour as hour,
|
|
|
|
y.minute as minute,
|
|
|
|
y.preset as preset
|
|
|
|
from schedules x,
|
|
|
|
schedule_details y
|
|
|
|
where y.schedule_id = x.id and x.status = #{status} and x.id = #{id} limit 1
|
|
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.Schedules">
|
|
|
|
insert into schedules (id, term_id, channel_id,
|
|
|
|
hour, minute, preset_id,
|
|
|
|
create_time, update_time)
|
|
|
|
values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER}, #{channelId,jdbcType=TINYINT},
|
|
|
|
#{hour,jdbcType=TINYINT}, #{minute,jdbcType=TINYINT}, #{presetId,jdbcType=INTEGER},
|
|
|
|
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.Schedules" keyProperty="id">
|
|
|
|
insert into schedules
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="name != null">
|
|
|
|
name,
|
|
|
|
</if>
|
|
|
|
<if test="remark != null">
|
|
|
|
remark,
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
status,
|
|
|
|
</if>
|
|
|
|
<if test="createTime != null">
|
|
|
|
create_time,
|
|
|
|
</if>
|
|
|
|
<if test="updateTime != null">
|
|
|
|
update_time,
|
|
|
|
</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="name != null">
|
|
|
|
#{name},
|
|
|
|
</if>
|
|
|
|
<if test="remark != null">
|
|
|
|
#{remark},
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
#{status},
|
|
|
|
</if>
|
|
|
|
<if test="createTime != null">
|
|
|
|
#{createTime},
|
|
|
|
</if>
|
|
|
|
<if test="updateTime != null">
|
|
|
|
#{updateTime},
|
|
|
|
</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateStatusById">
|
|
|
|
update schedules
|
|
|
|
set status = #{status},
|
|
|
|
update_time = #{updateat}
|
|
|
|
where id in
|
|
|
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
|
|
|
#{item.id}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.Schedules">
|
|
|
|
update schedules
|
|
|
|
<set>
|
|
|
|
<if test="name != null">
|
|
|
|
name = #{name},
|
|
|
|
</if>
|
|
|
|
<if test="remark != null">
|
|
|
|
remark = #{remark},
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
status = #{status},
|
|
|
|
</if>
|
|
|
|
<if test="updateTime != null">
|
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
|
</if>
|
|
|
|
</set>
|
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
|
</update>
|
|
|
|
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.Schedules">
|
|
|
|
update schedules
|
|
|
|
set term_id = #{termId,jdbcType=INTEGER},
|
|
|
|
channel_id = #{channelId,jdbcType=TINYINT},
|
|
|
|
hour = #{hour,jdbcType=TINYINT},
|
|
|
|
minute = #{minute,jdbcType=TINYINT},
|
|
|
|
preset_id = #{presetId,jdbcType=INTEGER},
|
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
|
</update>
|
|
|
|
</mapper>
|