Commit d3f66440 authored by 王蔡翾's avatar 王蔡翾
Browse files

初始化

parents
package com.example.operation_platform.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.operation_platform.model.dto.OperationRecordDTO;
import com.example.operation_platform.model.entity.TbOperationRecordEntity;
import com.example.operation_platform.model.vo.OperationRecordVO;
import java.util.List;
public interface TbOperationRecordService extends IService<TbOperationRecordEntity> {
/**
* 查看维保记录列表
*
* @param operationRecordDTO operationRecordDTO
* @return List<OperationRecordVO>
*/
List<OperationRecordVO> queryrecordList(OperationRecordDTO operationRecordDTO);
}
package com.example.operation_platform.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.operation_platform.model.dto.WorkerDTO;
import com.example.operation_platform.model.entity.WorkerEntity;
import com.example.operation_platform.model.vo.TermAndImgVO;
import com.example.operation_platform.model.vo.WorkerVO;
import java.util.List;
public interface WorkerService extends IService<WorkerEntity> {
/**
* 查询人员管理列表
*
* @param WorkerDTO
* @return List<WorkerVO></>
*/
List<WorkerVO> queryList(WorkerDTO WorkerDTO);
/**
* 查询单个人员信息
*
* @param
* @return WorkerEntity
*/
TermAndImgVO queryById(Integer id);
/*
* 登录验证
* @param WorkerDTO WorkerDTO
* @return WorkerVO
*/
WorkerVO queryByUsername(WorkerDTO WorkerDTO);
/**
* 重置密码
*
* @param workerDTO workerDTO
* @return List<WorkerVO>
* */
void resetPassword(WorkerDTO workerDTO);
/**
* 根据类型查询人员信息
*
* @param id id
* @return List<WorkerVO>
* */
List<WorkerVO> queryByType(Integer id);
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.GuideMapper;
import com.example.operation_platform.model.dto.GuideDTO;
import com.example.operation_platform.model.entity.GuideEntity;
import com.example.operation_platform.model.vo.GuideVO;
import com.example.operation_platform.service.GuideService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GuideServiceImpl extends ServiceImpl<GuideMapper, GuideEntity> implements GuideService {
@Override
public GuideVO queryByName(String name) {
return baseMapper.queryByName(name);
}
@Override
public List<GuideVO> queryguidelist(GuideDTO guideDTO) {
return baseMapper.queryguidelist(guideDTO);
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.MessageMapper;
import com.example.operation_platform.model.dto.MessageDTO;
import com.example.operation_platform.model.entity.MessageEntity;
import com.example.operation_platform.model.vo.MessageVO;
import com.example.operation_platform.model.vo.PeopleMessageVO;
import com.example.operation_platform.service.MessageService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, MessageEntity> implements MessageService {
@Override
public List<MessageVO> queryrobotList(MessageDTO messageDTO) {
return this.baseMapper.queryrobotList(messageDTO);
}
@Override
public void resetmessage(MessageDTO messageDTO) {
this.baseMapper.resetmessage(messageDTO);
}
@Override
public PeopleMessageVO queryPeople(Long stationId) {
return this.baseMapper.queryPeople(stationId);
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.OperationTypeMapper;
import com.example.operation_platform.model.dto.OperationTypeDTO;
import com.example.operation_platform.model.entity.OperationTypeEntity;
import com.example.operation_platform.model.vo.OperationTypeVO;
import com.example.operation_platform.service.OperationTypeService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OperatiionTypeServiceImpl extends ServiceImpl<OperationTypeMapper, OperationTypeEntity> implements OperationTypeService {
@Override
public List<OperationTypeVO> queryTypeList(OperationTypeDTO operationTypeDTO) {
return this.baseMapper.queryTypeList(operationTypeDTO);
}
}
package com.example.operation_platform.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.OperationDoMapper;
import com.example.operation_platform.model.dto.OperationDoDTO;
import com.example.operation_platform.model.entity.OperationDoEntity;
import com.example.operation_platform.model.vo.OperationDoVO;
import com.example.operation_platform.service.OperationDoService;
import com.google.common.collect.Lists;
import com.platform.utils.DateUtil;
import com.platform.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class OperationDoServiceImpl extends ServiceImpl<OperationDoMapper, OperationDoEntity> implements OperationDoService {
@Override
public List<OperationDoVO> queryDoList(OperationDoDTO operationDoDTO) {
//查看机器人运维项目
List<OperationDoVO> operationVOList = baseMapper.queryDoList(operationDoDTO);
return operationVOList;
}
@Override
public void stopDo(OperationDoDTO operationDoDTO) {
this.baseMapper.stopDo(operationDoDTO);
}
}
\ No newline at end of file
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.OperationItemMapper;
import com.example.operation_platform.model.dto.OperationItemDTO;
import com.example.operation_platform.model.entity.OperationItem;
import com.example.operation_platform.model.vo.OperationItemVO;
import com.example.operation_platform.service.OperationItemService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OperationItemServiceImpl extends ServiceImpl<OperationItemMapper, OperationItem> implements OperationItemService {
@Override
public List<OperationItemVO> queryItemList(OperationItemDTO operationItemDTO) {
return this.baseMapper.queryItemList(operationItemDTO);
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.OperationJobMapper;
import com.example.operation_platform.model.dto.OperationJobDTO;
import com.example.operation_platform.model.entity.OperationJob;
import com.example.operation_platform.model.vo.OperationJobVO;
import com.example.operation_platform.service.OperationJobService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OperationJobServiceImpl extends ServiceImpl<OperationJobMapper, OperationJob> implements OperationJobService {
@Override
public List<OperationJobVO> queryJobList(OperationJobDTO operationJobDTO) {
List<OperationJobVO> operationJobVOS = baseMapper.queryJobList(operationJobDTO);
return operationJobVOS;
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.RunLogMapper;
import com.example.operation_platform.model.dto.RunLogDTO;
import com.example.operation_platform.model.entity.RunLogEntity;
import com.example.operation_platform.model.entity.UavOperateLogEntity;
import com.example.operation_platform.model.vo.RunLogVO;
import com.example.operation_platform.service.OperateLogService;
import com.example.operation_platform.service.RunLogService;
import com.google.common.collect.Lists;
import com.platform.utils.ExcelUtil;
import com.platform.utils.ServletUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Service
public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> implements RunLogService {
@Resource
private OperateLogService operateLogService;
@Override
public List<RunLogVO> queryLogList(RunLogDTO runLogDTO) {
return baseMapper.queryLogList(runLogDTO);
}
@Override
public List<UavOperateLogEntity> getInfoById(String id) {
RunLogEntity runLogEntity = getById(id);
List<UavOperateLogEntity> uavOperateLogList = Lists.newArrayList();
//查看机器人操作日志
if (runLogEntity.getType().equals("uav")) {
uavOperateLogList = operateLogService.queryListByRunLogId(runLogEntity.getId());
}
return uavOperateLogList;
}
@Override
public void download(String id, HttpServletResponse httpServletResponse) {
List<UavOperateLogEntity> uavOperateLogList = getInfoById(id);
ExcelUtil<UavOperateLogEntity> uavOperateLogExcelUtil = new ExcelUtil<>(UavOperateLogEntity.class);
uavOperateLogExcelUtil.exportExcel(uavOperateLogList,
"机器人运行日志.xlsx",
ServletUtils.getResponse());
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.TbOperationRecordMapper;
import com.example.operation_platform.model.dto.OperationRecordDTO;
import com.example.operation_platform.model.entity.TbOperationRecordEntity;
import com.example.operation_platform.model.vo.OperationRecordVO;
import com.example.operation_platform.service.TbOperationRecordService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordMapper, TbOperationRecordEntity> implements TbOperationRecordService {
@Override
public List<OperationRecordVO> queryrecordList(OperationRecordDTO operationRecordDTO) {
return baseMapper.queryrecordList(operationRecordDTO);
}
}
package com.example.operation_platform.service.impl;
import com.example.operation_platform.model.entity.UavOperateLogEntity;
import com.example.operation_platform.service.OperateLogService;
import com.platform.service.MongoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class UavOperateLogServiceImpl implements OperateLogService {
@Resource
private MongoService<UavOperateLogEntity> mongoService;
@Override
public List<UavOperateLogEntity> queryListByRunLogId(String id) {
//组装mongo查询条件
String[] keys;
String[] values;
keys = new String[]{"run_log_id"};
values = new String[]{id};
return mongoService.findByMap(keys,
values,
UavOperateLogEntity.class);
}
}
package com.example.operation_platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.operation_platform.mapper.WorkerMapper;
import com.example.operation_platform.model.dto.WorkerDTO;
import com.example.operation_platform.model.entity.WorkerEntity;
import com.example.operation_platform.model.vo.TermAndImgVO;
import com.example.operation_platform.model.vo.WorkerVO;
import com.example.operation_platform.service.WorkerService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class WorkerServiceImpl extends ServiceImpl<WorkerMapper, WorkerEntity> implements WorkerService {
@Override
public List<WorkerVO> queryList(WorkerDTO workerDTO) {
return this.baseMapper.queryList(workerDTO);
}
@Override
public TermAndImgVO queryById(Integer id) {
return this.baseMapper.queryById(id);
}
@Override
public WorkerVO queryByUsername(WorkerDTO WorkerDTO) {
return this.baseMapper.queryByUsername(WorkerDTO);
}
@Override
public void resetPassword(WorkerDTO workerDTO) {
this.baseMapper.resetPassword(workerDTO);
}
@Override
public List<WorkerVO> queryByType(Integer id) {
return this.baseMapper.queryByType(id);
}
}
package com.example.operation_platform.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.operation_platform.mapper.OperationDoMapper;
import com.example.operation_platform.mapper.OperationJobMapper;
import com.example.operation_platform.model.entity.OperationDoEntity;
import com.example.operation_platform.model.entity.OperationJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
@Component
public class OperationDoTask {
@Autowired
private OperationDoMapper operationDoMapper;
@Autowired
private OperationJobMapper operationJobMapper;
@Scheduled(cron = "0 0 0 * * ?") // 每天午夜执行
public void scheduleOperationJobs() {
List<OperationDoEntity> operations = operationDoMapper.selectList(null);
LocalDate now = LocalDate.now(); // 改用 LocalDate 类型
for (OperationDoEntity operation : operations) {
// 1. 获取计划参数
LocalDate planStartDate = operation.getStartTime(); // 直接使用 LocalDate
int cycleDays = operation.getOperationCycle();
int durationDays = operation.getCompletionTime();
// 2. 查询当前计划下的所有任务(按时间倒序)
List<OperationJob> existingJobs = operationJobMapper.selectList(
new LambdaQueryWrapper<OperationJob>()
.eq(OperationJob::getOperationId, operation.getId())
.orderByDesc(OperationJob::getStartTime)
);
// 3. 自动生成新任务逻辑
if (existingJobs.isEmpty()) {
createTwoJobs(operation, planStartDate, cycleDays, durationDays);
} else {
maintainTwoValidJobs(operation, existingJobs, cycleDays, durationDays, now);
}
// 4. 更新所有任务状态并发送短信
updateJobStatusAndSendReminder(operation, now);
}
}
private void createTwoJobs(OperationDoEntity operation, LocalDate startDate,
int cycleDays, int durationDays) {
// 生成第一条任务
LocalDate job1Start = startDate;
LocalDate job1End = job1Start.plusDays(durationDays);
insertJob(operation, job1Start, job1End);
// 生成第二条任务(下一周期)
LocalDate job2Start = job1Start.plusDays(cycleDays);
LocalDate job2End = job2Start.plusDays(durationDays);
insertJob(operation, job2Start, job2End);
}
private void maintainTwoValidJobs(OperationDoEntity operation, List<OperationJob> existingJobs,
int cycleDays, int durationDays, LocalDate now) {
OperationJob latestJob = existingJobs.get(0);
// 检查最新任务是否已过期
if (latestJob.getEndTime().isBefore(now)) {
// 计算新任务开始时间(跳过当前周期)
LocalDate newStart = latestJob.getStartTime().plusDays(cycleDays * 2L);
LocalDate newEnd = newStart.plusDays(durationDays);
insertJob(operation, newStart, newEnd);
}
}
private void insertJob(OperationDoEntity operation, LocalDate start, LocalDate end) {
//builder模式实现插入
// OperationJob job = OperationJob.builder()
// .operationId(operation.getId())
// .startTime(start)
// .endTime(end)
// .finishStatus(0).build();
// 创建一个OperationJob实例来安排或记录某个操作的执行
OperationJob job = new OperationJob();
// 设置操作的唯一标识符,以便跟踪和管理
job.setOperationId(operation.getId());
// 设置操作的开始时间,标志着操作执行的起始时刻
job.setStartTime(start);
// 设置操作的结束时间,标志着操作执行的结束时刻
job.setEndTime(end);
// 初始化操作的完成状态为0,通常表示操作尚未完成或正在等待执行
job.setFinishStatus(0);
operationJobMapper.insert(job);
}
private void updateJobStatusAndSendReminder(OperationDoEntity operation, LocalDate now) {
List<OperationJob> allJobs = operationJobMapper.selectList(
new LambdaQueryWrapper<OperationJob>()
.eq(OperationJob::getOperationId, operation.getId())
);
for (OperationJob job : allJobs) {
int newStatus = calculateStatus(job, now);
if (newStatus != job.getFinishStatus()) {
job.setFinishStatus(newStatus);
operationJobMapper.updateById(job);
}
// 发送提前3天提醒(任务开始前3天的0点触发)
if (newStatus == 0) {
checkAndSendSms(job, now);
}
}
}
private int calculateStatus(OperationJob job, LocalDate now) {
if (job.getEndTime().isBefore(now)) {
return 1; // 已过期
} else if (job.getStartTime().isAfter(now)) {
return 0; // 未开始
} else {
return 0; // 进行中(start <= now < end)
}
}
private void checkAndSendSms(OperationJob job, LocalDate now) {
LocalDate reminderDate = job.getStartTime().minusDays(7);
if (now.isEqual(reminderDate)) { // 精确在提前3天的0点触发
sendAliyunSms(job.getOperationId(), job.getStartTime());
}
}
//阿里云短信服务(示例伪代码)
private void sendAliyunSms(Integer operationId, LocalDate startTime) {
// // 1. 获取关联手机号(需根据业务逻辑实现)
// String phone = getPhoneByOperation(operationId);
//
// // 2. 构造请求参数
// SendSmsRequest request = new SendSmsRequest()
// .setPhoneNumbers(phone)
// .setSignName("YourSignName")
// .setTemplateCode("SMS_123456789")
// .setTemplateParam("{\"date\":\"" + startTime.toLocalDate() + "\"}");
//
// // 3. 发送请求
// try {
// SendSmsResponse response = aliyunClient.getAcsResponse(request);
// log.info("短信发送结果:{}", response.getCode());
// } catch (ClientException e) {
// log.error("短信发送失败", e);
// }
}
}
# 应用服务 WEB 访问端口
server:
port: 8082
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: ruzhoukj@2022
url: jdbc:mysql://192.168.10.3:3307/pump_station_robot_business?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
data:
mongodb:
database: pump_station_robot
host: 47.110.227.202
port: 27017
username: ruzhoukj
password: ruzhoukj@2023
authentication-database: admin
mybatis-plus:
# MyBatis Mapper所对应的XML文件位置
mapper-locations: classpath*:mapper/**/*Mapper.xml
configuration:
cache-enabled: true
use-generated-keys: false
default-executor-type: reuse
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
map-underscore-to-camel-case: true
logging:
level:
com.example.operation_platform.mapper: debug # 这里的包路径需要指向你的 MyBatis Plus mapper 接口所在的包
\ No newline at end of file
<?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.example.operation_platform.mapper.GuideMapper">
<select id="queryByName" resultType="com.example.operation_platform.model.vo.GuideVO">
select
tg.id id,
tg.content content,
tg.img img
from
tb_guide tg
where
tg.name = #{name}
</select>
<select id = "queryguidelist" resultType="com.example.operation_platform.model.vo.GuideVO">
select
tg.id id,
tg.name name,
tg.content content,
tg.img img
from
tb_guide tg
</select>
</mapper>
<?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.example.operation_platform.mapper.MessageMapper">
<select id="queryrobotList" resultType="com.example.operation_platform.model.vo.MessageVO">
select
tm.id id,
tor.name stationName,
br.name robotName,
tw.worker_name peopleName,
tm.phone_number phoneNumber,
tor.address address
from
tb_message tm
left join
bs_station tor
on tor.id = tm.station_id
left join
bs_robot br
on br.id = tm.robot_id
left join
tb_worker tw
on tw.id = tm.people_id
<where>
<if test="robotName != null and robotName != ''">
and br.name like concat('%',#{stationName},'%')
</if>
</where>
</select>
<update id="resetmessage" parameterType="com.example.operation_platform.model.vo.MessageVO">
UPDATE tb_message
SET software_worker = "0",
hardware_worker = "0",
operation_worker = "0",
warn_message = "0",
operation_message = "0"
WHERE station_id = #{stationId}
AND robot_id = #{robotId}
</update>
<select id="queryPeople" resultType="com.example.operation_platform.model.vo.PeopleMessageVO">
SELECT
tw.worker_name peopleName,
tp.worker_name softwareWorker,
ta.worker_name hardwareWorker,
tq.worker_name operationWorker,
tw.phone_number peopleNumber,
tp.phone_number softwareNumber,
ta.phone_number hardwareNumber,
tq.phone_number operationNumber
FROM
tb_message tm
LEFT JOIN tb_worker tw ON tm.people_id = tw.id
LEFT JOIN tb_worker tp ON tm.software_worker = tp.id
LEFT JOIN tb_worker ta ON tm.hardware_worker = ta.id
LEFT JOIN tb_worker tq ON tm.operation_worker = tq.id
where
tm.station_id = #{stationId}
</select>
</mapper>
\ No newline at end of file
<?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.example.operation_platform.mapper.OperationItemMapper">
<select id="queryItemList" resultType="com.example.operation_platform.model.vo.OperationItemVO">
select
tw.id id,
tw.operation_item operationItem,
tw.operation_guide operationGuide
from
tb_operation_item tw
</select>
</mapper>
<?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.example.operation_platform.mapper.OperationTypeMapper">
<select id="queryTypeList" resultType="com.example.operation_platform.model.vo.OperationTypeVO">
select
tw.id id,
tw.operation_type operationType
from
tb_operation_type tw
left join
tb_operation_item typ
on
tw.item_id = typ.id
</select>
</mapper>
<?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.example.operation_platform.mapper.OperationDoMapper">
<select id="queryDoList" resultType="com.example.operation_platform.model.vo.OperationDoVO">
select
top.id as id,
top.operation_cycle as operationCycle,
top.start_time as startTime,
br.name as robotName,
bs.name as stationName,
bw.worker_name as workerName,
top.operation_type as operationType,
top.status
from tb_operation top
left join bs_robot br on top.robot_id = br.id
left join bs_station bs on top.station_id = bs.id
left join tb_worker bw on top.worker_id = bw.id
<where>
<if test="robotName != null and robotName != ''">
br.name like concat('%',#{robotName},'%')
</if>
<if test="stationName != null and stationName != ''">
and bs.name like concat('%',#{stationName},'%')
</if>
<if test="workerName != null and workerName != ''">
and bw.worker_name like concat('%',#{workerName},'%')
</if>
<if test="status != null and status != ''">
and top.status like concat('%',#{status},'%')
</if>
<if test="startTime != null">
and top.start_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and top.end_time &lt;= #{endTime}
</if>
</where>
</select>
<update id="stopDo" parameterType="com.example.operation_platform.model.vo.OperationDoVO">
UPDATE tb_operation
SET status = #{status}
WHERE id = #{id}
</update>
</mapper>
<?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.example.operation_platform.mapper.OperationJobMapper">
<select id="queryJobList" resultType="com.example.operation_platform.model.vo.OperationJobVO">
select
top.id,
tp.operation_type as operationType,
bs.name as stationName,
bw.worker_name as workerName,
br.name as robotName,
top.start_time as startTime,
top.finish_status
from tb_operation_job top
left join tb_operation tp on top.operation_id = tp.id
left join bs_station bs on tp.station_id = bs.id
left join bs_robot br on tp.robot_id = br.id
left join tb_worker bw on tp.worker_id = bw.id
<where>
<if test="robotName != null and robotName != ''">
br.name like concat('%',#{robotName},'%')
</if>
<if test="stationName != null and stationName != ''">
and bs.name like concat('%',#{stationName},'%')
</if>
<if test="workerName != null and workerName != ''">
and bw.worker_name like concat('%',#{workerName},'%')
</if>
<if test="status != null and status != ''">
and top.status like concat('%',#{status},'%')
</if>
<if test="startTime != null">
and top.start_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and top.end_time &lt;= #{endTime}
</if>
</where>
</select>
</mapper>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment