潘志宝
2024-11-27 05576523a8626d34aaa1a47f1dfdcad7710482b4
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java
@@ -1,10 +1,18 @@
package com.iailab.module.model.mcs.sche.service.impl;
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.StScheduleSuggestDao;
import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity;
import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService;
import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestPageReqVO;
import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
/**
 * @author PanZhibao
@@ -14,4 +22,42 @@
@Service
public class StScheduleSuggestServiceImpl extends BaseServiceImpl<StScheduleSuggestDao, StScheduleSuggestEntity>
        implements StScheduleSuggestService {
    @Override
    public PageResult<StScheduleSuggestEntity> page(StScheduleSuggestPageReqVO reqVO) {
        return baseDao.selectPage(reqVO);
    }
    @Override
    public void create(StScheduleSuggestSaveReqVO createReqVO) {
        StScheduleSuggestEntity entity = BeanUtils.toBean(createReqVO, StScheduleSuggestEntity.class);
        entity.setId(UUID.randomUUID().toString());
        baseDao.insert(entity);
    }
    @Override
    public void update(StScheduleSuggestSaveReqVO createReqVO) {
        StScheduleSuggestEntity entity = BeanUtils.toBean(createReqVO, StScheduleSuggestEntity.class);
        baseDao.updateById(entity);
    }
    @Override
    public void delete(String id) {
        baseDao.deleteById(id);
    }
    @Override
    public StScheduleSuggestEntity getInfo(String id) {
        return baseDao.selectById(id);
    }
    @Override
    public List<StScheduleSuggestEntity> getList(String scheduleObj, Integer limit) {
        QueryWrapper<StScheduleSuggestEntity> queryWrapper = new QueryWrapper<>();
        limit = limit == null ? 1 : limit;
        queryWrapper.eq("schedule_obj", scheduleObj)
                .orderByDesc("create_time")
                .last("limit " + limit);
        return baseDao.selectList(queryWrapper);
    }
}