feat(dms): 添加定时任务生成巡检保养工单及维修流程闭环功能

- 实现巡检计划定时生成工单功能,每天0点自动执行
- 实现保养计划定时生成工单功能,每天0点自动执行
- 完善维修工单与故障报修状态联动机制
- 添加维修工单自动创建派工计划功能
- 实现维修工单完成时自动生成维修记录
- 优化数据库查询添加jdbcType类型声明
- 统一设备ID字段映射为machine_id保持一致性
- 添加日志记录便于问题追踪和系统监控
master
zangch@mesnac.com 2 days ago
parent 1b81528d0d
commit dd08f3bd18

@ -3,6 +3,7 @@ package com.aucma;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
*
@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
public class MESApplication
{
public static void main(String[] args)

@ -23,9 +23,15 @@ import com.aucma.dms.mapper.DmsBaseInspectRouteMapper;
import com.aucma.dms.mapper.DmsPlanInspectMapper;
import com.aucma.dms.service.IDmsPlanInspectService;
import com.aucma.quartz.util.CronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Date;
import java.util.List;
@ -38,12 +44,17 @@ import java.util.List;
@Service
public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
{
private static final Logger log = LoggerFactory.getLogger(DmsPlanInspectServiceImpl.class);
@Autowired
private DmsPlanInspectMapper dmsPlanInspectMapper;
/* @Autowired
private RemoteJobService remoteJobService;*/
@Autowired
private DmsBaseInspectRouteMapper dmsBaseInspectRouteMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
/**
*
@ -93,8 +104,11 @@ public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
{
List<DmsPlanInspect> dmsPlanInspects = dmsPlanInspectMapper.selectDmsPlanInspectList(dmsPlanInspect);
for (DmsPlanInspect planInspect : dmsPlanInspects) {
String routeName = dmsBaseInspectRouteMapper.selectRouteName(planInspect.getInspectRouteId());
planInspect.setRouteName(routeName);
// 只有当inspectRouteId不为空时才查询线路名称
if (planInspect.getInspectRouteId() != null) {
String routeName = dmsBaseInspectRouteMapper.selectRouteName(planInspect.getInspectRouteId());
planInspect.setRouteName(routeName);
}
}
@ -219,4 +233,77 @@ public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
return dmsPlanInspectMapper.selectPlanInspectJoinJobByInspectId(planInspectId);
}
/**
* 0
* cron
*/
@Scheduled(cron = "0 0 0 * * ?")
public void generateDailyInspectWorkOrders() {
log.info("========== 开始执行巡检工单生成任务 ==========");
int count = 0;
try {
// 查询今天需要执行的巡检计划plan_time <= 今天)
String sql = "SELECT plan_inspect_id, plan_inspect_code, inspect_type, inspect_route_id, " +
"device_amount, time_limit, cycle_period, performer " +
"FROM dms_plan_inspect " +
"WHERE (is_flag = '1' OR is_flag IS NULL) " +
"AND plan_time <= TRUNC(SYSDATE) + 1";
List<Map<String, Object>> plans = jdbcTemplate.queryForList(sql);
for (Map<String, Object> plan : plans) {
try {
Long planInspectId = ((Number) plan.get("PLAN_INSPECT_ID")).longValue();
String planInspectCode = (String) plan.get("PLAN_INSPECT_CODE");
Long inspectRouteId = plan.get("INSPECT_ROUTE_ID") != null ?
((Number) plan.get("INSPECT_ROUTE_ID")).longValue() : null;
// 检查今天是否已生成工单(避免重复)
String checkSql = "SELECT COUNT(1) FROM dms_bills_inspect_instance " +
"WHERE plan_inspect_code = ? AND TRUNC(create_time) = TRUNC(SYSDATE)";
Integer existCount = jdbcTemplate.queryForObject(checkSql, Integer.class, planInspectCode);
if (existCount != null && existCount > 0) {
log.debug("巡检计划[{}]今天已生成工单,跳过", planInspectCode);
continue;
}
// 生成巡检工单
String billsCode = Seq.getId(Seq.dmsBillsFaultInstanceSeqType, "XJ");
String insertSql = "INSERT INTO dms_bills_inspect_instance " +
"(inspect_instance_id, bills_inspect_code, plan_inspect_code, plan_inspect_id, " +
"inspect_route_id, bills_status, is_flag, create_time, create_by) " +
"VALUES (SEQ_DMS_BILLS_INSPECT_INSTANCE.NEXTVAL, ?, ?, ?, ?, '0', '1', SYSDATE, -1)";
jdbcTemplate.update(insertSql, billsCode, planInspectCode, planInspectId, inspectRouteId);
count++;
log.info("已为巡检计划[{}]生成工单[{}]", planInspectCode, billsCode);
// 更新计划的下次执行时间(根据周期计算)
updateInspectPlanNextTime(planInspectId);
} catch (Exception e) {
log.error("为巡检计划生成工单失败: {}", e.getMessage());
}
}
} catch (Exception e) {
log.error("查询巡检计划失败", e);
}
log.info("========== 巡检工单生成任务完成,生成数量: {} ==========", count);
}
/**
*
*/
private void updateInspectPlanNextTime(Long planInspectId) {
try {
// 根据周期计算下次执行时间(默认+1天
String updateSql = "UPDATE dms_plan_inspect SET plan_time = TRUNC(SYSDATE) + 1, update_time = SYSDATE WHERE plan_inspect_id = ?";
jdbcTemplate.update(updateSql, planInspectId);
log.debug("更新巡检计划[{}]下次执行时间", planInspectId);
} catch (Exception e) {
log.warn("更新巡检计划下次执行时间失败: {}", e.getMessage());
}
}
}

@ -11,10 +11,16 @@ import com.aucma.dms.domain.DmsPlanMaintDetail;
import com.aucma.dms.mapper.DmsPlanMaintMapper;
import com.aucma.dms.service.IDmsPlanMaintService;
import com.aucma.quartz.util.CronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -27,8 +33,14 @@ import java.util.List;
*/
@Service
public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
private static final Logger log = LoggerFactory.getLogger(DmsPlanMaintServiceImpl.class);
@Autowired
private DmsPlanMaintMapper dmsPlanMaintMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
/* @Autowired
private RemoteJobService remoteJobService;*/
@ -271,4 +283,65 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
return dmsPlanMaint;
}
/**
* 0
* cron
*/
@Scheduled(cron = "0 0 0 * * ?")
public void generateDailyMaintWorkOrders() {
log.info("========== 开始执行保养工单生成任务 ==========");
int count = 0;
try {
// 查询今天需要执行的保养计划maint_time <= 今天)
String sql = "SELECT plan_maint_id, plan_maint_code, maint_level, maint_group, " +
"maint_supervisor, time_limit, cycle_period, cron_expression " +
"FROM dms_plan_maint " +
"WHERE (is_flag = 0 OR is_flag IS NULL) " +
"AND maint_time <= TRUNC(SYSDATE) + 1";
List<Map<String, Object>> plans = jdbcTemplate.queryForList(sql);
for (Map<String, Object> plan : plans) {
try {
Long planMaintId = ((Number) plan.get("PLAN_MAINT_ID")).longValue();
String planMaintCode = (String) plan.get("PLAN_MAINT_CODE");
// 检查今天是否已生成工单(避免重复)
String checkSql = "SELECT COUNT(1) FROM dms_bills_maint_instance " +
"WHERE plan_maint_code = ? AND TRUNC(create_time) = TRUNC(SYSDATE)";
Integer existCount = jdbcTemplate.queryForObject(checkSql, Integer.class, planMaintCode);
if (existCount != null && existCount > 0) {
log.debug("保养计划[{}]今天已生成工单,跳过", planMaintCode);
continue;
}
// 生成保养工单
String billsCode = Seq.getId(Seq.dmsBillsFaultInstanceSeqType, "BY");
String insertSql = "INSERT INTO dms_bills_maint_instance " +
"(maint_instance_id, bills_maint_code, plan_maint_code, plan_maint_id, " +
"bills_status, is_flag, create_time, create_by) " +
"VALUES (SEQ_DMS_BILLS_MAINT_INSTANCE.NEXTVAL, ?, ?, ?, '0', '1', SYSDATE, -1)";
jdbcTemplate.update(insertSql, billsCode, planMaintCode, planMaintId);
count++;
log.info("已为保养计划[{}]生成工单[{}]", planMaintCode, billsCode);
// 更新计划的下次执行时间
String cronExpression = (String) plan.get("CRON_EXPRESSION");
if (cronExpression != null && !cronExpression.isEmpty()) {
Date nextTime = CronUtils.getNextExecution(cronExpression);
String updateSql = "UPDATE dms_plan_maint SET maint_time = ?, update_time = SYSDATE WHERE plan_maint_id = ?";
jdbcTemplate.update(updateSql, nextTime, planMaintId);
}
} catch (Exception e) {
log.error("为保养计划生成工单失败: {}", e.getMessage());
}
}
} catch (Exception e) {
log.error("查询保养计划失败", e);
}
log.info("========== 保养工单生成任务完成,生成数量: {} ==========", count);
}
}

