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.module.model.mcs.sche.dao.StScheduleUserDao;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity;
|
import com.iailab.module.model.mcs.sche.service.StScheduleUserService;
|
import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO;
|
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日 15:15
|
*/
|
@Service("stScheduleUserService")
|
public class StScheduleUserServiceImpl extends BaseServiceImpl<StScheduleUserDao, StScheduleUserEntity> implements StScheduleUserService {
|
|
@Override
|
public PageResult<StScheduleUserEntity> page(StScheduleUserPageReqVO reqVO) {
|
return baseDao.selectPage(reqVO);
|
}
|
|
private QueryWrapper<StScheduleUserEntity> getWrapper(Map<String, Object> params) {
|
String username = (String)params.get("username");
|
|
QueryWrapper<StScheduleUserEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(username),"username", username);
|
|
return wrapper;
|
}
|
|
public StScheduleUserEntity getDetailById(String id) {
|
return baseDao.selectById(id);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void saveScheduleUser(StScheduleUserEntity scheduleUser) {
|
scheduleUser.setId(UUID.randomUUID().toString());
|
insert(scheduleUser);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void update(StScheduleUserEntity scheduleUser) {
|
this.updateById(scheduleUser);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void deleteBatch(String[] storeTypeIds) {
|
deleteBatchIds(Arrays.asList(storeTypeIds));
|
}
|
|
@Override
|
public int check(StScheduleUserEntity scheduleUser) {
|
String id = scheduleUser.getId();
|
String username = scheduleUser.getUsername();
|
QueryWrapper<StScheduleUserEntity> scheduleUserWrapper = new QueryWrapper<>();
|
scheduleUserWrapper.ne(StringUtils.isNotBlank(id), "id", id);
|
scheduleUserWrapper.and(wrapper -> wrapper.eq("username", username));
|
|
List<StScheduleUserEntity> list = baseDao.selectList(scheduleUserWrapper);
|
return list.size();
|
}
|
}
|