package cn.stylefeng.guns.modular.bs.lineInfo.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.bs.lineInfo.entity.LineInfo; import cn.stylefeng.guns.modular.bs.lineInfo.mapper.LineInfoMapper; import cn.stylefeng.guns.modular.bs.lineInfo.model.params.LineInfoParam; import cn.stylefeng.guns.modular.bs.lineInfo.model.result.LineInfoResult; import cn.stylefeng.guns.modular.bs.lineInfo.service.LineInfoService; 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 cl * @since 2022-10-28 */ @Service public class LineInfoServiceImpl extends ServiceImpl implements LineInfoService { @Override public void add(LineInfoParam param){ LineInfo entity = getEntity(param); this.save(entity); } @Override public void delete(LineInfoParam param){ this.removeById(getKey(param)); } @Override public void update(LineInfoParam param){ LineInfo oldEntity = getOldEntity(param); LineInfo newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public LineInfoResult findBySpec(LineInfoParam param){ return null; } @Override public List findListBySpec(LineInfoParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(LineInfoParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(LineInfoParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private LineInfo getOldEntity(LineInfoParam param) { return this.getById(getKey(param)); } private LineInfo getEntity(LineInfoParam param) { LineInfo entity = new LineInfo(); ToolUtil.copyProperties(param, entity); return entity; } }