第三方仓库,仓库信息修改
parent
83ef10e32f
commit
bc15c42c82
@ -0,0 +1,218 @@
|
||||
package com.glxp.api.controller.auth;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.auth.DeptEntity;
|
||||
import com.glxp.api.entity.auth.InvBusUserEntity;
|
||||
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusUserRequest;
|
||||
import com.glxp.api.req.auth.UpdateRelBusRequset;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.service.auth.DeptService;
|
||||
import com.glxp.api.service.auth.InvBusUserService;
|
||||
import com.glxp.api.service.auth.InvWarehouseService;
|
||||
import com.glxp.api.service.auth.WarehouseBussinessTypeService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
public class InvBusUserController {
|
||||
|
||||
@Resource
|
||||
InvBusUserService invBusUserService;
|
||||
@Resource
|
||||
WarehouseBussinessTypeService warehouseBussinessTypeService;
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("spms/bus/user/select/filter")
|
||||
public BaseResponse filterSelectInvUser(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
|
||||
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities =
|
||||
warehouseBussinessTypeService.getListByCode(filterInvBusUserRequest.getSubInvCode());
|
||||
|
||||
warehouseBussinessTypeEntities.forEach(warehouseBussinessTypeEntity ->
|
||||
{
|
||||
for (InvBusUserEntity invBusUserEntity : responses) {
|
||||
if (invBusUserEntity.getScAction().equals(warehouseBussinessTypeEntity.getAction())) {
|
||||
warehouseBussinessTypeEntity.setSelect(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return ResultVOUtils.success(warehouseBussinessTypeEntities);
|
||||
}
|
||||
|
||||
|
||||
//查询用户未关联单据类型
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("spms/bus/user/unselect/filter")
|
||||
public BaseResponse filterUnSelectInvUser(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
|
||||
List<String> selectedCodes = new ArrayList<>();
|
||||
responses.forEach(invBusUserEntity ->
|
||||
{
|
||||
selectedCodes.add(invBusUserEntity.getScAction());
|
||||
});
|
||||
filterInvBusUserRequest.setSelectedCodes(selectedCodes);
|
||||
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntityList = invBusUserService.filterUnSelect(filterInvBusUserRequest);
|
||||
|
||||
PageInfo<WarehouseBussinessTypeEntity> pageInfo = new PageInfo<>(warehouseBussinessTypeEntityList);
|
||||
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(warehouseBussinessTypeEntityList);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户关联的单据类型
|
||||
*
|
||||
* @param filterInvBusUserRequest
|
||||
* @return
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("spms/bus/user/filterUserBusList")
|
||||
public BaseResponse filterUserBusList(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
|
||||
PageInfo<InvBusUserEntity> pageInfo = new PageInfo<>(responses);
|
||||
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
if (pageInfo.getTotal() == 0) {
|
||||
pageSimpleResponse.setList(Collections.emptyList());
|
||||
} else {
|
||||
List<String> actions = responses.stream().map(InvBusUserEntity::getScAction).collect(Collectors.toList());
|
||||
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeService.selectByActions(filterInvBusUserRequest.getSubInvCode(), actions);
|
||||
pageSimpleResponse.setList(warehouseBussinessTypeEntities);
|
||||
}
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/spms/bus/user/warehouse/update")
|
||||
public BaseResponse updateRes(@RequestBody UpdateRelBusRequset relBusRequset) {
|
||||
boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
|
||||
if (CollUtil.isNotEmpty(relBusRequset.getInvBusUserEntities())) {
|
||||
relBusRequset.getInvBusUserEntities().forEach(warehouseBussinessTypeEntity ->
|
||||
{
|
||||
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
|
||||
invBusUserEntity.setUserId(relBusRequset.getUserId());
|
||||
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
|
||||
invBusUserEntity.setScAction(warehouseBussinessTypeEntity.getAction());
|
||||
invBusUserService.insertInvBusUser(invBusUserEntity);
|
||||
});
|
||||
}
|
||||
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
|
||||
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
|
||||
updateInvTime(invBusUserEntity);
|
||||
return ResultVOUtils.success("修改成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/spms/bus/user/warehouse/post")
|
||||
public BaseResponse postRes(@RequestBody UpdateRelBusRequset relBusRequset) {
|
||||
boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
|
||||
if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) {
|
||||
relBusRequset.getSelectActions().forEach(action ->
|
||||
{
|
||||
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
|
||||
invBusUserEntity.setUserId(relBusRequset.getUserId());
|
||||
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
|
||||
invBusUserEntity.setScAction(action);
|
||||
invBusUserService.insertInvBusUser(invBusUserEntity);
|
||||
});
|
||||
}
|
||||
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
|
||||
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
|
||||
updateInvTime(invBusUserEntity);
|
||||
return ResultVOUtils.success("修改成功!");
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("spms/bus/user/warehouse/filter")
|
||||
public BaseResponse filterInvWarehouse(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
|
||||
return ResultVOUtils.success(responses);
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/spms/bus/user/warehouse/save")
|
||||
public BaseResponse save(@RequestBody @Valid InvBusUserEntity invBusUserEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
boolean b = invBusUserService.insertInvBusUser(invBusUserEntity);
|
||||
updateInvTime(invBusUserEntity);
|
||||
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/spms/bus/user/warehouse/edit")
|
||||
public BaseResponse edit(@RequestBody @Valid InvBusUserEntity invBusUserEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (invBusUserEntity.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
boolean b = invBusUserService.updateInvBusUser(invBusUserEntity);
|
||||
updateInvTime(invBusUserEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("修改成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/spms/bus/user/warehouse/delete")
|
||||
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
|
||||
|
||||
if (deleteRequest.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
boolean b = invBusUserService.deleteById(deleteRequest.getId());
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
@Resource
|
||||
InvWarehouseService invWarehouseService;
|
||||
@Resource
|
||||
DeptService deptService;
|
||||
|
||||
public void updateInvTime(InvBusUserEntity invBusUserEntity) {
|
||||
InvWarehouseEntity invSubWarehouseEntity = invWarehouseService.findByInvSubByCode(invBusUserEntity.getSubInvCode());
|
||||
DeptEntity pEntity = deptService.selectByCode(invSubWarehouseEntity.getParentId());
|
||||
pEntity.setUpdateTime(new Date());
|
||||
deptService.updateInvWarehouse(pEntity);
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package com.glxp.api.controller.thrsys;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
|
||||
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.service.thrsys.ThrDeptService;
|
||||
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方仓库信息接口
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class ThrDeptController {
|
||||
|
||||
@Resource
|
||||
ThrDeptService thrDeptService;
|
||||
@Resource
|
||||
ThrInvWarehouseService thrInvWarehouseService;
|
||||
|
||||
@GetMapping("spms/thrsys/warehouse/filter")
|
||||
public BaseResponse filterInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
|
||||
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
|
||||
PageInfo<ThrDeptEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
|
||||
PageSimpleResponse<ThrDeptEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(thrInvWarehouseEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("spms/thrsys/warehouse/filterAll")
|
||||
public BaseResponse filterAllInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
|
||||
filterThrDeptRequest.setPid(0);
|
||||
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
|
||||
return ResultVOUtils.success(thrInvWarehouseEntities);
|
||||
}
|
||||
|
||||
@PostMapping("/spms/thrsys/warehouse/save")
|
||||
public BaseResponse save(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
if (thrDeptEntity.getPid() == null) {//仓库
|
||||
thrDeptEntity.setPid(0); // 默认设置
|
||||
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
|
||||
filterThrDeptRequest.setPid(thrDeptEntity.getPid());
|
||||
} else {//货位
|
||||
|
||||
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
|
||||
filterThrDeptRequest.setPid(thrDeptEntity.getPid());
|
||||
ThrDeptEntity pEntity = thrDeptService.selectById(thrDeptEntity.getPid() + "");
|
||||
thrDeptEntity.setAdvanceType(pEntity.getAdvanceType());
|
||||
thrDeptEntity.setLevel(pEntity.getLevel());
|
||||
thrDeptEntity.setPcode(pEntity.getPcode());
|
||||
}
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
boolean b = thrDeptService.insertInvWarehouse(thrDeptEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/spms/thrsys/warehouse/edit")
|
||||
public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (thrDeptEntity.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
thrDeptEntity.setPid(null); // 不能修改父级 pid
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
@PostMapping("/spms/thrsys/warehouse/delete")
|
||||
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
|
||||
if (deleteRequest.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
return thrDeptService.deleteInvById(deleteRequest.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载第三方系统的仓库
|
||||
*/
|
||||
@GetMapping("/spms/thrsys/warehouse/download")
|
||||
public BaseResponse downloadThirdWarehouse(String thirdSysFk) {
|
||||
if (StrUtil.isBlank(thirdSysFk)) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
return thrDeptService.downloadThirdWarehouse(thirdSysFk);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/spms/sub/inv/warehouse/filterThridInv")
|
||||
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
// todo
|
||||
// InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(filterThrSubInvWarehouseRequest.getParentId());
|
||||
// Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, filterThrSubInvWarehouseRequest.getThirdSysFk());
|
||||
// if (thirdId == null) {
|
||||
// return ResultVOUtils.error(500, "请先关联仓库对应的第三方仓库,再关联分库!");
|
||||
// }
|
||||
// filterThrSubInvWarehouseRequest.setParentId((String) thirdId);
|
||||
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
PageInfo<ThrInvWarehouseEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
|
||||
PageSimpleResponse<ThrInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(thrInvWarehouseEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.glxp.api.controller.thrsys;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
|
||||
import com.glxp.api.service.thrsys.ThrDeptService;
|
||||
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class ThrInvWarehouseController {
|
||||
|
||||
@Resource
|
||||
ThrInvWarehouseService thrInvWarehouseService;
|
||||
@Resource
|
||||
ThrDeptService thrDeptService;
|
||||
|
||||
@GetMapping("/thirdSys/sub/inv/warehouse/filter")
|
||||
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
List<ThrInvWarehouseResponse> ThrInvWarehouseResponses = thrInvWarehouseService.filterThrInvWarehouseResponse(filterThrSubInvWarehouseRequest);
|
||||
PageInfo<ThrInvWarehouseResponse> pageInfo;
|
||||
pageInfo = new PageInfo<>(ThrInvWarehouseResponses);
|
||||
PageSimpleResponse<ThrInvWarehouseResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(ThrInvWarehouseResponses);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/thirdSys/sub/inv/warehouse/filterAll")
|
||||
public BaseResponse filterAllInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
List<ThrInvWarehouseEntity> invSubWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
return ResultVOUtils.success(invSubWarehouseEntities);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/thirdSys/sub/inv/warehouse/save")
|
||||
public BaseResponse save(@RequestBody @Valid ThrInvWarehouseEntity invSubWarehouseEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
invSubWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + "");
|
||||
boolean b = thrInvWarehouseService.insertThrInvWarehouse(invSubWarehouseEntity);
|
||||
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
thrDeptService.updateInvWarehouse(thrDeptEntity);
|
||||
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/thirdSys/sub/inv/warehouse/edit")
|
||||
public BaseResponse edit(@RequestBody @Valid ThrInvWarehouseEntity invSubWarehouseEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (invSubWarehouseEntity.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
boolean b = thrInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
thrDeptService.updateInvWarehouse(thrDeptEntity);
|
||||
|
||||
|
||||
return ResultVOUtils.success("修改成功!");
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/thirdSys/sub/inv/warehouse/delete")
|
||||
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
|
||||
|
||||
if (deleteRequest.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
|
||||
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectById(deleteRequest.getId());
|
||||
|
||||
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(thrInvWarehouseEntity.getParentId(), thrInvWarehouseEntity.getThirdSysFk());
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
thrDeptService.updateInvWarehouse(thrDeptEntity);
|
||||
boolean b = thrInvWarehouseService.deleteById(deleteRequest.getId());
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
return ResultVOUtils.success("刪除成功!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.glxp.api.dao.auth;
|
||||
|
||||
import com.glxp.api.entity.auth.InvBusUserEntity;
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusUserRequest;
|
||||
import com.glxp.api.res.auth.InvBusUserResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InvBusUserDao {
|
||||
|
||||
|
||||
List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
boolean insertInvBusUser(InvBusUserEntity InvBusUserEntity);
|
||||
|
||||
boolean updateInvBusUser(InvBusUserEntity InvBusUserEntity);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
boolean deleteByUnion(@Param("userId") String userId, @Param("subInvCode") String subInvCode);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.glxp.api.dao.auth;
|
||||
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WarehouseBussinessTypeDao {
|
||||
WarehouseBussinessTypeEntity selectById(Integer id);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(WarehouseBussinessTypeEntity record);
|
||||
|
||||
int insertOrUpdate(WarehouseBussinessTypeEntity record);
|
||||
|
||||
int insertOrUpdateSelective(WarehouseBussinessTypeEntity record);
|
||||
|
||||
int insertSelective(WarehouseBussinessTypeEntity record);
|
||||
|
||||
WarehouseBussinessTypeEntity selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(WarehouseBussinessTypeEntity record);
|
||||
|
||||
int updateByPrimaryKey(WarehouseBussinessTypeEntity record);
|
||||
|
||||
int updateBatch(List<WarehouseBussinessTypeEntity> list);
|
||||
|
||||
int updateBatchSelective(List<WarehouseBussinessTypeEntity> list);
|
||||
|
||||
int batchInsert(@Param("list") List<WarehouseBussinessTypeEntity> list);
|
||||
|
||||
List<WarehouseBussinessTypeEntity> selectListByCode(@Param("code") String code);
|
||||
|
||||
List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest);
|
||||
|
||||
void deleteByCode(@Param("code") String code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据单据类型编码查询单据类型列表
|
||||
*
|
||||
* @param actions
|
||||
* @return
|
||||
*/
|
||||
List<WarehouseBussinessTypeEntity> selectByActions(@Param("subInvCode") String subInvCode, @Param("actions") List<String> actions);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrDeptDao {
|
||||
|
||||
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
|
||||
|
||||
List<ThrDeptEntity> filterThrGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
|
||||
|
||||
boolean insertThrInvWarehouse(ThrDeptEntity thrDeptEntity);
|
||||
|
||||
boolean insertInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrDeptEntity> thrDeptEntities);
|
||||
|
||||
boolean updateThrInvWarehouse(ThrDeptEntity thrDeptEntity);
|
||||
|
||||
ThrDeptEntity selectById(@Param("id") String id);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 根据code查询第三方仓库数据
|
||||
*/
|
||||
ThrDeptEntity selectByCode(@Param("code") String code);
|
||||
|
||||
ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.api.entity.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvBusUserEntity {
|
||||
private Integer id;
|
||||
private String userId;
|
||||
private String subInvCode;
|
||||
private String scAction;
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.glxp.api.entity.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 仓库字典-单据类型关联表
|
||||
*/
|
||||
@Data
|
||||
public class WarehouseBussinessTypeEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 仓位码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private boolean select;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.glxp.api.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 第三方仓库信息
|
||||
*/
|
||||
@Data
|
||||
public class ThrDeptEntity {
|
||||
|
||||
private Integer id;
|
||||
private Integer pid;
|
||||
private String code;
|
||||
private String name;
|
||||
private Boolean advanceType;
|
||||
private Boolean isDefault;
|
||||
private Integer status;
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 仓库等级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 父级仓库编码
|
||||
*/
|
||||
private String pcode;
|
||||
|
||||
/**
|
||||
* 第三方系统标识
|
||||
*/
|
||||
private String thirdSysFk;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ThrInvWarehouseEntity {
|
||||
|
||||
|
||||
private String id;
|
||||
private String code;
|
||||
private String name;
|
||||
private String parentId;
|
||||
private String remark;
|
||||
private String thirdSysFk;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.glxp.api.req.auth;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BussinessTypeFilterRequest extends ListPageRequest {
|
||||
|
||||
private Boolean enable;
|
||||
private String action;
|
||||
private String thirdAction;
|
||||
private String name;
|
||||
private String mainAction;
|
||||
private Boolean enabled;
|
||||
private Boolean checkEnable;
|
||||
private Boolean advanceType;
|
||||
private String type;
|
||||
private Integer index;
|
||||
|
||||
private Boolean spUse;
|
||||
private String localAction;
|
||||
private Boolean secCheckEnable;
|
||||
|
||||
private String filterAction;
|
||||
private Integer userId;
|
||||
|
||||
private String locInvCode;
|
||||
private String locSubInvCode;
|
||||
private String lastUpdateTime;
|
||||
private String code;
|
||||
private String ids;
|
||||
private List<String> actionList;
|
||||
private Boolean preIn;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.glxp.api.req.auth;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterInvBusTypeRequest extends ListPageRequest {
|
||||
private String lastUpdateTime;
|
||||
private Integer id;
|
||||
private String code;
|
||||
private String action;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.req.auth;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FilterInvBusUserRequest extends ListPageRequest {
|
||||
|
||||
|
||||
private String userId;
|
||||
private String subInvCode;
|
||||
private String scAction;
|
||||
|
||||
private List<String> selectedCodes;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.req.auth;
|
||||
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UpdateRelBusRequset {
|
||||
private String userId;
|
||||
private String subInvCode;
|
||||
private List<String> selectActions;
|
||||
private List<WarehouseBussinessTypeEntity> invBusUserEntities;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class FilterThrDeptRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
private Integer pid;
|
||||
private String code;
|
||||
private String name;
|
||||
private Boolean advanceType;
|
||||
private Boolean isDefault;
|
||||
private Date updateTime;
|
||||
private String key;
|
||||
private String pcode;
|
||||
private Integer level;
|
||||
|
||||
private String lastUpdateTime;
|
||||
|
||||
/**
|
||||
* 第三方系统标识
|
||||
*/
|
||||
private String thirdSysFk;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterThrSubInvWarehouseRequest extends ListPageRequest {
|
||||
|
||||
private String id;
|
||||
private String code;
|
||||
private String name;
|
||||
private String parentId;
|
||||
private String thirdSysFk;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 仓库货位信息查询参数
|
||||
*/
|
||||
@Data
|
||||
public class UdiwmsWarehouseRequest extends ListPageRequest {
|
||||
|
||||
//仓库号,支持模糊查询
|
||||
private String inventoryCode;
|
||||
|
||||
//货位号,支持模糊查询
|
||||
private String warehouseCode;
|
||||
|
||||
//第三方系统ID
|
||||
private String thirdSys;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.glxp.api.res.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvBusUserResponse {
|
||||
private Integer id;
|
||||
private String userId;
|
||||
private String subInvCode;
|
||||
private String scAction;
|
||||
private String billTypeName;
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ThrDeptResponse {
|
||||
|
||||
|
||||
private Integer id;
|
||||
private Integer pid;
|
||||
private String code;
|
||||
private String name;
|
||||
private Boolean advanceType;
|
||||
private Boolean isDefault;
|
||||
private Integer status;
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 第三方系统标识
|
||||
*/
|
||||
private String thirdSysFk;
|
||||
|
||||
/**
|
||||
* 第三方系统名称
|
||||
*/
|
||||
private String thirdName;
|
||||
|
||||
private List<ThrDeptResponse> children;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 第三方分库接口响应数据
|
||||
*/
|
||||
@Data
|
||||
public class ThrInvWarehouseResponse extends ThrInvWarehouseEntity {
|
||||
|
||||
/**
|
||||
* 父仓库名称
|
||||
*/
|
||||
private String parentName;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UdiwmsWarehouseDetail {
|
||||
|
||||
//货位号
|
||||
private String code;
|
||||
|
||||
//货位名称
|
||||
private String name;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
private List<SubWarehouse> subWarehouses;
|
||||
|
||||
@Data
|
||||
public static class SubWarehouse {
|
||||
//货位号
|
||||
private String code;
|
||||
|
||||
//货位名称
|
||||
private String name;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 仓库货位号返回信息
|
||||
*/
|
||||
@Data
|
||||
public class UdiwmsWarehouseResponse extends UdiwmsWarehouseDetail{
|
||||
|
||||
private List<UdiwmsWarehouseDetail> details;
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.glxp.api.service.auth;
|
||||
|
||||
|
||||
import com.glxp.api.entity.auth.InvBusUserEntity;
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusUserRequest;
|
||||
import com.glxp.api.res.auth.InvBusUserResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InvBusUserService {
|
||||
|
||||
List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
|
||||
|
||||
List<InvBusUserEntity> selectByUnion(String userId, String subInvCode);
|
||||
|
||||
boolean insertInvBusUser(InvBusUserEntity InvBusUserEntity);
|
||||
|
||||
boolean updateInvBusUser(InvBusUserEntity InvBusUserEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean deleteByUnion(String userId, String subInvCode);
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.glxp.api.service.auth;
|
||||
|
||||
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
|
||||
import com.glxp.api.req.auth.FilterInvLinkDataRequest;
|
||||
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WarehouseBussinessTypeService {
|
||||
WarehouseBussinessTypeEntity selectById(Integer id);
|
||||
|
||||
/**
|
||||
* 根据code查询数据列表
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<WarehouseBussinessTypeEntity> getListByCode(String code);
|
||||
|
||||
List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest);
|
||||
|
||||
/**
|
||||
* 添加仓库信息-单据类型关联数据
|
||||
*/
|
||||
void saveWarehouseBussinessType(String code, List<BasicBussinessTypeResponse> bussinessTypResponseList);
|
||||
|
||||
/**
|
||||
* 移除仓库信息关联单据类型
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteWarehouseByssuinessType(Integer id);
|
||||
|
||||
/**
|
||||
* 查询仓库关联的单据类型数据
|
||||
*
|
||||
* @param filterInvLinkDataRequest
|
||||
* @return
|
||||
*/
|
||||
List<WarehouseBussinessTypeEntity> getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest);
|
||||
|
||||
/**
|
||||
* 根据单据类型编码查询单据类型列表
|
||||
*
|
||||
* @param actions
|
||||
* @return
|
||||
*/
|
||||
List<WarehouseBussinessTypeEntity> selectByActions(String subInvCode, List<String> actions);
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.glxp.api.service.auth.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.auth.InvBusUserDao;
|
||||
import com.glxp.api.entity.auth.InvBusUserEntity;
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusUserRequest;
|
||||
import com.glxp.api.res.auth.InvBusUserResponse;
|
||||
import com.glxp.api.service.auth.InvBusUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class InvBusUserServiceImpl implements InvBusUserService {
|
||||
|
||||
@Resource
|
||||
InvBusUserDao invBusUserDao;
|
||||
|
||||
@Override
|
||||
public List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
|
||||
if (filterInvBusUserRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvBusUserRequest.getPage() != null) {
|
||||
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
|
||||
}
|
||||
return invBusUserDao.filterInvBusUser(filterInvBusUserRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
if (filterInvBusUserRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvBusUserRequest.getPage() != null) {
|
||||
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
|
||||
}
|
||||
return invBusUserDao.filterUnSelect(filterInvBusUserRequest);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest) {
|
||||
if (filterInvBusUserRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvBusUserRequest.getPage() != null) {
|
||||
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
|
||||
}
|
||||
return invBusUserDao.filterJoinInvBusUser(filterInvBusUserRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InvBusUserEntity> selectByUnion(String userId, String subInvCode) {
|
||||
|
||||
if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(subInvCode)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest();
|
||||
filterInvBusUserRequest.setUserId(userId);
|
||||
filterInvBusUserRequest.setSubInvCode(subInvCode);
|
||||
return invBusUserDao.filterInvBusUser(filterInvBusUserRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvBusUser(InvBusUserEntity invBusUserEntity) {
|
||||
return invBusUserDao.insertInvBusUser(invBusUserEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInvBusUser(InvBusUserEntity invBusUserEntity) {
|
||||
return invBusUserDao.updateInvBusUser(invBusUserEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return invBusUserDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteByUnion(String userId, String subInvCode) {
|
||||
if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(subInvCode)) {
|
||||
return false;
|
||||
}
|
||||
return invBusUserDao.deleteByUnion(userId, subInvCode);
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.glxp.api.service.auth.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.auth.WarehouseBussinessTypeDao;
|
||||
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
||||
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
|
||||
import com.glxp.api.req.auth.FilterInvLinkDataRequest;
|
||||
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
|
||||
import com.glxp.api.service.auth.WarehouseBussinessTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessTypeService {
|
||||
|
||||
@Resource
|
||||
private WarehouseBussinessTypeDao warehouseBussinessTypeDao;
|
||||
|
||||
@Override
|
||||
public WarehouseBussinessTypeEntity selectById(Integer id) {
|
||||
return warehouseBussinessTypeDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseBussinessTypeEntity> getListByCode(String code) {
|
||||
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeDao.selectListByCode(code);
|
||||
if (CollUtil.isEmpty(warehouseBussinessTypeEntities)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return warehouseBussinessTypeEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest) {
|
||||
if (filterInvBusTypeRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvBusTypeRequest.getPage() != null) {
|
||||
int offset = (filterInvBusTypeRequest.getPage() - 1) * filterInvBusTypeRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvBusTypeRequest.getLimit());
|
||||
}
|
||||
|
||||
return warehouseBussinessTypeDao.filterList(filterInvBusTypeRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWarehouseBussinessType(String code, List<BasicBussinessTypeResponse> bussinessTypResponseList) {
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(bussinessTypResponseList)) {
|
||||
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = new ArrayList<>(bussinessTypResponseList.size());
|
||||
bussinessTypResponseList.forEach(bussinessTypeEntity -> {
|
||||
WarehouseBussinessTypeEntity entity = new WarehouseBussinessTypeEntity();
|
||||
entity.setCode(code);
|
||||
entity.setAction(bussinessTypeEntity.getAction());
|
||||
entity.setName(bussinessTypeEntity.getName());
|
||||
warehouseBussinessTypeEntities.add(entity);
|
||||
});
|
||||
|
||||
//加入新数据
|
||||
warehouseBussinessTypeDao.batchInsert(warehouseBussinessTypeEntities);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWarehouseByssuinessType(Integer id) {
|
||||
if (null != id) {
|
||||
warehouseBussinessTypeDao.deleteByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseBussinessTypeEntity> getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest) {
|
||||
if (filterInvLinkDataRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvLinkDataRequest.getPage() != null) {
|
||||
int offset = (filterInvLinkDataRequest.getPage() - 1) * filterInvLinkDataRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvLinkDataRequest.getLimit());
|
||||
}
|
||||
return warehouseBussinessTypeDao.selectListByCode(filterInvLinkDataRequest.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseBussinessTypeEntity> selectByActions(String subInvCode, List<String> actions) {
|
||||
return warehouseBussinessTypeDao.selectByActions(subInvCode, actions);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrDeptService {
|
||||
|
||||
|
||||
ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault);
|
||||
|
||||
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
|
||||
|
||||
List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
|
||||
|
||||
boolean insertInvWarehouse(ThrDeptEntity thrDeptEntity);
|
||||
|
||||
boolean insertInvWarehouses(List<ThrDeptEntity> thrDeptEntities);
|
||||
|
||||
boolean updateInvWarehouse(ThrDeptEntity thrDeptEntity);
|
||||
|
||||
ThrDeptEntity selectById(String id);
|
||||
|
||||
ThrDeptEntity selectByCode(String code, String thirdSysFk);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest);
|
||||
|
||||
/**
|
||||
* 下载第三方系统仓库数据
|
||||
*
|
||||
* @param thirdSysFk
|
||||
* @return
|
||||
*/
|
||||
BaseResponse downloadThirdWarehouse(String thirdSysFk);
|
||||
|
||||
/**
|
||||
* 删除第三方仓库
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
BaseResponse deleteInvById(String id);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrInvWarehouseService {
|
||||
|
||||
ThrInvWarehouseEntity selectById(String id);
|
||||
|
||||
ThrInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId);
|
||||
|
||||
List<ThrInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
|
||||
|
||||
boolean insertThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
|
||||
|
||||
boolean insertInvWarehouses(List<ThrInvWarehouseEntity> thrSubInvWarehouseEntities);
|
||||
|
||||
boolean updateThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
/**
|
||||
* 查询第三方分库数据
|
||||
*
|
||||
* @param filterThrSubInvWarehouseRequest
|
||||
* @return
|
||||
*/
|
||||
List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
|
||||
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.dao.thrsys.ThrDeptDao;
|
||||
import com.glxp.api.dao.thrsys.ThrInvWarehouseDao;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.http.ErpBasicClient;
|
||||
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
|
||||
import com.glxp.api.req.thrsys.UdiwmsWarehouseRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.UdiwmsWarehouseDetail;
|
||||
import com.glxp.api.service.thrsys.ThrDeptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThrDeptServiceImpl implements ThrDeptService {
|
||||
|
||||
@Resource
|
||||
private ThrDeptDao thrDeptDao;
|
||||
@Resource
|
||||
private ErpBasicClient erpBasicClient;
|
||||
@Resource
|
||||
private ThrInvWarehouseDao thrInvWarehouseDao;
|
||||
|
||||
@Override
|
||||
public ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault) {
|
||||
|
||||
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
|
||||
filterThrDeptRequest.setIsDefault(isDefault);
|
||||
filterThrDeptRequest.setAdvanceType(advaceType);
|
||||
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptDao.filterThrInvWarehouse(filterThrDeptRequest);
|
||||
if (thrInvWarehouseEntities != null && thrInvWarehouseEntities.size() > 0)
|
||||
return thrInvWarehouseEntities.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
|
||||
if (filterThrDeptRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterThrDeptRequest.getPage() != null) {
|
||||
int offset = (filterThrDeptRequest.getPage() - 1) * filterThrDeptRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrDeptRequest.getLimit());
|
||||
}
|
||||
return thrDeptDao.filterThrInvWarehouse(filterThrDeptRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
|
||||
if (filterThrDeptRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterThrDeptRequest.getPage() != null) {
|
||||
int offset = (filterThrDeptRequest.getPage() - 1) * filterThrDeptRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrDeptRequest.getLimit());
|
||||
}
|
||||
return thrDeptDao.filterThrGroupInvWarehouse(filterThrDeptRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvWarehouse(ThrDeptEntity thrDeptEntity) {
|
||||
return thrDeptDao.insertThrInvWarehouse(thrDeptEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvWarehouses(List<ThrDeptEntity> thrDeptEntities) {
|
||||
return thrDeptDao.insertInvWarehouses(thrDeptEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInvWarehouse(ThrDeptEntity thrDeptEntity) {
|
||||
return thrDeptDao.updateThrInvWarehouse(thrDeptEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrDeptEntity selectById(String id) {
|
||||
return thrDeptDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrDeptEntity selectByCode(String code, String thirdSysFk) {
|
||||
FilterThrDeptRequest thrInvWarehouseRequest = new FilterThrDeptRequest();
|
||||
thrInvWarehouseRequest.setCode(code);
|
||||
thrInvWarehouseRequest.setThirdSysFk(thirdSysFk);
|
||||
List<ThrDeptEntity> invWarehouseEntities = thrDeptDao.filterThrInvWarehouse(thrInvWarehouseRequest);
|
||||
if (invWarehouseEntities != null && invWarehouseEntities.size() > 0)
|
||||
return invWarehouseEntities.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
int count = thrInvWarehouseDao.countSubInvByParentInvId(id);
|
||||
if (count > 0) {
|
||||
return false;
|
||||
}
|
||||
return thrDeptDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest) {
|
||||
return thrDeptDao.selectMaxCode(filterThrDeptRequest);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public BaseResponse downloadThirdWarehouse(String thirdSysFk) {
|
||||
int page = 1;
|
||||
int limit = 100;
|
||||
while (true) {
|
||||
UdiwmsWarehouseRequest udiwmsWarehouseRequest = new UdiwmsWarehouseRequest();
|
||||
udiwmsWarehouseRequest.setThirdSys(thirdSysFk);
|
||||
udiwmsWarehouseRequest.setPage(page);
|
||||
udiwmsWarehouseRequest.setLimit(limit);
|
||||
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
|
||||
if (baseResponse.getCode() == 20000) {
|
||||
List<UdiwmsWarehouseDetail> responseList = baseResponse.getData().getList();
|
||||
List<ThrDeptEntity> list = new ArrayList<>();
|
||||
for (UdiwmsWarehouseDetail response : responseList) {
|
||||
ThrDeptEntity thrDeptEntity = new ThrDeptEntity();
|
||||
thrDeptEntity.setPid(0);
|
||||
thrDeptEntity.setName(response.getName());
|
||||
thrDeptEntity.setCode(response.getCode());
|
||||
thrDeptEntity.setThirdSysFk(thirdSysFk);
|
||||
thrDeptEntity.setAdvanceType(false); //默认是仓库
|
||||
thrDeptEntity.setStatus(1);//默认启用
|
||||
thrDeptEntity.setUpdateTime(new Date());
|
||||
list.add(thrDeptEntity);
|
||||
|
||||
List<UdiwmsWarehouseDetail.SubWarehouse> subWarehouseList = response.getSubWarehouses();
|
||||
if (CollUtil.isNotEmpty(subWarehouseList)) {
|
||||
for (UdiwmsWarehouseDetail.SubWarehouse subWarehouse : subWarehouseList) {
|
||||
ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity();
|
||||
thrInvWarehouseEntity.setCode(subWarehouse.getCode());
|
||||
thrInvWarehouseEntity.setName(subWarehouse.getName());
|
||||
thrInvWarehouseEntity.setRemark(subWarehouse.getRemark());
|
||||
thrInvWarehouseEntity.setThirdSysFk(thirdSysFk);
|
||||
thrInvWarehouseEntity.setParentId(response.getCode());
|
||||
thrInvWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + "");
|
||||
thrInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//插入数据
|
||||
thrDeptDao.insertInvWarehouses(list);
|
||||
if (list.size() >= limit) {
|
||||
page++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
|
||||
return ResultVOUtils.success("下载结束!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse deleteInvById(String id) {
|
||||
//查询有无子仓库
|
||||
int count = thrInvWarehouseDao.countSubInvByParentInvId(id);
|
||||
if (count > 0) {
|
||||
return ResultVOUtils.error(500, "请先删除子仓库!");
|
||||
} else
|
||||
thrDeptDao.deleteById(id);
|
||||
|
||||
return ResultVOUtils.success("删除成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.thrsys.ThrInvWarehouseDao;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
|
||||
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
|
||||
|
||||
@Resource
|
||||
ThrInvWarehouseDao thrInvWarehouseDao;
|
||||
|
||||
|
||||
@Override
|
||||
public ThrInvWarehouseEntity selectById(String id) {
|
||||
if (StrUtil.isEmpty(id)) {
|
||||
return null;
|
||||
}
|
||||
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
|
||||
filterThrSubInvWarehouseRequest.setId(id);
|
||||
List<ThrInvWarehouseEntity> thrSubInvWarehouseEntities = thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
if (CollUtil.isNotEmpty(thrSubInvWarehouseEntities)) {
|
||||
return thrSubInvWarehouseEntities.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId) {
|
||||
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
|
||||
filterThrSubInvWarehouseRequest.setCode(thirdId);
|
||||
filterThrSubInvWarehouseRequest.setThirdSysFk(thirdSys);
|
||||
List<ThrInvWarehouseEntity> thrInvWarehouseEntitys = thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
if (CollUtil.isNotEmpty(thrInvWarehouseEntitys)) {
|
||||
return thrInvWarehouseEntitys.get(0);
|
||||
} else return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
if (filterThrSubInvWarehouseRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterThrSubInvWarehouseRequest.getPage() != null) {
|
||||
int offset = (filterThrSubInvWarehouseRequest.getPage() - 1) * filterThrSubInvWarehouseRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrSubInvWarehouseRequest.getLimit());
|
||||
}
|
||||
return thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity) {
|
||||
return thrInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvWarehouses(List<ThrInvWarehouseEntity> thrInvWarehouseEntitys) {
|
||||
return thrInvWarehouseDao.insertThrInvWarehouses(thrInvWarehouseEntitys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity) {
|
||||
return thrInvWarehouseDao.updateThrInvWarehouse(thrInvWarehouseEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return thrInvWarehouseDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
if (null == filterThrSubInvWarehouseRequest) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterThrSubInvWarehouseRequest.getPage() != null) {
|
||||
int offset = (filterThrSubInvWarehouseRequest.getPage() - 1) * filterThrSubInvWarehouseRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrSubInvWarehouseRequest.getLimit());
|
||||
}
|
||||
return thrInvWarehouseDao.filterThrInvWarehouseResponse(filterThrSubInvWarehouseRequest);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
<?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.api.dao.auth.InvBusUserDao">
|
||||
|
||||
<select id="filterInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
|
||||
resultType="com.glxp.api.entity.auth.InvBusUserEntity">
|
||||
select *
|
||||
FROM inv_bustype_user
|
||||
<where>
|
||||
<if test="userId != '' and userId != null">
|
||||
AND userId = #{userId}
|
||||
</if>
|
||||
<if test="subInvCode != '' and subInvCode != null">
|
||||
AND subInvCode = #{subInvCode}
|
||||
</if>
|
||||
<if test="scAction != '' and scAction != null">
|
||||
AND scAction = #{scAction}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterUnSelect" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
|
||||
resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
select inv_warehouse_bussiness_type.id,
|
||||
inv_warehouse_bussiness_type.code,
|
||||
inv_warehouse_bussiness_type.action,
|
||||
basic_bussiness_type.name
|
||||
from inv_warehouse_bussiness_type
|
||||
inner join basic_bussiness_type on inv_warehouse_bussiness_type.action = basic_bussiness_type.action
|
||||
<where>
|
||||
<if test="subInvCode != '' and subInvCode != null">
|
||||
AND code = #{subInvCode}
|
||||
</if>
|
||||
<if test="selectedCodes != null and selectedCodes.size()!=0">
|
||||
and inv_warehouse_bussiness_type.action not in
|
||||
<foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterJoinInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
|
||||
resultType="com.glxp.api.res.auth.InvBusUserResponse">
|
||||
select inv_bustype_user.*,basic_bussiness_type.name billTypeName
|
||||
FROM inv_bustype_user left join basic_bussiness_type on inv_bustype_user.scAction = basic_bussiness_type.action
|
||||
<where>
|
||||
<if test="userId != '' and userId != null">
|
||||
AND userId = #{userId}
|
||||
</if>
|
||||
<if test="subInvCode != '' and subInvCode != null">
|
||||
AND subInvCode = #{subInvCode}
|
||||
</if>
|
||||
<if test="scAction != '' and scAction != null">
|
||||
AND scAction = #{scAction}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
group by inv_bustype_user.id
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertInvBusUser" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
|
||||
replace
|
||||
INTO inv_bustype_user
|
||||
(userId, `subInvCode`, scAction, remark)
|
||||
values (
|
||||
#{userId},
|
||||
#{subInvCode},
|
||||
#{scAction},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM inv_bustype_user
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByUnion" parameterType="Map">
|
||||
DELETE
|
||||
FROM inv_bustype_user
|
||||
WHERE subInvCode = #{subInvCode}
|
||||
and userId = #{userId}
|
||||
</delete>
|
||||
<update id="updateInvBusUser" parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
|
||||
UPDATE inv_bustype_user
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="userId != null">userId=#{userId},</if>
|
||||
<if test="subInvCode != null">subInvCode=#{subInvCode},</if>
|
||||
<if test="parentId != null">parentId=#{parentId},</if>
|
||||
<if test="scAction != null">scAction=#{scAction},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,292 @@
|
||||
<?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.api.dao.auth.WarehouseBussinessTypeDao">
|
||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table auth_warehouse_bustype-->
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="code" jdbcType="VARCHAR" property="code"/>
|
||||
<result column="action" jdbcType="VARCHAR" property="action"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, code, `action`, `name`
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from auth_warehouse_bustype
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from auth_warehouse_bustype
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into auth_warehouse_bustype (code, `action`, `name`
|
||||
)
|
||||
values (#{code,jdbcType=VARCHAR}, #{action,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into auth_warehouse_bustype
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">
|
||||
code,
|
||||
</if>
|
||||
<if test="action != null">
|
||||
`action`,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">
|
||||
#{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null">
|
||||
#{action,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
<!--@mbg.generated-->
|
||||
update auth_warehouse_bustype
|
||||
<set>
|
||||
<if test="code != null">
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null">
|
||||
`action` = #{action,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
<!--@mbg.generated-->
|
||||
update auth_warehouse_bustype
|
||||
set code = #{code,jdbcType=VARCHAR},
|
||||
`action` = #{action,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateBatch" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update auth_warehouse_bustype
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`action` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.action,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`name` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update auth_warehouse_bustype
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.code != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`action` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.action != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.action,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`name` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.name != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into auth_warehouse_bustype
|
||||
(code, `action`, `name`)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.code,jdbcType=VARCHAR}, #{item.action,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into auth_warehouse_bustype
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
code,
|
||||
`action`,
|
||||
`name`,
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
#{code,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
`action` = #{action,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into auth_warehouse_bustype
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code,
|
||||
</if>
|
||||
<if test="action != null">
|
||||
`action`,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
#{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null">
|
||||
#{action,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null">
|
||||
`action` = #{action,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectListByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select auth_warehouse_bustype.id,
|
||||
auth_warehouse_bustype.code,
|
||||
auth_warehouse_bustype.action,
|
||||
basic_bussiness_type.name
|
||||
from auth_warehouse_bustype
|
||||
inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
|
||||
where code = #{code}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvBusTypeRequest"
|
||||
resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
SELECT * FROM auth_warehouse_bustype
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="action != '' and action != null">
|
||||
AND `action` = #{action}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
select *
|
||||
from auth_warehouse_bustype
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListByAction" resultMap="BaseResultMap">
|
||||
select auth_warehouse_bustype.id,
|
||||
auth_warehouse_bustype.code,
|
||||
auth_warehouse_bustype.action,
|
||||
basic_bussiness_type.name
|
||||
from auth_warehouse_bustype
|
||||
inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
|
||||
where code = #{code}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteByCode">
|
||||
delete
|
||||
from auth_warehouse_bustype
|
||||
where code = #{code}
|
||||
</delete>
|
||||
|
||||
<select id="selectByActions" resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
|
||||
select * from auth_warehouse_bustype where code = #{subInvCode} and action in
|
||||
<foreach collection="actions" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,192 @@
|
||||
<?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.api.dao.thrsys.ThrDeptDao">
|
||||
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
SELECT *
|
||||
FROM thr_dept thrInv
|
||||
left join basic_third_sys thrSys on thrInv.thirdSysFk = thrSys.thirdId
|
||||
<where>
|
||||
thrSys.enabled = true
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="pid != '' and pid != null">
|
||||
AND pid = #{pid}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="advanceType != null">
|
||||
AND advanceType = #{advanceType}
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
AND isDefault = #{isDefault}
|
||||
</if>
|
||||
<if test="key != null">
|
||||
and (code like concat('%', #{key}, '%')
|
||||
or `name` like concat('%', #{key}, '%'))
|
||||
</if>
|
||||
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
|
||||
]]>
|
||||
</if>
|
||||
<if test="thirdSysFk != null">
|
||||
and thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Map"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
SELECT *
|
||||
FROM thr_dept
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="filterThrGroupInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
|
||||
resultType="com.glxp.api.res.thrsys.ThrDeptResponse">
|
||||
SELECT * FROM thr_dept
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="pid != '' and pid != null">
|
||||
AND pid = #{pid}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="advanceType != '' and advanceType != null">
|
||||
AND advanceType = #{advanceType}
|
||||
</if>
|
||||
<if test="isDefault != '' and isDefault != null">
|
||||
AND isDefault = #{isDefault}
|
||||
</if>
|
||||
<if test="thirdSysFk != null">
|
||||
AND thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<insert id="insertThrInvWarehouse" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
replace
|
||||
INTO thr_dept
|
||||
(pid, code, name, advanceType, isDefault,
|
||||
status, updateTime, remark, thirdSysFk)
|
||||
values (
|
||||
#{pid},
|
||||
#{code},
|
||||
#{name},
|
||||
#{advanceType},
|
||||
#{isDefault},
|
||||
#{status},
|
||||
#{updateTime},
|
||||
#{remark},
|
||||
#{thirdSysFk}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
|
||||
replace INTO thr_dept
|
||||
(pid, code, name, advanceType, isDefault,
|
||||
status, updateTime, remark, thirdSysFk)
|
||||
VALUES
|
||||
<foreach collection="thrDeptEntities" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.pid}, #{item.code},
|
||||
#{item.name}, #{item.advanceType}, #{item.isDefault},
|
||||
#{item.status}, #{item.updateTime},
|
||||
#{item.remark}, #{item.thirdSysFk})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM thr_dept
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
UPDATE thr_dept
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="pid != null">pid=#{pid},</if>
|
||||
<if test="name != null">name=#{name},</if>
|
||||
<if test="code != null">code=#{code},</if>
|
||||
<if test="advanceType != null">advanceType=#{advanceType},</if>
|
||||
<if test="isDefault != null">isDefault=#{isDefault},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectByCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
select *
|
||||
from thr_dept
|
||||
where code = #{code}
|
||||
</select>
|
||||
|
||||
<select id="selectMaxCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
|
||||
select max(code) as code from thr_dept
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="pid != '' and pid != null">
|
||||
AND pid = #{pid}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test=" advanceType != null">
|
||||
AND advanceType = #{advanceType}
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
AND isDefault = #{isDefault}
|
||||
</if>
|
||||
<if test="pcode != null">
|
||||
AND pcode = #{pcode}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND `level` = #{level}
|
||||
</if>
|
||||
<if test="thirdSysFk != null">
|
||||
AND `thirdSysFk` = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="insertInvWarehouses">
|
||||
replace into thr_dept (pid, code, `name`, advanceType, isDefault, status, updateTime, remark, `level`,
|
||||
pcode,
|
||||
thirdSysFk)
|
||||
values
|
||||
<foreach collection="thrDeptEntities" index="index" item="item" separator=",">
|
||||
(#{item.pid},
|
||||
#{item.code},
|
||||
#{item.name},
|
||||
#{item.advanceType},
|
||||
#{item.isDefault},
|
||||
#{item.status},
|
||||
#{item.updateTime},
|
||||
#{item.remark},
|
||||
#{item.level},
|
||||
#{item.pcode},
|
||||
#{item.thirdSysFk})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,111 @@
|
||||
<?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.api.dao.thrsys.ThrInvWarehouseDao">
|
||||
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
|
||||
SELECT *
|
||||
FROM thr_inv_warehouse
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND `name` = #{name}
|
||||
</if>
|
||||
<if test="parentId != '' and parentId != null">
|
||||
AND parentId = #{parentId}
|
||||
</if>
|
||||
<if test="thirdSysFk != null">
|
||||
and thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Map"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
|
||||
SELECT *
|
||||
FROM thr_inv_warehouse
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countSubInvByParentInvId" resultType="java.lang.Integer">
|
||||
select count(*) from thr_inv_warehouse where
|
||||
parentId = (select code from thr_dept where id = #{parentInvId})
|
||||
</select>
|
||||
|
||||
<select id="filterThrInvWarehouseResponse"
|
||||
resultType="com.glxp.api.res.thrsys.ThrInvWarehouseResponse">
|
||||
select t1.*, t2.name as parentName from thr_inv_warehouse t1
|
||||
left join thr_dept t2
|
||||
on t2.code =t1.parentId
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND t1.id = #{id}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND t1.code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND t1.`name` = #{name}
|
||||
</if>
|
||||
<if test="parentId != '' and parentId != null">
|
||||
AND t1.parentId = #{parentId}
|
||||
</if>
|
||||
<if test="thirdSysFk != null">
|
||||
and t1.thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertThrInvWarehouse" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
|
||||
replace
|
||||
INTO thr_inv_warehouse
|
||||
(id, code, `name`, parentId, remark, thirdSysFk)
|
||||
values (
|
||||
#{id},
|
||||
#{code},
|
||||
#{name},
|
||||
#{parentId},
|
||||
#{remark},
|
||||
#{thirdSysFk}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
|
||||
replace INTO thr_inv_warehouse
|
||||
(id, code, `name`, parentId, remark, thirdSysFk)
|
||||
VALUES
|
||||
<foreach collection="thrDeptEntities" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.id}, #{item.code},
|
||||
#{item.name}, #{item.parentId},
|
||||
#{item.remark}, #{item.thirdSysFk})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM thr_inv_warehouse
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
|
||||
UPDATE thr_inv_warehouse
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="name != null">`name`=#{name},</if>
|
||||
<if test="code != null">code=#{code},</if>
|
||||
<if test="parentId != null">parentId=#{parentId},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue