package cn.stylefeng.guns.modular.qc.badReasonConf.service.impl;
|
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
|
import cn.stylefeng.guns.modular.qc.badReasonConf.entity.BadReasonConf;
|
import cn.stylefeng.guns.modular.qc.badReasonConf.mapper.BadReasonConfMapper;
|
import cn.stylefeng.guns.modular.qc.badReasonConf.model.params.BadReasonConfParam;
|
import cn.stylefeng.guns.modular.qc.badReasonConf.model.result.BadReasonConfResult;
|
import cn.stylefeng.guns.modular.qc.badReasonConf.service.BadReasonConfService;
|
import cn.stylefeng.roses.core.util.ToolUtil;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.springframework.stereotype.Service;
|
|
import java.io.Serializable;
|
import java.util.List;
|
|
/**
|
* <p>
|
* 不良原因配置 服务实现类
|
* </p>
|
*
|
* @author ruimin
|
* @since 2023-03-11
|
*/
|
@Service
|
public class BadReasonConfServiceImpl extends ServiceImpl<BadReasonConfMapper, BadReasonConf> implements BadReasonConfService {
|
|
@Override
|
public void add(BadReasonConfParam param){
|
BadReasonConf entity = getEntity(param);
|
this.save(entity);
|
}
|
|
@Override
|
public void delete(BadReasonConfParam param){
|
this.removeById(getKey(param));
|
}
|
|
@Override
|
public void update(BadReasonConfParam param){
|
BadReasonConf oldEntity = getOldEntity(param);
|
BadReasonConf newEntity = getEntity(param);
|
ToolUtil.copyProperties(newEntity, oldEntity);
|
this.updateById(newEntity);
|
}
|
|
@Override
|
public BadReasonConfResult findBySpec(BadReasonConfParam param){
|
return null;
|
}
|
|
@Override
|
public List<BadReasonConfResult> findListBySpec(BadReasonConfParam param){
|
return null;
|
}
|
|
@Override
|
public LayuiPageInfo findPageBySpec(BadReasonConfParam param){
|
Page pageContext = getPageContext();
|
IPage page = this.baseMapper.customPageList(pageContext, param);
|
return LayuiPageFactory.createPageInfo(page);
|
}
|
|
private Serializable getKey(BadReasonConfParam param){
|
return param.getId();
|
}
|
|
private Page getPageContext() {
|
return LayuiPageFactory.defaultPage();
|
}
|
|
private BadReasonConf getOldEntity(BadReasonConfParam param) {
|
return this.getById(getKey(param));
|
}
|
|
private BadReasonConf getEntity(BadReasonConfParam param) {
|
BadReasonConf entity = new BadReasonConf();
|
ToolUtil.copyProperties(param, entity);
|
return entity;
|
}
|
|
}
|