Compare commits
No commits in common. "633467ab9e91025cc4198a369e3a9524457398a8" and "4241f9a133834f3b1ca014388326c63addc013ba" have entirely different histories.
633467ab9e
...
4241f9a133
|
|
@ -1,67 +0,0 @@
|
||||||
package com.njzscloud.dispose.wh.controller;
|
|
||||||
|
|
||||||
import com.njzscloud.common.core.utils.R;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.dispose.wh.pojo.entity.PurchaseRecordEntity;
|
|
||||||
import com.njzscloud.dispose.wh.pojo.result.PurchaseRecordResult;
|
|
||||||
import com.njzscloud.dispose.wh.service.PurchaseRecordService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购记录
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/purchase_record")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class PurchaseRecordController {
|
|
||||||
private final PurchaseRecordService purchaseRecordService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
@PostMapping("/add")
|
|
||||||
public R<?> add(@RequestBody PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
purchaseRecordService.add(purchaseRecordEntity);
|
|
||||||
return R.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@PostMapping("/modify")
|
|
||||||
public R<?> modify(@RequestBody PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
purchaseRecordService.modify(purchaseRecordEntity);
|
|
||||||
return R.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@PostMapping("/del")
|
|
||||||
public R<?> del(@RequestBody List<Long> ids) {
|
|
||||||
purchaseRecordService.del(ids);
|
|
||||||
return R.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
@GetMapping("/detail")
|
|
||||||
public R<PurchaseRecordResult> detail(@RequestParam("id") Long id) {
|
|
||||||
return R.success(purchaseRecordService.detail(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
@GetMapping("/paging")
|
|
||||||
public R<PageResult<PurchaseRecordResult>> paging(PageParam pageParam, PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
return R.success(purchaseRecordService.paging(pageParam, purchaseRecordEntity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.njzscloud.dispose.wh.mapper;
|
|
||||||
|
|
||||||
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.PurchaseRecordEntity;
|
|
||||||
import com.njzscloud.dispose.wh.pojo.result.PurchaseRecordResult;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购记录
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface PurchaseRecordMapper extends BaseMapper<PurchaseRecordEntity> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情查询
|
|
||||||
*/
|
|
||||||
PurchaseRecordResult detail(@Param("id") Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
IPage<PurchaseRecordResult> paging(Page<PurchaseRecordResult> page, @Param("ew") com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<?> queryWrapper);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
||||||
package com.njzscloud.dispose.wh.pojo.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购记录
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("wh_purchase_record")
|
|
||||||
public class PurchaseRecordEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购单号
|
|
||||||
*/
|
|
||||||
private String sn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 经办人Id
|
|
||||||
*/
|
|
||||||
private Long handlerId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 供应商名称
|
|
||||||
*/
|
|
||||||
private String supplierName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 规格
|
|
||||||
*/
|
|
||||||
private String spec;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private Long quantity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单价
|
|
||||||
*/
|
|
||||||
private BigDecimal unitPrice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总金额
|
|
||||||
*/
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购日期
|
|
||||||
*/
|
|
||||||
private LocalDateTime purchaseDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人 Id;sys_user.id
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Long creatorId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改人 Id;sys_user.id
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Long modifierId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private LocalDateTime modifyTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除; 0-->未删除、1-->已删除
|
|
||||||
*/
|
|
||||||
@TableLogic
|
|
||||||
private Boolean deleted;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
package com.njzscloud.dispose.wh.pojo.result;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购记录-结果类
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class PurchaseRecordResult {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购单号
|
|
||||||
*/
|
|
||||||
private String sn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 经办人Id
|
|
||||||
*/
|
|
||||||
private Long handlerId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 经办人名称
|
|
||||||
*/
|
|
||||||
private String handlerName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 供应商名称
|
|
||||||
*/
|
|
||||||
private String supplierName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 规格
|
|
||||||
*/
|
|
||||||
private String spec;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private Long quantity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单价
|
|
||||||
*/
|
|
||||||
private BigDecimal unitPrice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总金额
|
|
||||||
*/
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购日期
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime purchaseDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人 Id;sys_user.id
|
|
||||||
*/
|
|
||||||
private Long creatorId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改人 Id;sys_user.id
|
|
||||||
*/
|
|
||||||
private Long modifierId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime modifyTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除;0-->未删除、1-->已删除
|
|
||||||
*/
|
|
||||||
private Boolean deleted;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
package com.njzscloud.dispose.wh.service;
|
|
||||||
|
|
||||||
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.extension.service.IService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.common.sn.support.SnUtil;
|
|
||||||
import com.njzscloud.dispose.wh.mapper.PurchaseRecordMapper;
|
|
||||||
import com.njzscloud.dispose.wh.pojo.entity.PurchaseRecordEntity;
|
|
||||||
import com.njzscloud.dispose.wh.pojo.result.PurchaseRecordResult;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购记录
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class PurchaseRecordService extends ServiceImpl<PurchaseRecordMapper, PurchaseRecordEntity> implements IService<PurchaseRecordEntity> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
public void add(PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
purchaseRecordEntity.setSn(this.generateSn());
|
|
||||||
this.save(purchaseRecordEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
public void modify(PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
this.updateById(purchaseRecordEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void del(List<Long> ids) {
|
|
||||||
this.removeBatchByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
public PurchaseRecordResult detail(Long id) {
|
|
||||||
return baseMapper.detail(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
public PageResult<PurchaseRecordResult> paging(PageParam pageParam, PurchaseRecordEntity purchaseRecordEntity) {
|
|
||||||
String sn = purchaseRecordEntity.getSn();
|
|
||||||
String supplierName = purchaseRecordEntity.getSupplierName();
|
|
||||||
String productName = purchaseRecordEntity.getProductName();
|
|
||||||
Long handlerId = purchaseRecordEntity.getHandlerId();
|
|
||||||
|
|
||||||
QueryWrapper<?> ew = Wrappers.query()
|
|
||||||
.eq("wpr.deleted", Boolean.FALSE)
|
|
||||||
.like(StrUtil.isNotBlank(sn), "wpr.sn", sn)
|
|
||||||
.like(StrUtil.isNotBlank(supplierName), "wpr.supplier_name", supplierName)
|
|
||||||
.like(StrUtil.isNotBlank(productName), "wpr.product_name", productName)
|
|
||||||
.eq(handlerId != null, "wpr.handler_id", handlerId);
|
|
||||||
|
|
||||||
IPage<PurchaseRecordResult> page = baseMapper.paging(pageParam.toPage(), ew);
|
|
||||||
return PageResult.of(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String generateSn() {
|
|
||||||
String sn = SnUtil.next("PR-SN");
|
|
||||||
if (this.exists(Wrappers.<PurchaseRecordEntity>lambdaQuery().eq(PurchaseRecordEntity::getSn, sn)
|
|
||||||
.eq(PurchaseRecordEntity::getDeleted, Boolean.FALSE))) {
|
|
||||||
this.generateSn();
|
|
||||||
}
|
|
||||||
return sn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class WarehouseService extends ServiceImpl<WarehouseMapper, WarehouseEnti
|
||||||
Long stationId = warehouseEntity.getStationId();
|
Long stationId = warehouseEntity.getStationId();
|
||||||
String type = warehouseEntity.getType();
|
String type = warehouseEntity.getType();
|
||||||
QueryWrapper<?> ew = Wrappers.query()
|
QueryWrapper<?> ew = Wrappers.query()
|
||||||
.eq("ww.deleted", Boolean.FALSE)
|
.eq("ww.deleted", 0)
|
||||||
.like(StrUtil.isNotBlank(warehouseName), "ww.warehouse_name", warehouseName)
|
.like(StrUtil.isNotBlank(warehouseName), "ww.warehouse_name", warehouseName)
|
||||||
.eq(stationId != null, "ww.station_id", stationId)
|
.eq(stationId != null, "ww.station_id", stationId)
|
||||||
.eq(StrUtil.isNotBlank(type), "ww.type", type);
|
.eq(StrUtil.isNotBlank(type), "ww.type", type);
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
<?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.PurchaseRecordMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.njzscloud.dispose.wh.pojo.result.PurchaseRecordResult">
|
|
||||||
<id column="id" property="id"/>
|
|
||||||
<result column="sn" property="sn"/>
|
|
||||||
<result column="handler_id" property="handlerId"/>
|
|
||||||
<result column="handler_name" property="handlerName"/>
|
|
||||||
<result column="supplier_name" property="supplierName"/>
|
|
||||||
<result column="product_name" property="productName"/>
|
|
||||||
<result column="spec" property="spec"/>
|
|
||||||
<result column="quantity" property="quantity"/>
|
|
||||||
<result column="unit" property="unit"/>
|
|
||||||
<result column="unit_price" property="unitPrice"/>
|
|
||||||
<result column="total_amount" property="totalAmount"/>
|
|
||||||
<result column="purchase_date" property="purchaseDate"/>
|
|
||||||
<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 wpr.id AS id,
|
|
||||||
wpr.sn AS sn,
|
|
||||||
wpr.handler_id AS handler_id,
|
|
||||||
su.nickname AS handler_name,
|
|
||||||
wpr.supplier_name AS supplier_name,
|
|
||||||
wpr.product_name AS product_name,
|
|
||||||
wpr.spec AS spec,
|
|
||||||
wpr.quantity AS quantity,
|
|
||||||
wpr.unit AS unit,
|
|
||||||
wpr.unit_price AS unit_price,
|
|
||||||
wpr.total_amount AS total_amount,
|
|
||||||
wpr.purchase_date AS purchase_date,
|
|
||||||
wpr.remark AS remark,
|
|
||||||
wpr.creator_id AS creator_id,
|
|
||||||
wpr.modifier_id AS modifier_id,
|
|
||||||
wpr.create_time AS create_time,
|
|
||||||
wpr.modify_time AS modify_time,
|
|
||||||
wpr.deleted AS deleted
|
|
||||||
FROM wh_purchase_record wpr
|
|
||||||
LEFT JOIN sys_user su ON su.id = wpr.handler_id AND su.deleted = 0
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="detail" resultMap="BaseResultMap">
|
|
||||||
<include refid="Base_Column_List"/>
|
|
||||||
WHERE wpr.id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="paging" resultMap="BaseResultMap">
|
|
||||||
<include refid="Base_Column_List"/>
|
|
||||||
<if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
|
||||||
${ew.customSqlSegment}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Loading…
Reference in New Issue