<?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.hw.dms.mapper.DmsPlanLubeMapper" >
<resultMap type= "DmsPlanLube" id= "DmsPlanLubeResult" >
<result property= "planLubeId" column= "plan_lube_id" />
<result property= "planLubeCode" column= "plan_lube_code" />
<result property= "lubeLevel" column= "lube_level" />
<result property= "lubeGroup" column= "lube_group" />
<result property= "lubeSupervisor" column= "lube_supervisor" />
<result property= "lubeTime" column= "lube_time" />
<result property= "timeLimit" column= "time_limit" />
<result property= "jobId" column= "job_id" />
<result property= "cyclePeriod" column= "cycle_period" />
<result property= "createMethod" column= "create_method" />
<result property= "isFlag" column= "is_flag" />
<result property= "remark" column= "remark" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "cronExpression" column= "cron_expression" />
</resultMap>
<resultMap id= "DmsPlanLubeDmsPlanLubeDetailResult" type= "DmsPlanLube" extends= "DmsPlanLubeResult" >
<collection property= "dmsPlanLubeDetailList" notNullColumn= "sub_plan_lube_detail_id" javaType= "java.util.List" resultMap= "DmsPlanLubeDetailResult" />
</resultMap>
<resultMap type= "DmsPlanLubeDetail" id= "DmsPlanLubeDetailResult" >
<result property= "planLubeDetailId" column= "sub_plan_lube_detail_id" />
<result property= "planLubeId" column= "sub_plan_lube_id" />
<result property= "deviceId" column= "sub_device_id" />
<result property= "lubeStationId" column= "sub_lube_station_id" />
<result property= "lubeStandardId" column= "sub_lube_standard_id" />
<result property= "operationDescription" column= "sub_operation_description" />
<result property= "isFlag" column= "sub_is_flag" />
<result property= "remark" column= "sub_remark" />
<result property= "createBy" column= "sub_create_by" />
<result property= "createTime" column= "sub_create_time" />
<result property= "updateBy" column= "sub_update_by" />
<result property= "updateTime" column= "sub_update_time" />
</resultMap>
<sql id= "selectDmsPlanLubeVo" >
select plan_lube_id, plan_lube_code, lube_level, lube_group, lube_supervisor, lube_time, time_limit, job_id, cycle_period, create_method, is_flag, remark, create_by, create_time, update_by, update_time from dms_plan_lube
</sql>
<select id= "selectDmsPlanLubeList" parameterType= "DmsPlanLube" resultMap= "DmsPlanLubeResult" >
<include refid= "selectDmsPlanLubeVo" />
<where >
<if test= "planLubeCode != null and planLubeCode != ''" > and plan_lube_code = #{planLubeCode}</if>
<if test= "lubeLevel != null and lubeLevel != ''" > and lube_level = #{lubeLevel}</if>
<if test= "lubeGroup != null and lubeGroup != ''" > and lube_group = #{lubeGroup}</if>
<if test= "lubeSupervisor != null and lubeSupervisor != ''" > and lube_supervisor = #{lubeSupervisor}</if>
<if test= "lubeTime != null " > and lube_time = #{lubeTime}</if>
<if test= "timeLimit != null " > and time_limit = #{timeLimit}</if>
<if test= "jobId != null " > and job_id = #{jobId}</if>
<if test= "cyclePeriod != null and cyclePeriod != ''" > and cycle_period = #{cyclePeriod}</if>
<if test= "createMethod != null and createMethod != ''" > and create_method = #{createMethod}</if>
<if test= "isFlag != null and isFlag != ''" > and is_flag = #{isFlag}</if>
</where>
</select>
<select id= "selectDmsPlanLubeByPlanLubeId" parameterType= "Long" resultMap= "DmsPlanLubeResult" >
<include refid= "selectDmsPlanLubeVo" />
where plan_lube_id = #{planLubeId}
</select>
<insert id= "insertDmsPlanLube" parameterType= "DmsPlanLube" useGeneratedKeys= "true" keyProperty= "planLubeId" >
insert into dms_plan_lube
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "planLubeCode != null" > plan_lube_code,</if>
<if test= "lubeLevel != null" > lube_level,</if>
<if test= "lubeGroup != null" > lube_group,</if>
<if test= "lubeSupervisor != null" > lube_supervisor,</if>
<if test= "lubeTime != null" > lube_time,</if>
<if test= "timeLimit != null" > time_limit,</if>
<if test= "jobId != null" > job_id,</if>
<if test= "cyclePeriod != null" > cycle_period,</if>
<if test= "createMethod != null" > create_method,</if>
<if test= "isFlag != null and isFlag != ''" > is_flag,</if>
<if test= "remark != null" > remark,</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= "planLubeCode != null" > #{planLubeCode},</if>
<if test= "lubeLevel != null" > #{lubeLevel},</if>
<if test= "lubeGroup != null" > #{lubeGroup},</if>
<if test= "lubeSupervisor != null" > #{lubeSupervisor},</if>
<if test= "lubeTime != null" > #{lubeTime},</if>
<if test= "timeLimit != null" > #{timeLimit},</if>
<if test= "jobId != null" > #{jobId},</if>
<if test= "cyclePeriod != null" > #{cyclePeriod},</if>
<if test= "createMethod != null" > #{createMethod},</if>
<if test= "isFlag != null and isFlag != ''" > #{isFlag},</if>
<if test= "remark != null" > #{remark},</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= "updateDmsPlanLube" parameterType= "DmsPlanLube" >
update dms_plan_lube
<trim prefix= "SET" suffixOverrides= "," >
<if test= "planLubeCode != null" > plan_lube_code = #{planLubeCode},</if>
<if test= "lubeLevel != null" > lube_level = #{lubeLevel},</if>
<if test= "lubeGroup != null" > lube_group = #{lubeGroup},</if>
<if test= "lubeSupervisor != null" > lube_supervisor = #{lubeSupervisor},</if>
<if test= "lubeTime != null" > lube_time = #{lubeTime},</if>
<if test= "timeLimit != null" > time_limit = #{timeLimit},</if>
<if test= "jobId != null" > job_id = #{jobId},</if>
<if test= "cyclePeriod != null" > cycle_period = #{cyclePeriod},</if>
<if test= "createMethod != null" > create_method = #{createMethod},</if>
<if test= "isFlag != null and isFlag != ''" > is_flag = #{isFlag},</if>
<if test= "remark != null" > remark = #{remark},</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 plan_lube_id = #{planLubeId}
</update>
<delete id= "deleteDmsPlanLubeByPlanLubeId" parameterType= "Long" >
delete from dms_plan_lube where plan_lube_id = #{planLubeId}
</delete>
<delete id= "deleteDmsPlanLubeByPlanLubeIds" parameterType= "String" >
delete from dms_plan_lube where plan_lube_id in
<foreach item= "planLubeId" collection= "array" open= "(" separator= "," close= ")" >
#{planLubeId}
</foreach>
</delete>
<select id= "selectDmsPlanLubeJoinByPlanLubeCode" parameterType= "String" resultMap= "DmsPlanLubeDmsPlanLubeDetailResult" >
select a.plan_lube_id, a.plan_lube_code, a.lube_level, a.lube_group, a.lube_supervisor, a.lube_time, a.time_limit, a.job_id, a.cycle_period, a.create_method, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.plan_lube_detail_id as sub_plan_lube_detail_id, b.plan_lube_id as sub_plan_lube_id, b.device_id as sub_device_id, b.lube_station_id as sub_lube_station_id, b.lube_standard_id as sub_lube_standard_id, b.operation_description as sub_operation_description, b.is_flag as sub_is_flag, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from dms_plan_lube a
left join dms_plan_lube_detail b on b.plan_lube_id = a.plan_lube_id
where a.plan_lube_code = #{planLubeCode}
</select>
<select id= "selectPlanLubeJoinJobByPlanLubeId" parameterType= "Long" resultMap= "DmsPlanLubeResult" >
select a.plan_lube_id, a.plan_lube_code, a.lube_level, a.lube_group, a.lube_supervisor, a.lube_time, a.time_limit, a.job_id, a.cycle_period, a.create_method, a.is_flag, a.remark, a.create_by, a.create_time,
sj.cron_expression
from dms_plan_lube a
left join sys_job sj on a.job_id = sj.job_id
where a.plan_lube_id = #{planLubeId}
</select>
</mapper>