|
|
@@ -1,122 +0,0 @@
|
|
|
-package cn.tr.module.hc.mapelement.service.impl;
|
|
|
-
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import cn.tr.core.exception.ServiceException;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import cn.tr.module.hc.mapelement.repository.BizJobScheduleRepository;
|
|
|
-import cn.tr.module.hc.mapelement.po.BizJobSchedulePO;
|
|
|
-import cn.tr.module.hc.mapelement.dto.BizJobScheduleDTO;
|
|
|
-import cn.tr.module.hc.mapelement.dto.BizJobScheduleQueryDTO;
|
|
|
-import java.util.*;
|
|
|
-import cn.tr.module.hc.mapelement.service.IBizJobScheduleService;
|
|
|
-import cn.tr.module.hc.mapelement.mapper.BizJobScheduleMapper;
|
|
|
-import jakarta.annotation.Resource;
|
|
|
-import cn.tr.core.exception.TRExcCode;
|
|
|
-
|
|
|
-/**
|
|
|
- * 作业调度指令表Service接口实现类
|
|
|
- *
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- **/
|
|
|
-@Service
|
|
|
-public class BizJobScheduleServiceImpl implements IBizJobScheduleService {
|
|
|
- @Resource
|
|
|
- private BizJobScheduleRepository baseRepository;
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据条件查询作业调度指令表
|
|
|
- * @param query 查询参数
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<BizJobScheduleDTO> selectBizJobScheduleList(BizJobScheduleQueryDTO query) {
|
|
|
- return BizJobScheduleMapper.INSTANCE.convertDtoList(
|
|
|
- baseRepository.selectList(new LambdaQueryWrapper<BizJobSchedulePO>()
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getId()), BizJobSchedulePO::getId, query.getId())
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getCraneId()), BizJobSchedulePO::getCraneId, query.getCraneId())
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getJobType()), BizJobSchedulePO::getJobType, query.getJobType())
|
|
|
- .like(ObjectUtil.isNotEmpty(query.getJobName()), BizJobSchedulePO::getJobName, query.getJobName())
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getStartDate()), BizJobSchedulePO::getStartDate, query.getStartDate())
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getEndDate()), BizJobSchedulePO::getEndDate, query.getEndDate())
|
|
|
- .eq(ObjectUtil.isNotEmpty(query.getEnabled()), BizJobSchedulePO::getEnabled, query.getEnabled())
|
|
|
- )
|
|
|
- );
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据id查询作业调度指令表
|
|
|
- * @param id 主键id
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- */
|
|
|
- @Override
|
|
|
- public BizJobScheduleDTO selectBizJobScheduleById(String id) {
|
|
|
- return BizJobScheduleMapper.INSTANCE.convertDto(baseRepository.selectById(id));
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑作业调度指令表
|
|
|
- * @param source 编辑实体类
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @Override
|
|
|
- public boolean updateBizJobScheduleById(BizJobScheduleDTO source) {
|
|
|
- // 检查任务标题是否重复
|
|
|
- if (ObjectUtil.isNotEmpty(source.getJobName())) {
|
|
|
- BizJobSchedulePO existPO = baseRepository.selectOne(new LambdaQueryWrapper<BizJobSchedulePO>()
|
|
|
- .eq(BizJobSchedulePO::getJobName, source.getJobName())
|
|
|
- .ne(BizJobSchedulePO::getId, source.getId())
|
|
|
- .last("limit 1"));
|
|
|
- if (existPO != null) {
|
|
|
- throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "任务标题已存在");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return baseRepository.updateById(BizJobScheduleMapper.INSTANCE.convertPO(source)) != 0;
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增作业调度指令表
|
|
|
- * @param source 新增实体类
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean insertBizJobSchedule(BizJobScheduleDTO source) {
|
|
|
- // 检查任务标题是否重复
|
|
|
- if (ObjectUtil.isNotEmpty(source.getJobName())) {
|
|
|
- BizJobSchedulePO existPO = baseRepository.selectOne(new LambdaQueryWrapper<BizJobSchedulePO>()
|
|
|
- .eq(BizJobSchedulePO::getJobName, source.getJobName())
|
|
|
- .last("limit 1"));
|
|
|
- if (existPO != null) {
|
|
|
- throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "任务标题已存在");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return baseRepository.insert(BizJobScheduleMapper.INSTANCE.convertPO(source)) != 0;
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除作业调度指令表详情
|
|
|
- * @param ids 删除主键集合
|
|
|
- * @author AutoGenerator
|
|
|
- * @date 2025-12-25
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public int removeBizJobScheduleByIds(Collection<String> ids) {
|
|
|
- if (CollectionUtil.isEmpty(ids)) {
|
|
|
- throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "请选择要删除的数据");
|
|
|
- }
|
|
|
- return baseRepository.deleteByIds(ids);
|
|
|
- };
|
|
|
-}
|