package cn.stylefeng.guns.modular.zsx.sys.kanbanConf.service.impl;
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.zsx.sys.kanbanConf.entity.KanbanConf;
import cn.stylefeng.guns.modular.zsx.sys.kanbanConf.mapper.KanbanConfMapper;
import cn.stylefeng.guns.modular.zsx.sys.kanbanConf.model.params.KanbanConfParam;
import cn.stylefeng.guns.modular.zsx.sys.kanbanConf.model.result.KanbanConfResult;
import cn.stylefeng.guns.modular.zsx.sys.kanbanConf.service.KanbanConfService;
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;
/**
*
* 看板配置 服务实现类
*
*
* @author ruimin
* @since 2023-10-08
*/
@Service
public class KanbanConfServiceImpl extends ServiceImpl implements KanbanConfService {
@Override
public void add(KanbanConfParam param){
KanbanConf entity = getEntity(param);
this.save(entity);
}
@Override
public void delete(KanbanConfParam param){
this.removeById(getKey(param));
}
@Override
public void update(KanbanConfParam param){
KanbanConf oldEntity = getOldEntity(param);
KanbanConf newEntity = getEntity(param);
ToolUtil.copyProperties(newEntity, oldEntity);
this.updateById(newEntity);
}
@Override
public KanbanConfResult findBySpec(KanbanConfParam param){
return null;
}
@Override
public List findListBySpec(KanbanConfParam param){
return null;
}
@Override
public LayuiPageInfo findPageBySpec(KanbanConfParam param){
Page pageContext = getPageContext();
IPage page = this.baseMapper.customPageList(pageContext, param);
return LayuiPageFactory.createPageInfo(page);
}
private Serializable getKey(KanbanConfParam param){
return param.getId();
}
private Page getPageContext() {
return LayuiPageFactory.defaultPage();
}
private KanbanConf getOldEntity(KanbanConfParam param) {
return this.getById(getKey(param));
}
private KanbanConf getEntity(KanbanConfParam param) {
KanbanConf entity = new KanbanConf();
ToolUtil.copyProperties(param, entity);
return entity;
}
}