@ -3,18 +3,19 @@ package com.aucma.dms.service.impl;
import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.SecurityUtils;
import com.aucma.common.utils.uuid.Seq;
import com.aucma.dms.domain.DmsRepairMaterial;
import com.aucma.dms.domain.DmsRepairProject;
import com.aucma.dms.domain.DmsRepairWorkOrder;
import com.aucma.dms.mapper.DmsRepairMaterialMapper;
import com.aucma.dms.mapper.DmsRepairProjectMapper;
import com.aucma.dms.mapper.DmsRepairWorkOrderMapper;
import com.aucma.dms.domain.*;
import com.aucma.dms.mapper.*;
import com.aucma.dms.service.IDmsDispatchPlanService;
import com.aucma.dms.service.IDmsRepairRecordService;
import com.aucma.dms.service.IDmsRepairWorkOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -27,6 +28,8 @@ import java.util.List;
@Service
public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService {
private static final Logger log = LoggerFactory.getLogger(DmsRepairWorkOrderServiceImpl.class);
@Autowired
private DmsRepairWorkOrderMapper dmsRepairWorkOrderMapper;
@ -35,6 +38,15 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
@Autowired
private DmsRepairMaterialMapper dmsRepairMaterialMapper;
@Autowired
private DmsBillsFaultInstanceMapper dmsBillsFaultInstanceMapper;
@Autowired
private IDmsDispatchPlanService dmsDispatchPlanService;
@Autowired
private IDmsRepairRecordService dmsRepairRecordService;
/**
*
@ -126,6 +138,13 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
// 插入维修材料明细
insertRepairMaterials(dmsRepairWorkOrder);
// 【断点1修复】如果关联了故障报修更新故障报修状态为“已创建工单”
if (dmsRepairWorkOrder.getFaultInstanceId() != null) {
updateFaultInstanceStatus(dmsRepairWorkOrder.getFaultInstanceId(), "1"); // 1-维修中
log.info("维修工单[{}]关联故障报修[{}],已更新故障报修状态",
dmsRepairWorkOrder.getWorkOrderCode(), dmsRepairWorkOrder.getFaultInstanceId());
}
return rows;
}
@ -191,6 +210,7 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
* @param dmsRepairWorkOrder
* @return
*/
@Transactional
@Override
public int dispatchWorkOrder(DmsRepairWorkOrder dmsRepairWorkOrder) {
DmsRepairWorkOrder updateEntity = new DmsRepairWorkOrder();
@ -201,7 +221,16 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
updateEntity.setUpdateTime(DateUtils.getNowDate());
updateEntity.setUpdateBy(SecurityUtils.getUserId());
return dmsRepairWorkOrderMapper.updateDmsRepairWorkOrder(updateEntity);
int rows = dmsRepairWorkOrderMapper.updateDmsRepairWorkOrder(updateEntity);
// 【断点2修复】自动创建派工计划
DmsRepairWorkOrder workOrder = dmsRepairWorkOrderMapper.selectDmsRepairWorkOrderByWorkOrderId(dmsRepairWorkOrder.getWorkOrderId());
if (workOrder != null) {
createDispatchPlanFromWorkOrder(workOrder, dmsRepairWorkOrder.getExecutorId(), dmsRepairWorkOrder.getExecutorName());
log.info("维修工单[{}]派工成功,已自动创建派工计划", workOrder.getWorkOrderCode());
}
return rows;
}
/**
@ -228,8 +257,12 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
* @param dmsRepairWorkOrder
* @return
*/
@Transactional
@Override
public int completeWorkOrder(DmsRepairWorkOrder dmsRepairWorkOrder) {
// 查询完整工单信息
DmsRepairWorkOrder workOrder = dmsRepairWorkOrderMapper.selectDmsRepairWorkOrderByWorkOrderId(dmsRepairWorkOrder.getWorkOrderId());
DmsRepairWorkOrder updateEntity = new DmsRepairWorkOrder();
updateEntity.setWorkOrderId(dmsRepairWorkOrder.getWorkOrderId());
updateEntity.setOrderStatus("3"); // 已完成
@ -240,7 +273,22 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
updateEntity.setUpdateTime(DateUtils.getNowDate());
updateEntity.setUpdateBy(SecurityUtils.getUserId());
return dmsRepairWorkOrderMapper.updateDmsRepairWorkOrder(updateEntity);
int rows = dmsRepairWorkOrderMapper.updateDmsRepairWorkOrder(updateEntity);
// 【断点3修复】自动创建维修记录
if (workOrder != null) {
createRepairRecordFromWorkOrder(workOrder, dmsRepairWorkOrder);
log.info("维修工单[{}]完成,已自动创建维修记录", workOrder.getWorkOrderCode());
// 如果关联了故障报修,更新故障报修状态为“已完成”
if (workOrder.getFaultInstanceId() != null) {
updateFaultInstanceStatus(workOrder.getFaultInstanceId(), "2"); // 2-维修完成
log.info("维修工单[{}]完成,已更新关联故障报修[{}]状态",
workOrder.getWorkOrderCode(), workOrder.getFaultInstanceId());
}
}
return rows;
}
/**
@ -292,4 +340,106 @@ public class DmsRepairWorkOrderServiceImpl implements IDmsRepairWorkOrderService
}
}
}
// ==================== 业务流程闭环辅助方法 ====================
/**
* 1
*
* @param faultInstanceId ID
* @param billsStatus 0- 1- 2-
*/
private void updateFaultInstanceStatus(Long faultInstanceId, String billsStatus) {
try {
DmsBillsFaultInstance updateEntity = new DmsBillsFaultInstance();
updateEntity.setRepairInstanceId(faultInstanceId);
updateEntity.setBillsStatus(billsStatus);
updateEntity.setUpdateTime(DateUtils.getNowDate());
updateEntity.setUpdateBy(SecurityUtils.getUserId());
dmsBillsFaultInstanceMapper.updateDmsBillsFaultInstance(updateEntity);
} catch (Exception e) {
log.error("更新故障报修[{}]状态失败: {}", faultInstanceId, e.getMessage());
}
}
/**
* 2
*
* @param workOrder
* @param executorId ID
* @param executorName
*/
private void createDispatchPlanFromWorkOrder(DmsRepairWorkOrder workOrder, Long executorId, String executorName) {
try {
DmsDispatchPlan dispatchPlan = new DmsDispatchPlan();
// 关联工单信息
dispatchPlan.setWorkOrderId(workOrder.getWorkOrderId());
dispatchPlan.setWorkOrderCode(workOrder.getWorkOrderCode());
// 设备信息
dispatchPlan.setDeviceId(workOrder.getDeviceId());
dispatchPlan.setDeviceCode(workOrder.getDeviceCode());
dispatchPlan.setDeviceName(workOrder.getDeviceName());
// 派工类型:单人派工
dispatchPlan.setDispatchType("1");
// 执行人信息
dispatchPlan.setExecutorId(executorId);
dispatchPlan.setExecutorName(executorName);
// 时间要求
dispatchPlan.setRequireStartTime(workOrder.getPlanStartTime());
dispatchPlan.setRequireEndTime(workOrder.getPlanEndTime());
// 优先级
dispatchPlan.setPriority(workOrder.getPriority());
// 派工说明
dispatchPlan.setDispatchNotes("由维修工单[" + workOrder.getWorkOrderCode() + "]自动生成");
dmsDispatchPlanService.insertDmsDispatchPlan(dispatchPlan);
} catch (Exception e) {
log.error("为维修工单[{}]创建派工计划失败: {}", workOrder.getWorkOrderCode(), e.getMessage());
}
}
/**
* 3
*
* @param workOrder
* @param completeInfo
*/
private void createRepairRecordFromWorkOrder(DmsRepairWorkOrder workOrder, DmsRepairWorkOrder completeInfo) {
try {
DmsRepairRecord repairRecord = new DmsRepairRecord();
// 关联工单信息
repairRecord.setWorkOrderId(workOrder.getWorkOrderId());
repairRecord.setWorkOrderCode(workOrder.getWorkOrderCode());
// 设备信息
repairRecord.setDeviceId(workOrder.getDeviceId());
repairRecord.setDeviceCode(workOrder.getDeviceCode());
repairRecord.setDeviceName(workOrder.getDeviceName());
// 故障信息
repairRecord.setFaultPhenomenon(workOrder.getFaultDescription());
// 维修人员
repairRecord.setRepairerId(workOrder.getExecutorId());
repairRecord.setRepairerName(workOrder.getExecutorName());
// 维修时间
repairRecord.setStartTime(workOrder.getActualStartTime());
repairRecord.setEndTime(new Date());
// 维修结果
repairRecord.setRepairResult(completeInfo.getRepairResult());
// 维修工时
if (completeInfo.getRepairHours() != null) {
repairRecord.setRepairHours(completeInfo.getRepairHours());
}
// 维修费用
if (completeInfo.getActualCost() != null) {
repairRecord.setRepairCost(completeInfo.getActualCost());
}
// 停机时长(如果有)
if (workOrder.getShutdownDuration() != null) {
repairRecord.setShutdownDuration(workOrder.getShutdownDuration().intValue());
}
dmsRepairRecordService.insertDmsRepairRecord(repairRecord);
} catch (Exception e) {
log.error("为维修工单[{}]创建维修记录失败: {}", workOrder.getWorkOrderCode(), e.getMessage());
}
}
}

