Compare commits
2 Commits
cf79cb6cab
...
234d780e92
| Author | SHA1 | Date |
|---|---|---|
|
|
234d780e92 | |
|
|
870c670197 |
|
|
@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
||||||
import com.njzscloud.dispose.wh.pojo.param.AddWarehouseParam;
|
import com.njzscloud.dispose.wh.pojo.param.AddWarehouseParam;
|
||||||
|
import com.njzscloud.dispose.wh.pojo.result.WarehouseResult;
|
||||||
import com.njzscloud.dispose.wh.service.WarehouseService;
|
import com.njzscloud.dispose.wh.service.WarehouseService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -55,7 +56,7 @@ public class WarehouseController {
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public R<WarehouseEntity> detail(@RequestParam("id") Long id) {
|
public R<WarehouseResult> detail(@RequestParam("id") Long id) {
|
||||||
return R.success(warehouseService.detail(id));
|
return R.success(warehouseService.detail(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +64,7 @@ public class WarehouseController {
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
@GetMapping("/paging")
|
@GetMapping("/paging")
|
||||||
public R<PageResult<WarehouseEntity>> paging(PageParam pageParam, WarehouseEntity warehouseEntity) {
|
public R<PageResult<WarehouseResult>> paging(PageParam pageParam, WarehouseEntity warehouseEntity) {
|
||||||
return R.success(warehouseService.paging(pageParam, warehouseEntity));
|
return R.success(warehouseService.paging(pageParam, warehouseEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package com.njzscloud.dispose.wh.mapper;
|
package com.njzscloud.dispose.wh.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
||||||
|
import com.njzscloud.dispose.wh.pojo.result.WarehouseResult;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库信息
|
* 仓库信息
|
||||||
|
|
@ -10,4 +15,14 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WarehouseMapper extends BaseMapper<WarehouseEntity> {
|
public interface WarehouseMapper extends BaseMapper<WarehouseEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
IPage<WarehouseResult> paging(Page<Object> page, @Param("ew") QueryWrapper<?> ew);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情查询
|
||||||
|
*/
|
||||||
|
WarehouseResult detail(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
package com.njzscloud.dispose.wh.pojo.entity;
|
package com.njzscloud.dispose.wh.pojo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.njzscloud.common.core.ienum.DictItem;
|
||||||
|
import com.njzscloud.common.core.ienum.DictKey;
|
||||||
|
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -29,11 +33,33 @@ public class WarehouseEntity {
|
||||||
*/
|
*/
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库类型;raw_material-原料库,finished_product-成品库
|
||||||
|
*/
|
||||||
|
@DictKey("warehouse_type")
|
||||||
|
@TableField(typeHandler = DictItemTypeHandler.class)
|
||||||
|
private DictItem type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属站点 Id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 位置
|
* 位置
|
||||||
*/
|
*/
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大容量,单位:m³
|
||||||
|
*/
|
||||||
|
private BigDecimal maxCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人 Id;sys_user.id
|
* 创建人 Id;sys_user.id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,18 @@
|
||||||
package com.njzscloud.dispose.wh.pojo.param;
|
package com.njzscloud.dispose.wh.pojo.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.njzscloud.common.core.ienum.DictItem;
|
||||||
|
import com.njzscloud.common.core.ienum.DictKey;
|
||||||
|
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库信息
|
* 仓库信息-新增参数
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
|
@ -20,9 +26,31 @@ public class AddWarehouseParam {
|
||||||
*/
|
*/
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库类型;raw_material-原料库,finished_product-成品库
|
||||||
|
*/
|
||||||
|
@DictKey("warehouse_type")
|
||||||
|
@TableField(typeHandler = DictItemTypeHandler.class)
|
||||||
|
private DictItem type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属站点 Id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 位置
|
* 位置
|
||||||
*/
|
*/
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大容量,单位:m³
|
||||||
|
*/
|
||||||
|
private BigDecimal maxCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.njzscloud.dispose.wh.pojo.result;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.njzscloud.common.core.ienum.DictItem;
|
||||||
|
import com.njzscloud.common.core.ienum.DictKey;
|
||||||
|
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库信息-结果类
|
||||||
|
* @author ljw
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class WarehouseResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库名称
|
||||||
|
*/
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库类型;raw_material-原料库,finished_product-成品库
|
||||||
|
*/
|
||||||
|
@DictKey("warehouse_type")
|
||||||
|
@TableField(typeHandler = DictItemTypeHandler.class)
|
||||||
|
private DictItem type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属站点 Id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大容量,单位:m³
|
||||||
|
*/
|
||||||
|
private BigDecimal maxCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id;sys_user.id
|
||||||
|
*/
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id;sys_user.id
|
||||||
|
*/
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除;0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,13 +2,17 @@ package com.njzscloud.dispose.wh.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ienum.DictItem;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.wh.mapper.WarehouseMapper;
|
import com.njzscloud.dispose.wh.mapper.WarehouseMapper;
|
||||||
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
import com.njzscloud.dispose.wh.pojo.entity.WarehouseEntity;
|
||||||
import com.njzscloud.dispose.wh.pojo.param.AddWarehouseParam;
|
import com.njzscloud.dispose.wh.pojo.param.AddWarehouseParam;
|
||||||
|
import com.njzscloud.dispose.wh.pojo.result.WarehouseResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -53,18 +57,25 @@ public class WarehouseService extends ServiceImpl<WarehouseMapper, WarehouseEnti
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
public WarehouseEntity detail(Long id) {
|
public WarehouseResult detail(Long id) {
|
||||||
return this.getById(id);
|
return baseMapper.detail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
public PageResult<WarehouseEntity> paging(PageParam pageParam, WarehouseEntity warehouseEntity) {
|
public PageResult<WarehouseResult> paging(PageParam pageParam, WarehouseEntity warehouseEntity) {
|
||||||
String warehouseName = warehouseEntity.getWarehouseName();
|
String warehouseName = warehouseEntity.getWarehouseName();
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(warehouseEntity)
|
Long stationId = warehouseEntity.getStationId();
|
||||||
.eq("deleted", Boolean.FALSE)
|
DictItem type = warehouseEntity.getType();
|
||||||
.like(StrUtil.isNotBlank(warehouseName), "warehouse_name", warehouseName)));
|
QueryWrapper<?> ew = Wrappers.query()
|
||||||
|
.eq("ww.deleted", 0)
|
||||||
|
.like(StrUtil.isNotBlank(warehouseName), "ww.warehouse_name", warehouseName)
|
||||||
|
.eq(stationId != null, "ww.station_id", stationId)
|
||||||
|
.eq(type != null, "ww.type", type);
|
||||||
|
|
||||||
|
IPage<WarehouseResult> page = baseMapper.paging(pageParam.toPage(), ew);
|
||||||
|
return PageResult.of(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?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.njzscloud.dispose.wh.mapper.WarehouseMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.njzscloud.dispose.wh.pojo.result.WarehouseResult">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="warehouse_name" property="warehouseName"/>
|
||||||
|
<result column="type" property="type" typeHandler="com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler"/>
|
||||||
|
<result column="station_id" property="stationId"/>
|
||||||
|
<result column="station_name" property="stationName"/>
|
||||||
|
<result column="location" property="location"/>
|
||||||
|
<result column="max_capacity" property="maxCapacity"/>
|
||||||
|
<result column="remark" property="remark"/>
|
||||||
|
<result column="creator_id" property="creatorId"/>
|
||||||
|
<result column="modifier_id" property="modifierId"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="modify_time" property="modifyTime"/>
|
||||||
|
<result column="deleted" property="deleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
SELECT ww.id AS id,
|
||||||
|
ww.warehouse_name AS warehouse_name,
|
||||||
|
ww.type AS type,
|
||||||
|
ww.station_id AS station_id,
|
||||||
|
cs.station_name AS station_name,
|
||||||
|
ww.location AS location,
|
||||||
|
ww.max_capacity AS max_capacity,
|
||||||
|
ww.remark AS remark,
|
||||||
|
ww.creator_id AS creator_id,
|
||||||
|
ww.modifier_id AS modifier_id,
|
||||||
|
ww.create_time AS create_time,
|
||||||
|
ww.modify_time AS modify_time,
|
||||||
|
ww.deleted AS deleted
|
||||||
|
FROM wh_warehouse ww
|
||||||
|
LEFT JOIN cst_station cs ON cs.id = ww.station_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="detail" resultMap="BaseResultMap">
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
WHERE ww.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="paging" resultMap="BaseResultMap">
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue