package cn.stylefeng.guns.modular.sm.scrapCategoryConf.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.sm.scrapCategoryConf.entity.ScrapCategoryConf; import cn.stylefeng.guns.modular.sm.scrapCategoryConf.mapper.ScrapCategoryConfMapper; import cn.stylefeng.guns.modular.sm.scrapCategoryConf.model.params.ScrapCategoryConfParam; import cn.stylefeng.guns.modular.sm.scrapCategoryConf.model.result.ScrapCategoryConfResult; import cn.stylefeng.guns.modular.sm.scrapCategoryConf.service.ScrapCategoryConfService; 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-02-23 */ @Service public class ScrapCategoryConfServiceImpl extends ServiceImpl implements ScrapCategoryConfService { @Override public void add(ScrapCategoryConfParam param){ ScrapCategoryConf entity = getEntity(param); this.save(entity); } @Override public void delete(ScrapCategoryConfParam param){ this.removeById(getKey(param)); } @Override public void update(ScrapCategoryConfParam param){ ScrapCategoryConf oldEntity = getOldEntity(param); ScrapCategoryConf newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public ScrapCategoryConfResult findBySpec(ScrapCategoryConfParam param){ return null; } @Override public List findListBySpec(ScrapCategoryConfParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(ScrapCategoryConfParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(ScrapCategoryConfParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private ScrapCategoryConf getOldEntity(ScrapCategoryConfParam param) { return this.getById(getKey(param)); } private ScrapCategoryConf getEntity(ScrapCategoryConfParam param) { ScrapCategoryConf entity = new ScrapCategoryConf(); ToolUtil.copyProperties(param, entity); return entity; } }