package cn.stylefeng.guns.modular.bs.locationInfo.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.bs.locationInfo.entity.LocationInfo; import cn.stylefeng.guns.modular.bs.locationInfo.mapper.LocationInfoMapper; import cn.stylefeng.guns.modular.bs.locationInfo.model.params.LocationInfoParam; import cn.stylefeng.guns.modular.bs.locationInfo.model.result.LocationInfoResult; import cn.stylefeng.guns.modular.bs.locationInfo.service.LocationInfoService; 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 LocationInfoServiceImpl extends ServiceImpl implements LocationInfoService { @Override public void add(LocationInfoParam param){ LocationInfo entity = getEntity(param); this.save(entity); } @Override public void delete(LocationInfoParam param){ this.removeById(getKey(param)); } @Override public void update(LocationInfoParam param){ LocationInfo oldEntity = getOldEntity(param); LocationInfo newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public LocationInfoResult findBySpec(LocationInfoParam param){ return null; } @Override public List findListBySpec(LocationInfoParam param){ return this.baseMapper.customList(param); } @Override public LayuiPageInfo findPageBySpec(LocationInfoParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(LocationInfoParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private LocationInfo getOldEntity(LocationInfoParam param) { return this.getById(getKey(param)); } private LocationInfo getEntity(LocationInfoParam param) { LocationInfo entity = new LocationInfo(); ToolUtil.copyProperties(param, entity); return entity; } }