第三方仓库新增分库,关联绑定第三方分库等
parent
81e3e66953
commit
74d295e705
@ -0,0 +1,103 @@
|
||||
package com.glxp.api.admin.controller.thrsys;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity;
|
||||
import com.glxp.api.admin.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.api.admin.req.inventory.FilterInvSubWarehouseRequest;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.admin.res.PageSimpleResponse;
|
||||
import com.glxp.api.admin.service.thrsys.ThrSubInvWarehouseService;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
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.List;
|
||||
|
||||
@RestController
|
||||
public class ThrSubInvWarehouseController {
|
||||
|
||||
@Resource
|
||||
ThrSubInvWarehouseService thrSubInvWarehouseService;
|
||||
|
||||
@GetMapping("/thirdSys/sub/inv/warehouse/filter")
|
||||
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
List<ThrSubInvWarehouseEntity> thrInvWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
PageInfo<ThrSubInvWarehouseEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
|
||||
PageSimpleResponse<ThrSubInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(thrInvWarehouseEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/thirdSys/sub/inv/warehouse/filterAll")
|
||||
public BaseResponse filterAllInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
|
||||
List<ThrSubInvWarehouseEntity> invSubWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
return ResultVOUtils.success(invSubWarehouseEntities);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/thirdSys/sub/inv/warehouse/save")
|
||||
public BaseResponse save(@RequestBody @Valid ThrSubInvWarehouseEntity 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 = thrSubInvWarehouseService.insertThrInvWarehouse(invSubWarehouseEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/thirdSys/sub/inv/warehouse/edit")
|
||||
public BaseResponse edit(@RequestBody @Valid ThrSubInvWarehouseEntity 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 = thrSubInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
boolean b = thrSubInvWarehouseService.deleteById(deleteRequest.getId());
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
return ResultVOUtils.success("刪除成功!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.glxp.api.admin.dao.thrsys;
|
||||
|
||||
import com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrSubInvWarehouseDao {
|
||||
|
||||
|
||||
List<ThrSubInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
|
||||
|
||||
boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);
|
||||
|
||||
boolean insertInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys);
|
||||
|
||||
boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.admin.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ThrSubInvWarehouseEntity {
|
||||
|
||||
|
||||
private String id;
|
||||
private String code;
|
||||
private String name;
|
||||
private String parentId;
|
||||
private String remark;
|
||||
private String thirdSysFk;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.glxp.api.admin.req.thrsys;
|
||||
|
||||
import com.glxp.api.admin.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.admin.service.thrsys;
|
||||
|
||||
|
||||
import com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrSubInvWarehouseService {
|
||||
|
||||
List<ThrSubInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
|
||||
|
||||
boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrSubInvWarehouseEntity);
|
||||
|
||||
boolean insertInvWarehouses(List<ThrSubInvWarehouseEntity> thrSubInvWarehouseEntities);
|
||||
|
||||
boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrSubInvWarehouseEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.glxp.api.admin.service.thrsys.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.admin.dao.thrsys.ThrSubInvWarehouseDao;
|
||||
import com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity;
|
||||
import com.glxp.api.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
|
||||
import com.glxp.api.admin.service.thrsys.ThrSubInvWarehouseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThrSubInvWarehouseServiceImpl implements ThrSubInvWarehouseService {
|
||||
|
||||
@Resource
|
||||
ThrSubInvWarehouseDao thrSubInvWarehouseDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ThrSubInvWarehouseEntity> 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 thrSubInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity) {
|
||||
return thrSubInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvWarehouses(List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys) {
|
||||
return thrSubInvWarehouseDao.insertInvWarehouses(thrInvWarehouseEntitys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity) {
|
||||
return thrSubInvWarehouseDao.updateThrInvWarehouse(thrInvWarehouseEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return thrSubInvWarehouseDao.deleteById(id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?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.admin.dao.thrsys.ThrSubInvWarehouseDao">
|
||||
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest"
|
||||
resultType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
|
||||
SELECT *
|
||||
FROM thr_inv_warehouse_sub
|
||||
<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.admin.entity.thrsys.ThrSubInvWarehouseEntity">
|
||||
SELECT *
|
||||
FROM thr_inv_warehouse_sub
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertThrInvWarehouse" keyProperty="id"
|
||||
parameterType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
|
||||
replace
|
||||
INTO thr_inv_warehouse_sub
|
||||
(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_sub
|
||||
(id, code, `name`, parentId, remark, thirdSysFk)
|
||||
VALUES
|
||||
<foreach collection="thrInvWarehouseEntitys" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{id}, #{item.code},
|
||||
#{item.name}, #{parentId}
|
||||
#{item.remark}, #{item.thirdSysFk})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM thr_inv_warehouse_sub
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
|
||||
UPDATE thr_inv_warehouse_sub
|
||||
<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