package cn.stylefeng.guns.modular.qc.badCollection.service.impl; import cn.stylefeng.guns.base.auth.context.LoginContextHolder; 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.service.LocationInfoService; import cn.stylefeng.guns.modular.dq.materialTraceability.service.impl.MaterialTraceabilityServiceImpl; import cn.stylefeng.guns.modular.qc.badCollection.entity.BadCollection; import cn.stylefeng.guns.modular.qc.badCollection.mapper.BadCollectionMapper; import cn.stylefeng.guns.modular.qc.badCollection.model.params.BadCollectionParam; import cn.stylefeng.guns.modular.qc.badCollection.model.result.BadCollectionResult; import cn.stylefeng.guns.modular.qc.badCollection.service.BadCollectionService; import cn.stylefeng.guns.modular.qc.badReasonConf.entity.BadReasonConf; import cn.stylefeng.guns.modular.qc.badReasonConf.service.BadReasonConfService; import cn.stylefeng.roses.core.util.ToolUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.Serializable; import java.util.List; /** *

* 不良数据采集 服务实现类 *

* * @author ruimin * @since 2023-03-11 */ @Service public class BadCollectionServiceImpl extends ServiceImpl implements BadCollectionService { @Autowired private LocationInfoService locationInfoService; @Autowired private BadReasonConfService badReasonConfService; @Override public void add(BadCollectionParam param){ param.setCreateUser(LoginContextHolder.getContext().getUser().getName()); // param.setSfcCode(MaterialTraceabilityServiceImpl.getSfcCode(param.getLocationCode()+"_S_SFC_CODE")); BadCollection entity = getEntity(param); this.save(entity); } @Override public void delete(BadCollectionParam param){ this.removeById(getKey(param)); } @Override public void update(BadCollectionParam param){ BadCollection oldEntity = getOldEntity(param); BadCollection newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public BadCollectionResult findBySpec(BadCollectionParam param){ return null; } @Override public List findListBySpec(BadCollectionParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(BadCollectionParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(BadCollectionParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private BadCollection getOldEntity(BadCollectionParam param) { return this.getById(getKey(param)); } private BadCollection getEntity(BadCollectionParam param) { BadCollection entity = new BadCollection(); ToolUtil.copyProperties(param, entity); return entity; } }