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