| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleModelDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | * @date 2021年07月20日 14:23 |
| | | */ |
| | | @Service |
| | | public class StScheduleModelServiceImpl extends BaseServiceImpl<StScheduleModelDao, StScheduleModelEntity> implements StScheduleModelService { |
| | | public class StScheduleModelServiceImpl implements StScheduleModelService { |
| | | |
| | | @Resource |
| | | private StScheduleModelDao stScheduleModelDao; |
| | | |
| | | @Autowired |
| | | private StScheduleModelParamService stScheduleModelParamService; |
| | |
| | | @Autowired |
| | | private StScheduleModelSettingService stScheduleModelSettingService; |
| | | |
| | | @Autowired |
| | | private StScheduleModelOutService stScheduleModelOutService; |
| | | |
| | | @Override |
| | | public PageResult<StScheduleModelEntity> page(StScheduleModelPageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | return stScheduleModelDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<StScheduleModelEntity> list() { |
| | | |
| | | return baseDao.selectList(null); |
| | | return stScheduleModelDao.selectList(null); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void create(StScheduleModelSaveReqVO reqVO) { |
| | | StScheduleModelEntity entity = BeanUtils.toBean(reqVO, StScheduleModelEntity.class); |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(entity); |
| | | stScheduleModelDao.insert(entity); |
| | | stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList()); |
| | | stScheduleModelOutService.insertList(reqVO.getModelOut(), entity.getId()); |
| | | stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleModelSaveReqVO reqVO) { |
| | | StScheduleModelEntity entity = BeanUtils.toBean(reqVO, StScheduleModelEntity.class); |
| | | baseDao.updateById(entity); |
| | | stScheduleModelDao.updateById(entity); |
| | | stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList()); |
| | | stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList()); |
| | | stScheduleModelOutService.deleteScheduleModelOut(entity.getId()); |
| | | stScheduleModelOutService.insertList(reqVO.getModelOut(), entity.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public StScheduleModelEntity get(String id) { |
| | | return baseDao.selectById(id); |
| | | return stScheduleModelDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void delete(String id) { |
| | | baseDao.deleteById(id); |
| | | stScheduleModelDao.deleteById(id); |
| | | stScheduleModelParamService.deleteByModelId(id); |
| | | stScheduleModelSettingService.deleteByModelId(id); |
| | | stScheduleModelOutService.deleteScheduleModelOut(id); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<StScheduleModelEntity> scheduleModelWrapper = new QueryWrapper<>(); |
| | | scheduleModelWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleModelWrapper.and(wrapper -> wrapper.eq("model_name", modelname)); |
| | | return baseDao.selectCount(scheduleModelWrapper); |
| | | return stScheduleModelDao.selectCount(scheduleModelWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Long count() { |
| | | QueryWrapper<StScheduleModelEntity> wrapper = new QueryWrapper<>(); |
| | | return baseDao.selectCount(wrapper); |
| | | return stScheduleModelDao.selectCount(wrapper); |
| | | } |
| | | } |