仓库与货位相关代码

master
anthonywj 2 years ago
parent 4e450e9cea
commit 839b9bebff

@ -0,0 +1,105 @@
package com.glxp.api.controller.auth;
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.auth.InvSpace;
import com.glxp.api.req.auth.FilterInvSpaceRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.auth.InvSpaceResponse;
import com.glxp.api.service.auth.InvSpaceService;
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 java.util.List;
/**
*
*/
@Slf4j
@RestController
public class InvSpaceController {
@Resource
private InvSpaceService invSpaceService;
@GetMapping("/spms/inv/space/filter")
public BaseResponse filterList(FilterInvSpaceRequest filterInvSpaceRequest) {
List<InvSpaceResponse> list = invSpaceService.filterList(filterInvSpaceRequest);
PageInfo<InvSpaceResponse> pageInfo = new PageInfo<>(list);
PageSimpleResponse<InvSpaceResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setList(list);
pageSimpleResponse.setTotal(pageInfo.getTotal());
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param invSpace
* @return
*/
@PostMapping("/spms/inv/space/add")
public BaseResponse addSpace(@RequestBody InvSpace invSpace, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (null == invSpace) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invSpaceService.addSpace(invSpace);
}
/**
*
*
* @param deleteRequest
* @return
*/
@PostMapping("/spms/inv/space/delete")
public BaseResponse deleteSpace(@RequestBody DeleteRequest deleteRequest) {
if (null == deleteRequest || StrUtil.isBlank(deleteRequest.getId())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空");
}
return invSpaceService.deleteSpace(deleteRequest.getId());
}
/**
*
*
* @param invSpace
* @param bindingResult
* @return
*/
@PostMapping("/spms/inv/space/update")
public BaseResponse updateSpace(@RequestBody InvSpace invSpace, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (null == invSpace) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空");
}
return invSpaceService.updateSpace(invSpace);
}
/**
*
*
* @param filterInvSpaceRequest
* @return
*/
@GetMapping("/spms/inv/space/getSpaceCodeList")
public BaseResponse getSpaceCodeList(FilterInvSpaceRequest filterInvSpaceRequest) {
List<InvSpaceResponse> list = invSpaceService.getSpaceCodeList(filterInvSpaceRequest);
return ResultVOUtils.success(list);
}
}

@ -0,0 +1,89 @@
package com.glxp.api.dao.auth;
import com.glxp.api.entity.auth.InvSpace;
import com.glxp.api.req.auth.FilterInvSpaceRequest;
import com.glxp.api.res.auth.InvSpaceResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface InvSpaceDao {
int deleteByPrimaryKey(Integer id);
int insert(InvSpace record);
int insertSelective(InvSpace record);
InvSpace selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(InvSpace record);
int updateByPrimaryKey(InvSpace record);
int updateBatch(List<InvSpace> list);
int batchInsert(@Param("list") List<InvSpace> list);
/**
*
*
* @param filterInvSpaceRequest
* @return
*/
List<InvSpaceResponse> filterList(FilterInvSpaceRequest filterInvSpaceRequest);
/**
*
*
* @param invSpace
* @return
*/
List<InvSpace> selectList(InvSpace invSpace);
/**
*
*
* @param filterInvSpaceRequest
* @return
*/
List<InvSpaceResponse> selectSpaceCodeList(FilterInvSpaceRequest filterInvSpaceRequest);
/**
*
*
* @param code
* @param invStorageCode
* @param invWarehouseCode
* @return
*/
String selectNameByCode(@Param("invStorageCode") String invStorageCode, @Param("invWarehouseCode") String invWarehouseCode, @Param("code") String code);
/**
*
*
* @param warehouseCode
* @return
*/
List<InvSpace> selectByWarehouseCode(String warehouseCode);
/**
*
*
* @param invSpace
* @return
*/
List<InvSpace> selectExist(InvSpace invSpace);
/**
*
*
* @param invStorageCode
* @param invWarehouseCode
* @param inSpaceCode
* @return
*/
List<InvSpace> selectByInvCode(@Param("invStorageCode") String invStorageCode, @Param("invWarehouseCode") String invWarehouseCode, @Param("invSpaceCode") String invSpaceCode);
}

@ -0,0 +1,69 @@
package com.glxp.api.entity.auth;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
public class InvSpace {
private Integer id;
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String type;
/**
*
*/
private String invStorageCode;
/**
*
*/
private String invWarehouseCode;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private String createUser;
/**
*
*/
private String updateUser;
/**
*
*/
private String remark;
}

@ -0,0 +1,52 @@
package com.glxp.api.req.auth;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
/**
*
*/
@Data
public class FilterInvSpaceRequest extends ListPageRequest {
/**
* ID
*/
private String customerId;
/**
*
*/
private String invWarehouseCode;
/**
*
*/
private String invStorageCode;
/**
*
*/
private String key;
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private Boolean status;
/**
*
*/
private String remark;
}

@ -0,0 +1,19 @@
package com.glxp.api.res.auth;
import com.glxp.api.entity.auth.InvSpace;
import lombok.Data;
@Data
public class InvSpaceResponse extends InvSpace {
/**
*
*/
private String invStorageName;
/**
*
*/
private String invSubStorageName;
}

@ -0,0 +1,53 @@
package com.glxp.api.service.auth;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.auth.InvSpace;
import com.glxp.api.req.auth.FilterInvSpaceRequest;
import com.glxp.api.res.auth.InvSpaceResponse;
import java.util.List;
public interface InvSpaceService {
/**
*
*
* @param filterInvSpaceRequest
* @return
*/
List<InvSpaceResponse> filterList(FilterInvSpaceRequest filterInvSpaceRequest);
/**
*
*
* @param invSpace
* @return
*/
BaseResponse addSpace(InvSpace invSpace);
/**
*
*
* @param id
* @return
*/
BaseResponse deleteSpace(String id);
/**
*
*
* @param invSpace
* @return
*/
BaseResponse updateSpace(InvSpace invSpace);
List<InvSpaceResponse> getSpaceCodeList(FilterInvSpaceRequest filterInvSpaceRequest);
/**
*
*
* @param code
* @return
*/
List<InvSpace> findBySubWarehouseCode(String code);
}