@ -109,6 +109,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(*) from dms_inspect_route_detail where inspect_route_id = #{inspectRouteId}
</select>
<select id="selectRouteName" resultType="java.lang.String" parameterType="java.lang.Long">
SELECT route_name routeName FROM dms_base_inspect_route where inspect_route_id = #{inspectRouteId}
SELECT route_name routeName FROM dms_base_inspect_route where inspect_route_id = #{inspectRouteId,jdbcType=NUMERIC}
</select>
</mapper>

@ -23,9 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
line_step,
machine_id as device_id,
machine_id,
inspect_standard,
is_flag,
remark
inspect_standard
from dms_inspect_route_detail
</sql>
@ -34,9 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="inspectRouteId != null "> and inspect_route_id = #{inspectRouteId}</if>
<if test="lineStep != null "> and line_step = #{lineStep}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceId != null "> and machine_id = #{deviceId}</if>
<if test="inspectStandard != null and inspectStandard != ''"> and inspect_standard = #{inspectStandard}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
</where>
</select>
@ -54,21 +51,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="routeDetailId != null">route_detail_id,</if>
<if test="inspectRouteId != null">inspect_route_id,</if>
<if test="lineStep != null">line_step,</if>
<if test="deviceId != null">device_id,</if>
<if test="machineId != null">machine_id,</if>
<if test="deviceId != null">machine_id,</if>
<if test="inspectStandard != null">inspect_standard,</if>
<if test="isFlag != null and isFlag != ''">is_flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeDetailId != null">#{routeDetailId,jdbcType=NUMERIC},</if>
<if test="inspectRouteId != null">#{inspectRouteId,jdbcType=NUMERIC},</if>
<if test="lineStep != null">#{lineStep,jdbcType=NUMERIC},</if>
<if test="deviceId != null">#{deviceId,jdbcType=NUMERIC},</if>
<if test="machineId != null">#{machineId,jdbcType=NUMERIC},</if>
<if test="inspectStandard != null">#{inspectStandard},</if>
<if test="isFlag != null and isFlag != ''">#{isFlag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
@ -77,11 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="inspectRouteId != null">inspect_route_id = #{inspectRouteId},</if>
<if test="lineStep != null">line_step = #{lineStep},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="machineId != null">machine_id = #{machineId},</if>
<if test="deviceId != null">machine_id = #{deviceId},</if>
<if test="inspectStandard != null">inspect_standard = #{inspectStandard},</if>
<if test="isFlag != null and isFlag != ''">is_flag = #{isFlag},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where route_detail_id = #{routeDetailId}
</update>

