1.重写涉及mongodb数据操作的业务逻辑
parent
75ae13cacd
commit
99c25cee34
@ -1,175 +0,0 @@
|
||||
package com.glxp.udi.admin.mongo.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
|
||||
import com.glxp.udi.admin.entity.udid.UdiEntity;
|
||||
import com.glxp.udi.admin.mongo.MongoDBName;
|
||||
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
|
||||
import com.glxp.udi.admin.mongo.utils.PageResult;
|
||||
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
|
||||
import com.glxp.udi.admin.util.FilterUdiUtils;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class InvProductDetailMdService {
|
||||
|
||||
@Resource
|
||||
private MongoTemplate mongoTemplate;
|
||||
@Resource
|
||||
private MongoPageHelper mongoPageHelper;
|
||||
|
||||
public PageResult<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
Query query = new Query();
|
||||
if (filterInvProductDetailRequest.getCode() != null && !filterInvProductDetailRequest.getCode().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("code").is(filterInvProductDetailRequest.getCode()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getProductIdFk() != null && !filterInvProductDetailRequest.getProductIdFk().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("productIdFk").is(filterInvProductDetailRequest.getProductIdFk()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getMainAction() != null && !filterInvProductDetailRequest.getMainAction().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("mainAction").is(filterInvProductDetailRequest.getMainAction()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getCustomerId() != null && !filterInvProductDetailRequest.getCustomerId().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("customerId").is(filterInvProductDetailRequest.getCustomerId()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getBatchNo() != null && !filterInvProductDetailRequest.getBatchNo().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("batchNo").is(filterInvProductDetailRequest.getBatchNo()));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes())) {
|
||||
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductDetailRequest.getInvCodes()));
|
||||
}
|
||||
return mongoPageHelper.pageQuery(query, InvProductDetailEntity.class,
|
||||
filterInvProductDetailRequest.getLimit(), filterInvProductDetailRequest.getPage(),
|
||||
filterInvProductDetailRequest.getLastId(), MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
|
||||
}
|
||||
|
||||
public List<InvProductDetailEntity> filterAllInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
Query query = new Query();
|
||||
if (filterInvProductDetailRequest.getCode() != null && !filterInvProductDetailRequest.getCode().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("code").is(filterInvProductDetailRequest.getCode()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getProductIdFk() != null && !filterInvProductDetailRequest.getProductIdFk().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("productIdFk").is(filterInvProductDetailRequest.getProductIdFk()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getMainAction() != null && !filterInvProductDetailRequest.getMainAction().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("mainAction").is(filterInvProductDetailRequest.getMainAction()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getCustomerId() != null && !filterInvProductDetailRequest.getCustomerId().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("customerId").is(filterInvProductDetailRequest.getCustomerId()));
|
||||
}
|
||||
if (filterInvProductDetailRequest.getBatchNo() != null && !filterInvProductDetailRequest.getBatchNo().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("batchNo").is(filterInvProductDetailRequest.getBatchNo()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(filterInvProductDetailRequest.getOrderIdFk())) {
|
||||
query.addCriteria(Criteria.where("orderIdFk").is(filterInvProductDetailRequest.getOrderIdFk()));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes())) {
|
||||
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductDetailRequest.getInvCodes()));
|
||||
}
|
||||
return mongoTemplate.find(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
public void insertInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
mongoTemplate.insert(invProductDetailEntity, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
public void updateInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
Query query = new Query();
|
||||
query.addCriteria(new Criteria().and("_id").is(invProductDetailEntity.getId()));
|
||||
Update update = new Update();
|
||||
|
||||
if (invProductDetailEntity.getCount() != null) {
|
||||
update.set("count", invProductDetailEntity.getCount());
|
||||
}
|
||||
if (invProductDetailEntity.getCode() != null) {
|
||||
update.set("code", invProductDetailEntity.getCode());
|
||||
}
|
||||
if (invProductDetailEntity.getProductIdFk() != null) {
|
||||
update.set("productIdFk", invProductDetailEntity.getProductIdFk());
|
||||
}
|
||||
if (invProductDetailEntity.getOrderIdFk() != null) {
|
||||
update.set("orderIdFk", invProductDetailEntity.getOrderIdFk());
|
||||
}
|
||||
if (invProductDetailEntity.getCustomerId() != null) {
|
||||
update.set("customerId", invProductDetailEntity.getCustomerId());
|
||||
}
|
||||
if (invProductDetailEntity.getMainAction() != null) {
|
||||
update.set("mainAction", invProductDetailEntity.getMainAction());
|
||||
}
|
||||
if (invProductDetailEntity.getAction() != null) {
|
||||
update.set("action", invProductDetailEntity.getAction());
|
||||
}
|
||||
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
public void deleteById(String id) {
|
||||
Query query = new Query();
|
||||
if (id != null) {
|
||||
query.addCriteria(Criteria.where("id").is(id));
|
||||
}
|
||||
mongoTemplate.remove(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
public void deleteByProductId(String productIdFk) {
|
||||
Query query = new Query();
|
||||
if (productIdFk != null) {
|
||||
query.addCriteria(Criteria.where("invProductIdFk").is(productIdFk));
|
||||
}
|
||||
mongoTemplate.remove(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计库存数量
|
||||
*
|
||||
* @param detailParams
|
||||
* @return
|
||||
*/
|
||||
public long statCount(FilterInvProductDetailRequest detailParams) {
|
||||
Query query = new Query();
|
||||
if (StrUtil.isNotEmpty(detailParams.getBatchNo())) {
|
||||
query.addCriteria(Criteria.where("batchNo").is(detailParams.getBatchNo()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(detailParams.getProductIdFk())) {
|
||||
query.addCriteria(Criteria.where("productIdFk").is(detailParams.getProductIdFk()));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(detailParams.getInvCodes())) {
|
||||
query.addCriteria(Criteria.where("locStorageCode").in(detailParams.getInvCodes()));
|
||||
}
|
||||
return mongoTemplate.count(query, MongoDBName.NAME_INV_PRODUCT_DETAIL);
|
||||
}
|
||||
|
||||
|
||||
public InvProductDetailEntity statInvPreInDetail(String code) {
|
||||
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
||||
filterInvProductDetailRequest.setCode(code);
|
||||
|
||||
List<InvProductDetailEntity> datas = filterAllInvProduct(filterInvProductDetailRequest);
|
||||
if (CollUtil.isEmpty(datas)) {
|
||||
FilterInvProductDetailRequest tempQuery = new FilterInvProductDetailRequest();
|
||||
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
||||
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
|
||||
tempQuery.setBatchNo(udiEntity.getBatchNo());
|
||||
} else {
|
||||
tempQuery.setBatchNo("empty");
|
||||
}
|
||||
|
||||
datas = filterAllInvProduct(filterInvProductDetailRequest);
|
||||
}
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(datas)) {
|
||||
InvProductDetailEntity invProductDetailEntity = datas.get(0);
|
||||
return invProductDetailEntity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.glxp.udi.admin.mongo.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.glxp.udi.admin.dao.inout.InvProductDetailDao;
|
||||
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
|
||||
import com.glxp.udi.admin.entity.udid.UdiEntity;
|
||||
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
|
||||
import com.glxp.udi.admin.util.FilterUdiUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class InvProductDetailService {
|
||||
|
||||
@Resource
|
||||
private InvProductDetailDao invProductDetailDao;
|
||||
|
||||
public IPage<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
QueryWrapper<InvProductDetailEntity> wrapper = buildInvDetailQueryWrapper(filterInvProductDetailRequest);
|
||||
IPage<InvProductDetailEntity> page = new Page<>(filterInvProductDetailRequest.getPage(), filterInvProductDetailRequest.getLimit());
|
||||
return invProductDetailDao.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造查询条件
|
||||
*
|
||||
* @param filterInvProductDetailRequest
|
||||
* @return
|
||||
*/
|
||||
private QueryWrapper<InvProductDetailEntity> buildInvDetailQueryWrapper(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getCode()), "code", filterInvProductDetailRequest.getCode())
|
||||
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getProductIdFk()), "productIdFk", filterInvProductDetailRequest.getProductIdFk())
|
||||
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getMainAction()), "mainAction", filterInvProductDetailRequest.getMainAction())
|
||||
.eq(null != filterInvProductDetailRequest.getCustomerId(), "customerId", filterInvProductDetailRequest.getCustomerId())
|
||||
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getBatchNo()), "batchNo", filterInvProductDetailRequest.getBatchNo())
|
||||
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getOrderIdFk()), "orderIdFk", filterInvProductDetailRequest.getOrderIdFk())
|
||||
.in(CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes()), "locStorageCode", filterInvProductDetailRequest.getInvCodes());
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public List<InvProductDetailEntity> filterAllInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
QueryWrapper<InvProductDetailEntity> wrapper = buildInvDetailQueryWrapper(filterInvProductDetailRequest);
|
||||
return invProductDetailDao.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void insertInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
invProductDetailDao.insert(invProductDetailEntity);
|
||||
}
|
||||
|
||||
public void updateInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
invProductDetailDao.updateById(invProductDetailEntity);
|
||||
}
|
||||
|
||||
public void deleteById(String id) {
|
||||
invProductDetailDao.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品ID删除库存详情
|
||||
*
|
||||
* @param productIdFk
|
||||
*/
|
||||
public void deleteByProductId(String productIdFk) {
|
||||
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("productIdFk", productIdFk);
|
||||
invProductDetailDao.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计库存数量
|
||||
*
|
||||
* @param detailParams
|
||||
* @return
|
||||
*/
|
||||
public long statCount(FilterInvProductDetailRequest detailParams) {
|
||||
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(detailParams.getBatchNo()), "batchNo", detailParams.getBatchNo())
|
||||
.eq(StrUtil.isNotBlank(detailParams.getProductIdFk()), "productIdFk", detailParams.getProductIdFk())
|
||||
.eq(CollUtil.isNotEmpty(detailParams.getInvCodes()), "locStorageCode", detailParams.getInvCodes());
|
||||
return invProductDetailDao.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public InvProductDetailEntity statInvPreInDetail(String code) {
|
||||
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
||||
filterInvProductDetailRequest.setCode(code);
|
||||
|
||||
List<InvProductDetailEntity> datas = filterAllInvProduct(filterInvProductDetailRequest);
|
||||
if (CollUtil.isEmpty(datas)) {
|
||||
FilterInvProductDetailRequest tempQuery = new FilterInvProductDetailRequest();
|
||||
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
||||
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
|
||||
tempQuery.setBatchNo(udiEntity.getBatchNo());
|
||||
} else {
|
||||
tempQuery.setBatchNo("empty");
|
||||
}
|
||||
|
||||
datas = filterAllInvProduct(filterInvProductDetailRequest);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(datas)) {
|
||||
InvProductDetailEntity invProductDetailEntity = datas.get(0);
|
||||
return invProductDetailEntity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package com.glxp.udi.admin.mongo.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
|
||||
import com.glxp.udi.admin.mongo.MongoDBName;
|
||||
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
|
||||
import com.glxp.udi.admin.mongo.utils.PageResult;
|
||||
import com.glxp.udi.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WarehouseTempMdService {
|
||||
|
||||
@Resource
|
||||
private MongoTemplate mongoTemplate;
|
||||
@Resource
|
||||
private MongoPageHelper mongoPageHelper;
|
||||
|
||||
public PageResult<WarehousetempMdEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
|
||||
Query query = new Query();
|
||||
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
|
||||
}
|
||||
if (warehouseQueryRequest.getCorpOrderId() != null && !warehouseQueryRequest.getCorpOrderId().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("corpOrderId").is(warehouseQueryRequest.getCorpOrderId()));
|
||||
}
|
||||
if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) {
|
||||
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
|
||||
}
|
||||
if (warehouseQueryRequest.getCustomerId() != null) {
|
||||
query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId()));
|
||||
}
|
||||
return mongoPageHelper.pageQuery(query, WarehousetempMdEntity.class,
|
||||
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE_TEMP);
|
||||
}
|
||||
|
||||
public List<WarehousetempMdEntity> findTempByOrderId(String orderId) {
|
||||
Query query = new Query(Criteria.where("orderId").is(orderId));
|
||||
List<WarehousetempMdEntity> result = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void insertTempWarehouses(List<WarehousetempMdEntity> warehouseEntities) {
|
||||
if (warehouseEntities != null) {
|
||||
Collection<WarehousetempMdEntity> warehousetempEntityCollection = new ArrayList<>(warehouseEntities);
|
||||
mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTempWarehouses(List<String> ids) {
|
||||
if (ids != null) {
|
||||
for (String id : ids) {
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("_id").is(id));
|
||||
mongoTemplate.remove(query, MongoDBName.NAME_CODE_TEMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteCode(DeleteRequest deleteRequest) {
|
||||
Query query = new Query();
|
||||
if (deleteRequest.getId() != null) {
|
||||
query.addCriteria(Criteria.where("id").is(deleteRequest.getId()));
|
||||
}
|
||||
if (deleteRequest.getOrderId() != null) {
|
||||
query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId()));
|
||||
}
|
||||
mongoTemplate.remove(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
|
||||
}
|
||||
|
||||
public WarehousetempMdEntity findTempById(String id) {
|
||||
Query query = new Query();
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
query.addCriteria(Criteria.where("id").is(id));
|
||||
List<WarehousetempMdEntity> warehousetempEntities = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
|
||||
if (CollUtil.isNotEmpty(warehousetempEntities)) {
|
||||
return warehousetempEntities.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateById(WarehousetempMdEntity warehousetemp) {
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("id").is(warehousetemp.getId()));
|
||||
Update update = new Update();
|
||||
update.set("count", warehousetemp.getCount());
|
||||
mongoTemplate.updateMulti(query, update, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.glxp.udi.admin.mongo.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.glxp.udi.admin.dao.inout.CodesTempDao;
|
||||
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
|
||||
import com.glxp.udi.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WarehouseTempService {
|
||||
|
||||
@Resource
|
||||
private CodesTempDao codesTempDao;
|
||||
|
||||
public IPage<WarehousetempEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
|
||||
QueryWrapper<WarehousetempEntity> wrapper = buildCodesTempQueryWrapper(warehouseQueryRequest);
|
||||
|
||||
IPage<WarehousetempEntity> page = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
|
||||
return codesTempDao.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造查询条件
|
||||
* @param warehouseQueryRequest
|
||||
* @return
|
||||
*/
|
||||
private QueryWrapper<WarehousetempEntity> buildCodesTempQueryWrapper(WarehouseQueryRequest warehouseQueryRequest) {
|
||||
QueryWrapper<WarehousetempEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode())
|
||||
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getOrderId()),"orderId",warehouseQueryRequest.getOrderId())
|
||||
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCorpOrderId()), "corpOrderId", warehouseQueryRequest.getCorpOrderId())
|
||||
.eq(null != warehouseQueryRequest.getCustomerId(), "customerId", warehouseQueryRequest.getCustomerId());
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public List<WarehousetempEntity> findTempByOrderId(String orderId) {
|
||||
return codesTempDao.selectByOrderId(orderId);
|
||||
}
|
||||
|
||||
public void insertTempWarehouses(List<WarehousetempEntity> warehouseEntities) {
|
||||
if (CollUtil.isNotEmpty(warehouseEntities)) {
|
||||
warehouseEntities.forEach(warehousetemp -> codesTempDao.insert(warehousetemp));
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTempWarehouses(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
for (String id : ids) {
|
||||
codesTempDao.deleteById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteCode(DeleteRequest deleteRequest) {
|
||||
codesTempDao.delete(deleteRequest.getId(), deleteRequest.getOrderId());
|
||||
}
|
||||
|
||||
public WarehousetempEntity findTempById(String id) {
|
||||
return codesTempDao.selectById(id);
|
||||
}
|
||||
|
||||
public void updateById(WarehousetempEntity warehousetemp) {
|
||||
codesTempDao.updateCount(warehousetemp.getId(), warehousetemp.getCount());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.udi.admin.dao.inout.CodesDao">
|
||||
|
||||
|
||||
<update id="updateUnit">
|
||||
update io_codes
|
||||
set fromCorp = #{fromCorp} and fromCorpId = #{fromCorpId}
|
||||
where orderId = #{orderId}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderId">
|
||||
update io_codes set orderId = #{newOrderId} where orderId = #{orderId}
|
||||
</update>
|
||||
|
||||
<update id="updateCount">
|
||||
update io_codes set count = #{count} where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectByOrderId" resultType="com.glxp.udi.admin.entity.inout.WarehouseEntity">
|
||||
select * from io_codes where orderId = #{orderId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.udi.admin.dao.inout.CodesTempDao">
|
||||
<update id="updateCount">
|
||||
update io_codes_temp set count = #{count} where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from io_codes_temp where id = #{id} and orderId = #{orderId}
|
||||
</delete>
|
||||
|
||||
<select id="selectByOrderId" resultType="com.glxp.udi.admin.entity.inout.WarehousetempEntity">
|
||||
select * from io_codes_temp where orderId = #{orderId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue