package cn.stylefeng.guns.modular.bs.customInfo.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.bs.customInfo.entity.CustomInfo; import cn.stylefeng.guns.modular.bs.customInfo.mapper.CustomInfoMapper; import cn.stylefeng.guns.modular.bs.customInfo.model.params.CustomInfoParam; import cn.stylefeng.guns.modular.bs.customInfo.model.result.CustomInfoResult; import cn.stylefeng.guns.modular.bs.customInfo.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-03-27 */ @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; } }