package com.iailab.module.data.indexdata.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.iailab.module.data.common.enums.CommonConstant;
|
import com.iailab.module.data.common.utils.PageUtils;
|
import com.iailab.module.data.common.utils.Query;
|
import com.iailab.module.data.indexdata.dao.IndexDataClockDao;
|
import com.iailab.module.data.indexdata.entity.IndexDataClockEntity;
|
import com.iailab.module.data.indexdata.service.IndexDataClockService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2022年09月08日 21:49:00
|
*/
|
@Service
|
public class IndexDataClockServiceImpl extends ServiceImpl<IndexDataClockDao, IndexDataClockEntity> implements IndexDataClockService {
|
|
@Override
|
public PageUtils queryPage(Map<String, Object> params) {
|
String clockCode = (String)params.get("clockCode");
|
String clockName = (String)params.get("clockName");
|
|
IPage<IndexDataClockEntity> page = this.page(
|
new Query<IndexDataClockEntity>().getPage(params),
|
new QueryWrapper<IndexDataClockEntity>()
|
.like(StringUtils.isNotBlank(clockCode),"clock_code", clockCode)
|
.like(StringUtils.isNotBlank(clockName),"clock_name", clockName)
|
.orderByDesc("create_time")
|
);
|
return new PageUtils(page);
|
}
|
|
@Override
|
public List<IndexDataClockEntity> queryList(Map<String, Object> params) {
|
return getBaseMapper().selectList(
|
new QueryWrapper<IndexDataClockEntity>().eq("status", CommonConstant.IS_ENABLE)
|
.orderByDesc("create_time")
|
);
|
}
|
|
@Override
|
public void add(IndexDataClockEntity indexDataClockEntity) {
|
this.save(indexDataClockEntity);
|
}
|
|
@Override
|
public void update(IndexDataClockEntity indexDataClockEntity) {
|
this.updateById(indexDataClockEntity);
|
}
|
|
@Override
|
public void deleteById(String id) {
|
this.removeById(id);
|
}
|
|
@Override
|
public IndexDataClockEntity getInfoById(String id) {
|
return this.getById(id);
|
}
|
|
@Override
|
public IndexDataClockEntity getInfoByCode(String clockCode) {
|
return getBaseMapper().selectOne(new QueryWrapper<IndexDataClockEntity>()
|
.eq("clock_code", clockCode)
|
.eq("status", CommonConstant.IS_ENABLE));
|
}
|
|
@Override
|
public int cheack(IndexDataClockEntity indexDataClockEntity) {
|
String id = indexDataClockEntity.getId();
|
String clockCode = indexDataClockEntity.getClockCode();
|
String clockName = indexDataClockEntity.getClockName();
|
QueryWrapper<IndexDataClockEntity> queryWrapper = new QueryWrapper<>();
|
queryWrapper.ne(StringUtils.isNotBlank(id), "id", id);
|
queryWrapper.and(wrapper -> wrapper.eq("clock_code", clockCode).or().
|
eq(StringUtils.isNotBlank(clockName),"clock_name", clockName));
|
return (int)this.count(queryWrapper);
|
}
|
}
|