@ -0,0 +1,169 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
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.dao.auth.InvSpaceDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.InvSpace;
import com.glxp.api.req.auth.FilterInvSpaceRequest;
import com.glxp.api.res.auth.InvSpaceResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.auth.InvSpaceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InvSpaceServiceImpl implements InvSpaceService {
@Resource
private InvSpaceDao invSpaceDao;
@Resource
private CustomerService customerService;
@Override
public List<InvSpaceResponse> filterList(FilterInvSpaceRequest filterInvSpaceRequest) {
if (null == filterInvSpaceRequest) {
return Collections.emptyList();
}
if (null != filterInvSpaceRequest.getPage() && null != filterInvSpaceRequest.getLimit()) {
PageHelper.offsetPage((filterInvSpaceRequest.getPage() - 1) * filterInvSpaceRequest.getLimit(), filterInvSpaceRequest.getLimit());
}
return invSpaceDao.filterList(filterInvSpaceRequest);
}
@Override
public BaseResponse addSpace(InvSpace invSpace) {
BaseResponse verifyResult = verifySpaceParams(invSpace);
if (verifyResult.getCode() != 20000) {
return verifyResult;
}
String result = verifyExist(invSpace);
if (!"success".equals(result)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, result);
}
Date date = new Date();
AuthAdmin user = customerService.getUserBean();
invSpace.setCreateTime(date);
invSpace.setUpdateTime(date);
invSpace.setCreateUser(user.getUserName());
invSpace.setUpdateUser(user.getUserName());
invSpaceDao.insert(invSpace);
return ResultVOUtils.success();
}
/**
*
*
* @param invSpace
* @return
*/
private static BaseResponse verifySpaceParams(InvSpace invSpace) {
//校验参数
if (StrUtil.isBlank(invSpace.getCode()) || StrUtil.isBlank(invSpace.getName())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "货位名称和货位号不能为空!");
}
if (StrUtil.isBlank(invSpace.getInvStorageCode()) || StrUtil.isBlank(invSpace.getInvWarehouseCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请指定所属仓库和分库!");
}
return ResultVOUtils.success();
}
@Override
public BaseResponse deleteSpace(String id) {
//校验此货位是否已经被使用,如果已经被使用,不能删除
Integer spaceId = Integer.valueOf(id);
InvSpace invSpace = invSpaceDao.selectByPrimaryKey(spaceId);
//todo 代码迁移,后面记得修改
// //判断此货位是否与库存绑定,如果与库存绑定,则无法删除
// Long detailCount = invProductDetailDao.countBySpaceCode(invSpace.getInvStorageCode(), invSpace.getInvWarehouseCode(), invSpace.getCode());
// if (detailCount > 0) {
// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "此货位已被使用,无法删除!");
// }
//
// //判断此货位是否已经被盘点单使用,如果有,则无法删除
// Integer count = invCountOrderDao.countBySpaceCode(invSpace.getInvStorageCode(), invSpace.getInvWarehouseCode(), invSpace.getCode());
// if (count > 0) {
// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "此货位已被使用,无法删除!");
// }
invSpaceDao.deleteByPrimaryKey(spaceId);
return ResultVOUtils.success();
}
@Override
public BaseResponse updateSpace(InvSpace invSpace) {
BaseResponse verifySpaceParamsResult = verifySpaceParams(invSpace);
if (!verifySpaceParamsResult.getCode().equals(20000)) {
return verifySpaceParamsResult;
}
String result = verifyExist(invSpace);
if (!"success".equals(result)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, result);
}
AuthAdmin user = customerService.getUserBean();
invSpace.setUpdateTime(new Date());
invSpace.setUpdateUser(user.getUserName());
invSpaceDao.updateByPrimaryKey(invSpace);
return ResultVOUtils.success();
}
@Override
public List<InvSpaceResponse> getSpaceCodeList(FilterInvSpaceRequest filterInvSpaceRequest) {
return invSpaceDao.selectSpaceCodeList(filterInvSpaceRequest);
}
@Override
public List<InvSpace> findBySubWarehouseCode(String code) {
return invSpaceDao.selectByWarehouseCode(code);
}
/**
*
*
* @param invSpace
* @return
*/
public String verifyExist(InvSpace invSpace) {
//先检查货位号是否重复
List<InvSpace> invSpaces = invSpaceDao.selectByInvCode(invSpace.getInvStorageCode(), invSpace.getInvWarehouseCode(), invSpace.getCode());
if (CollUtil.isNotEmpty(invSpaces)) {
//判断ID是否为空如果为空表示数据为新增货位是重复添加-
if (null == invSpace.getId()) {
return "货位信息已存在";
}
//此分库下货位号重复判断ID是否与当前货位相同
for (InvSpace space : invSpaces) {
if (!space.getId().equals(invSpace.getId())) {
return "货位信息已存在";
}
}
}
List<InvSpace> list = invSpaceDao.selectExist(invSpace);
if (CollUtil.isNotEmpty(list)) {
if (null == invSpace.getId()) {
return "货位信息已存在";
}
for (InvSpace space : list) {
if (!space.getId().equals(invSpace.getId())) {
return "货位信息已存在";
}
}
}
return "success";
}
}

