| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.ProductBomHistoryMapper; |
| | | import com.whyc.pojo.ProductBomHistory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public class ProductBomHistoryService { |
| | | @Autowired(required = false) |
| | | private ProductBomHistoryMapper mapper; |
| | | //根据子件名称和母料编号查询历史版本记录 |
| | | public Response getBomByPCodeAndSName(int pcode, int sname) { |
| | | //根据子件名称和母料型号查询历史版本记录 |
| | | public Response getBomHistoryByPModelAndSName(String pmodel, String sname) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("parent_code",pcode); |
| | | wrapper.eq("sub_code",sname); |
| | | wrapper.eq("parent_model",pmodel); |
| | | wrapper.eq("sub_name",sname); |
| | | wrapper.orderByAsc("s_version"); |
| | | List list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list.size()>0?true:false,list,"返回数据"); |
| | | } |
| | | |
| | | /**指定版本的产品bom*/ |
| | | public List<ProductBomHistory> getListByParentModel(String parentModel, Integer version) { |
| | | QueryWrapper<ProductBomHistory> query = Wrappers.query(); |
| | | query.eq("parent_model",parentModel).le("e_version",version).ge("s_version",version); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public void addBatch(List<ProductBomHistory> newHistoryList) { |
| | | mapper.insertBatchSomeColumn(newHistoryList); |
| | | } |
| | | |
| | | public void updateVersionBatch(List<ProductBomHistory> newVersionCurrentHistoryList) { |
| | | mapper.updateVersionBatch(newVersionCurrentHistoryList); |
| | | } |
| | | } |