|
|
@ -34,89 +34,95 @@ import java.util.List; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class ScmApplyInboundVehicleService extends MybatisBaseService<ScmApplyInboundVehicleMapper, ScmApplyInboundVehicle> { |
|
|
|
public PagerVo<ScmApplyInboundVehicle> listPage(PagerQuery<ScmApplyInboundVehicleQuery> pq) { |
|
|
|
ScmApplyInboundVehicleQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmApplyInboundVehicle> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmApplyInboundVehicle> pagging = baseMapper.selectPage(page, qw); |
|
|
|
PagerVo<ScmApplyInboundVehicle> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
public List<ScmApplyInboundVehicle> listAll(ScmApplyInboundVehicleQuery query) { |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
return baseMapper.selectList(qw); |
|
|
|
} |
|
|
|
private QueryWrapper<ScmApplyInboundVehicle> createQueryWrapper(ScmApplyInboundVehicleQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = new QueryWrapper<>(); |
|
|
|
public PagerVo<ScmApplyInboundVehicle> listPage(PagerQuery<ScmApplyInboundVehicleQuery> pq) { |
|
|
|
ScmApplyInboundVehicleQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmApplyInboundVehicle> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmApplyInboundVehicle> pagging = baseMapper.selectPage(page, qw); |
|
|
|
PagerVo<ScmApplyInboundVehicle> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public List<ScmApplyInboundVehicle> listAll(ScmApplyInboundVehicleQuery query) { |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
return baseMapper.selectList(qw); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getModelSid())) { |
|
|
|
qw.eq("modelSid", query.getModelSid()); |
|
|
|
} |
|
|
|
private QueryWrapper<ScmApplyInboundVehicle> createQueryWrapper(ScmApplyInboundVehicleQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getVinNo())) { |
|
|
|
qw.eq("vinNo", query.getVinNo()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<ScmApplyInboundVehicleVo> listPageVo(PagerQuery<ScmApplyInboundVehicleQuery> pq) { |
|
|
|
ScmApplyInboundVehicleQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmApplyInboundVehicle> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmApplyInboundVehicleVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<ScmApplyInboundVehicleVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 验证车架号是否重复 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public int checkVinNo(String vinNo) { |
|
|
|
return baseMapper.checkVinNo(vinNo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getModelSid())) { |
|
|
|
qw.eq("modelSid", query.getModelSid()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 保存车辆列表 |
|
|
|
* @param list |
|
|
|
* @param applySid |
|
|
|
* @param modelSid |
|
|
|
*/ |
|
|
|
public void saveApplyInboundVehicleList(List<ScmApplyInboundVehicleDto> list, String applySid, String modelSid) { |
|
|
|
for (ScmApplyInboundVehicleDto dto : list) { |
|
|
|
ScmApplyInboundVehicle inboundVehicle = new ScmApplyInboundVehicle(); |
|
|
|
BeanUtil.copyProperties(dto, inboundVehicle); |
|
|
|
inboundVehicle.setApplySid(applySid); |
|
|
|
inboundVehicle.setModelSid(modelSid); |
|
|
|
save(inboundVehicle); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getVinNo())) { |
|
|
|
qw.eq("vinNo", query.getVinNo()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改车辆列表 |
|
|
|
* @param list |
|
|
|
*/ |
|
|
|
public void updateApplyInboundVehicleList(List<ScmApplyInboundVehicleDto> list) { |
|
|
|
for (ScmApplyInboundVehicleDto dto : list) { |
|
|
|
ScmApplyInboundVehicle inboundVehicle = fetchBySid(dto.getSid()); |
|
|
|
BeanUtil.copyProperties(dto, inboundVehicle); |
|
|
|
updateById(inboundVehicle); |
|
|
|
} |
|
|
|
} |
|
|
|
public PagerVo<ScmApplyInboundVehicleVo> listPageVo(PagerQuery<ScmApplyInboundVehicleQuery> pq) { |
|
|
|
ScmApplyInboundVehicleQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmApplyInboundVehicle> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmApplyInboundVehicle> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmApplyInboundVehicleVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<ScmApplyInboundVehicleVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据车辆入账单查询车辆信息 |
|
|
|
* @param applySid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public List<ScmApplyInboundVehicleVo> selectListByAppSid(String applySid) { |
|
|
|
return baseMapper.selectListByAppSid(applySid); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 验证车架号是否重复 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public int checkVinNo(String vinNo, String mainSid) { |
|
|
|
return baseMapper.checkVinNo(vinNo, mainSid); |
|
|
|
} |
|
|
|
|
|
|
|
public List<ScmApplyInboundVehicleDto> fetchByMainSid(String businessSid) { |
|
|
|
return baseMapper.fetchByMainSid(businessSid); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 保存车辆列表 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param applySid |
|
|
|
* @param modelSid |
|
|
|
*/ |
|
|
|
public void saveApplyInboundVehicleList(List<ScmApplyInboundVehicleDto> list, String applySid, String modelSid) { |
|
|
|
for (ScmApplyInboundVehicleDto dto : list) { |
|
|
|
ScmApplyInboundVehicle inboundVehicle = new ScmApplyInboundVehicle(); |
|
|
|
BeanUtil.copyProperties(dto, inboundVehicle); |
|
|
|
inboundVehicle.setApplySid(applySid); |
|
|
|
inboundVehicle.setModelSid(modelSid); |
|
|
|
save(inboundVehicle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改车辆列表 |
|
|
|
* |
|
|
|
* @param list |
|
|
|
*/ |
|
|
|
public void updateApplyInboundVehicleList(List<ScmApplyInboundVehicleDto> list) { |
|
|
|
for (ScmApplyInboundVehicleDto dto : list) { |
|
|
|
ScmApplyInboundVehicle inboundVehicle = fetchBySid(dto.getSid()); |
|
|
|
BeanUtil.copyProperties(dto, inboundVehicle); |
|
|
|
updateById(inboundVehicle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据车辆入账单查询车辆信息 |
|
|
|
* |
|
|
|
* @param applySid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public List<ScmApplyInboundVehicleVo> selectListByAppSid(String applySid) { |
|
|
|
return baseMapper.selectListByAppSid(applySid); |
|
|
|
} |
|
|
|
|
|
|
|
public List<ScmApplyInboundVehicleDto> fetchByMainSid(String businessSid) { |
|
|
|
return baseMapper.fetchByMainSid(businessSid); |
|
|
|
} |
|
|
|
} |