package cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.zsx.bs.formulaChild.entity.FormulaChildInfo; import cn.stylefeng.guns.modular.zsx.bs.formulaChild.mapper.FormulaChildInfoMapper; import cn.stylefeng.guns.modular.zsx.bs.formulaChild.model.params.FormulaChildInfoParam; import cn.stylefeng.guns.modular.zsx.bs.formulaChild.model.result.FormulaChildInfoResult; import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.FormulaChildInfoService; 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-09 */ @Service public class FormulaChildInfoServiceImpl extends ServiceImpl implements FormulaChildInfoService { @Override public void add(FormulaChildInfoParam param){ FormulaChildInfo entity = getEntity(param); this.save(entity); } @Override public void delete(FormulaChildInfoParam param){ this.removeById(getKey(param)); } @Override public void update(FormulaChildInfoParam param){ FormulaChildInfo oldEntity = getOldEntity(param); FormulaChildInfo newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public FormulaChildInfoResult findBySpec(FormulaChildInfoParam param){ return null; } @Override public List findListBySpec(FormulaChildInfoParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(FormulaChildInfoParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(FormulaChildInfoParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private FormulaChildInfo getOldEntity(FormulaChildInfoParam param) { return this.getById(getKey(param)); } private FormulaChildInfo getEntity(FormulaChildInfoParam param) { FormulaChildInfo entity = new FormulaChildInfo(); ToolUtil.copyProperties(param, entity); return entity; } }