package com.iailab.module.model.mcs.sche.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.sche.dao.StScheduleObjectDao; import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; import com.iailab.module.model.mcs.sche.service.StScheduleObjectService; import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.UUID; /** * @author PanZhibao * @date 2021年07月20日 17:53 */ @Service("stScheduleObjectService") public class StScheduleObjectServiceImpl extends BaseServiceImpl implements StScheduleObjectService { @Override public PageResult page(StScheduleObjectPageReqVO reqVO) { return baseDao.selectPage(reqVO); } private QueryWrapper getWrapper(Map params) { String name = (String)params.get("name"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(name),"name", name); return wrapper; } public StScheduleObjectEntity getDetailById(String id) { return baseDao.selectById(id); } @Override @Transactional(rollbackFor = Exception.class) public void saveStScheduleObject(StScheduleObjectEntity scheduleObject) { scheduleObject.setId(UUID.randomUUID().toString()); insert(scheduleObject); } @Override @Transactional(rollbackFor = Exception.class) public void update(StScheduleObjectEntity scheduleObject) { this.updateById(scheduleObject); } @Override @Transactional(rollbackFor = Exception.class) public void deleteBatch(String[] scheduleObjectIds) { deleteBatchIds(Arrays.asList(scheduleObjectIds)); } @Override public int check(StScheduleObjectEntity scheduleObject) { String id = scheduleObject.getId(); String name = scheduleObject.getName(); QueryWrapper scheduleObjectWrapper = new QueryWrapper<>(); scheduleObjectWrapper.ne(StringUtils.isNotBlank(id), "id", id); scheduleObjectWrapper.and(wrapper -> wrapper.eq("name", name)); List list = baseDao.selectList(scheduleObjectWrapper); return list.size(); } }