@ -33,17 +33,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDmsPlanInspectList" parameterType="DmsPlanInspect" resultMap="DmsPlanInspectResult">
<include refid="selectDmsPlanInspectVo"/>
<where>
<if test="planInspectCode != null and planInspectCode != ''"> and plan_inspect_code = #{planInspectCode}</if>
<if test="planInspectName != null and planInspectName != ''"> and plan_inspect_name like concat('%', #{planInspectName}, '%')</if>
<if test="inspectType != null and inspectType != ''"> and inspect_type = #{inspectType}</if>
<if test="inspectRouteId != null "> and inspect_route_id = #{inspectRouteId}</if>
<if test="deviceAmount != null "> and device_amount = #{deviceAmount}</if>
<if test="planTime != null "> and plan_time = #{planTime}</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="performer != null and performer != ''"> and performer = #{performer}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="planInspectCode != null and planInspectCode != ''"> and plan_inspect_code = #{planInspectCode,jdbcType=VARCHAR}</if>
<if test="planInspectName != null and planInspectName != ''"> and plan_inspect_name like '%' || #{planInspectName,jdbcType=VARCHAR} || '%'</if>
<if test="inspectType != null and inspectType != ''"> and inspect_type = #{inspectType,jdbcType=VARCHAR}</if>
<if test="inspectRouteId != null "> and inspect_route_id = #{inspectRouteId,jdbcType=NUMERIC}</if>
<if test="deviceAmount != null "> and device_amount = #{deviceAmount,jdbcType=NUMERIC}</if>
<if test="planTime != null "> and plan_time = #{planTime,jdbcType=TIMESTAMP}</if>
<if test="timeLimit != null "> and time_limit = #{timeLimit,jdbcType=NUMERIC}</if>
<if test="jobId != null "> and job_id = #{jobId,jdbcType=NUMERIC}</if>
<if test="cyclePeriod != null and cyclePeriod != ''"> and cycle_period = #{cyclePeriod,jdbcType=VARCHAR}</if>
<if test="performer != null and performer != ''"> and performer = #{performer,jdbcType=VARCHAR}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag,jdbcType=VARCHAR}</if>
</where>
order by create_time desc
</select>
@ -79,46 +79,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planInspectId != null">#{planInspectId,jdbcType=NUMERIC},</if>
<if test="planInspectCode != null">#{planInspectCode},</if>
<if test="planInspectName != null">#{planInspectName},</if>
<if test="inspectType != null">#{inspectType},</if>
<if test="planInspectCode != null">#{planInspectCode,jdbcType=VARCHAR},</if>
<if test="planInspectName != null">#{planInspectName,jdbcType=VARCHAR},</if>
<if test="inspectType != null">#{inspectType,jdbcType=VARCHAR},</if>
<if test="inspectRouteId != null">#{inspectRouteId,jdbcType=NUMERIC},</if>
<if test="deviceAmount != null">#{deviceAmount,jdbcType=NUMERIC},</if>
<if test="planTime != null">#{planTime},</if>
<if test="planTime != null">#{planTime,jdbcType=TIMESTAMP},</if>
<if test="timeLimit != null">#{timeLimit,jdbcType=NUMERIC},</if>
<if test="jobId != null">#{jobId,jdbcType=NUMERIC},</if>
<if test="cyclePeriod != null">#{cyclePeriod},</if>
<if test="performer != null">#{performer},</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>
<if test="cyclePeriod != null">#{cyclePeriod,jdbcType=VARCHAR},</if>
<if test="performer != null">#{performer,jdbcType=VARCHAR},</if>
<if test="isFlag != null and isFlag != ''">#{isFlag,jdbcType=VARCHAR},</if>
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
<if test="createBy != null">#{createBy,jdbcType=NUMERIC},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateBy != null">#{updateBy,jdbcType=NUMERIC},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateDmsPlanInspect" parameterType="DmsPlanInspect">
update dms_plan_inspect
<trim prefix="SET" suffixOverrides=",">
<if test="planInspectCode != null">plan_inspect_code = #{planInspectCode},</if>
<if test="planInspectName != null">plan_inspect_name = #{planInspectName},</if>
<if test="inspectType != null">inspect_type = #{inspectType},</if>
<if test="inspectRouteId != null">inspect_route_id = #{inspectRouteId},</if>
<if test="deviceAmount != null">device_amount = #{deviceAmount},</if>
<if test="planTime != null">plan_time = #{planTime},</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="performer != null">performer = #{performer},</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>
<if test="planInspectCode != null">plan_inspect_code = #{planInspectCode,jdbcType=VARCHAR},</if>
<if test="planInspectName != null">plan_inspect_name = #{planInspectName,jdbcType=VARCHAR},</if>
<if test="inspectType != null">inspect_type = #{inspectType,jdbcType=VARCHAR},</if>
<if test="inspectRouteId != null">inspect_route_id = #{inspectRouteId,jdbcType=BIGINT},</if>
<if test="deviceAmount != null">device_amount = #{deviceAmount,jdbcType=INTEGER},</if>
<if test="planTime != null">plan_time = #{planTime,jdbcType=TIMESTAMP},</if>
<if test="timeLimit != null">time_limit = #{timeLimit,jdbcType=INTEGER},</if>
<if test="jobId != null">job_id = #{jobId,jdbcType=BIGINT},</if>
<if test="cyclePeriod != null">cycle_period = #{cyclePeriod,jdbcType=VARCHAR},</if>
<if test="performer != null">performer = #{performer,jdbcType=VARCHAR},</if>
<if test="isFlag != null and isFlag != ''">is_flag = #{isFlag,jdbcType=VARCHAR},</if>
<if test="remark != null">remark = #{remark,jdbcType=VARCHAR},</if>
<if test="createBy != null">create_by = #{createBy,jdbcType=BIGINT},</if>
<if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateBy != null">update_by = #{updateBy,jdbcType=BIGINT},</if>
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
</trim>
where plan_inspect_id = #{planInspectId}
where plan_inspect_id = #{planInspectId,jdbcType=BIGINT}
</update>
<delete id="deleteDmsPlanInspectByPlanInspectId" parameterType="Long">
@ -133,21 +133,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectPlanInspectJoinJobByInspectId" parameterType="Long" resultMap="DmsPlanInspectResult">
select a.plan_inspect_id, a.plan_inspect_code, a.plan_inspect_name, a.inspect_type,
a.inspect_route_id, a.device_amount, a.plan_time, a.cycle_period,a.time_limit,a.job_id,
a.performer, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,b.cron_expression from dms_plan_inspect a
left join sys_job b on a.job_id = b.job_id
where a.plan_inspect_id = #{planInspectId}
select plan_inspect_id, plan_inspect_code, plan_inspect_name, inspect_type,
inspect_route_id, device_amount, plan_time, cycle_period, time_limit, job_id,
performer, is_flag, remark, create_by, create_time, update_by, update_time
from dms_plan_inspect
where plan_inspect_id = #{planInspectId}
</select>
<select id="selectPlanInspectJoinJobByInspectId1" resultType="com.aucma.dms.domain.DmsPlanInspect"
parameterType="java.lang.String">
select a.plan_inspect_id, a.plan_inspect_code, a.plan_inspect_name, a.inspect_type,
a.inspect_route_id, a.device_amount, a.plan_time, a.cycle_period,a.time_limit,a.job_id,
a.performer, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,b.cron_expression from dms_plan_inspect a
left join sys_job b on a.job_id = b.job_id
where a.plan_inspect_code = #{planInspectId}
select plan_inspect_id, plan_inspect_code, plan_inspect_name, inspect_type,
inspect_route_id, device_amount, plan_time, cycle_period, time_limit, job_id,
performer, is_flag, remark, create_by, create_time, update_by, update_time
from dms_plan_inspect
where plan_inspect_code = #{planInspectCode}
</select>
</mapper>

@ -47,9 +47,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.plan_maint_detail_id = #{planMaintDetailId}
</select>
<insert id="insertDmsPlanMaintDetail" parameterType="DmsPlanMaintDetail" useGeneratedKeys="true" keyProperty="planMaintDetailId">
<insert id="insertDmsPlanMaintDetail" parameterType="DmsPlanMaintDetail">
<selectKey keyProperty="planMaintDetailId" resultType="long" order="BEFORE">
SELECT SEQ_DMS_PLAN_MAINT_DETAIL.NEXTVAL FROM DUAL
</selectKey>
insert into dms_plan_maint_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planMaintDetailId != null">plan_maint_detail_id,</if>
<if test="planMaintId != null">plan_maint_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="maintStationId != null">maint_station_id,</if>
@ -63,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planMaintDetailId != null">#{planMaintDetailId},</if>
<if test="planMaintId != null">#{planMaintId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="maintStationId != null">#{maintStationId},</if>

Loading…
Cancel
Save