@ -0,0 +1,385 @@
<?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.InvSpaceDao">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.InvSpace">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="invStorageCode" jdbcType="VARCHAR" property="invStorageCode"/>
<result column="invWarehouseCode" jdbcType="VARCHAR" property="invWarehouseCode"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="createUser" jdbcType="VARCHAR" property="createUser"/>
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
id,
code,
`name`,
type,
invStorageCode,
invWarehouseCode,
`status`,
createTime,
updateTime,
`createUser`,
updateUser,
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_space
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from inv_space
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace"
useGeneratedKeys="true">
insert into inv_space (code, `name`, type, invStorageCode,
invWarehouseCode, `status`, createTime,
updateTime, `createUser`, updateUser,
remark)
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{invStorageCode,jdbcType=VARCHAR},
#{invWarehouseCode,jdbcType=VARCHAR}, #{status,jdbcType=BOOLEAN}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.InvSpace" useGeneratedKeys="true">
insert into inv_space
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">
code,
</if>
<if test="name != null">
`name`,
</if>
<if test="type != null">
type,
</if>
<if test="invStorageCode != null">
invStorageCode,
</if>
<if test="invWarehouseCode != null">
invWarehouseCode,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
createTime,
</if>
<if test="updateTime != null">
updateTime,
</if>
<if test="createUser != null">
`createUser`,
</if>
<if test="updateUser != null">
updateUser,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="invStorageCode != null">
#{invStorageCode,jdbcType=VARCHAR},
</if>
<if test="invWarehouseCode != null">
#{invWarehouseCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=BOOLEAN},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.InvSpace">
update inv_space
<set>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="invStorageCode != null">
invStorageCode = #{invStorageCode,jdbcType=VARCHAR},
</if>
<if test="invWarehouseCode != null">
invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=BOOLEAN},
</if>
<if test="createTime != null">
createTime = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
updateTime = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null">
`createUser` = #{createUser,jdbcType=VARCHAR},
</if>
<if test="updateUser != null">
updateUser = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.InvSpace">
update inv_space
set code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
invStorageCode = #{invStorageCode,jdbcType=VARCHAR},
invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=BOOLEAN},
createTime = #{createTime,jdbcType=TIMESTAMP},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
`createUser` = #{createUser,jdbcType=VARCHAR},
updateUser = #{updateUser,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
update inv_space
<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="`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 prefix="type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="invStorageCode = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.invStorageCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="invWarehouseCode = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.invWarehouseCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=BOOLEAN}
</foreach>
</trim>
<trim prefix="createTime = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="updateTime = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="`createUser` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createUser,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="updateUser = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateUser,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</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">
insert into inv_space
(code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime,
`createUser`, updateUser, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.code,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
#{item.invStorageCode,jdbcType=VARCHAR},
#{item.invWarehouseCode,jdbcType=VARCHAR}, #{item.status,jdbcType=BOOLEAN},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.createUser,jdbcType=VARCHAR},
#{item.updateUser,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR})
</foreach>
</insert>
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvSpaceRequest" resultType="com.glxp.api.res.auth.InvSpaceResponse">
select s.*,
w.name invStorageName,
iws.name invSubStorageName
from inv_space s
left join inv_warehouse w on s.invStorageCode = w.code
left join inv_warehouse_sub iws on s.invWarehouseCode = iws.code
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND s.invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND s.invWarehouseCode = #{invWarehouseCode}
</if>
<if test="key != null and key != ''">
AND (s.code like concat('%', #{key}, '%') or s.name like concat('%', #{key}, '%') or
s.type like concat('%', #{key}, '%'))
</if>
<if test="status != null">
AND s.status = #{status}
</if>
</where>
</select>
<select id="selectList" resultMap="BaseResultMap">
select *
from inv_space
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
</where>
</select>
<select id="selectSpaceCodeList" resultType="com.glxp.api.res.auth.InvSpaceResponse">
select inv_space.code, inv_space.name, iws.name invSubStorageName, iw.name invStorageName
from inv_space
left join inv_warehouse_sub iws on iws.code = inv_space.invWarehouseCode
left join inv_warehouse iw on iw.code = inv_space.invStorageCode
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND inv_space.invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND inv_space.invWarehouseCode = #{invWarehouseCode}
</if>
<if test="status != null">
AND inv_space.status = #{status}
</if>
</where>
</select>
<select id="selectNameByCode" resultType="java.lang.String">
select name
from inv_space
where invStorageCode = #{invStorageCode}
and invWarehouseCode = #{invWarehouseCode}
and code = #{code}
</select>
<select id="selectByWarehouseCode" resultMap="BaseResultMap">
select *
from inv_space
where invWarehouseCode = #{warehouseCode}
</select>
<select id="selectExist" resultMap="BaseResultMap">
select *
from inv_space
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
</where>
</select>
<select id="selectByInvCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_space
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND code = #{invSpaceCode}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save