9 changed files with 439 additions and 1 deletions
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.web.controller.system; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.system.domain.PurchaseOrder; |
||||
import com.ruoyi.system.service.IPurchaseOrderService; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
||||
@RestController |
||||
@RequestMapping("/system/purchase") |
||||
public class PurchaseOrderController extends BaseController { |
||||
@Autowired |
||||
private IPurchaseOrderService purchaseOrderService; |
||||
|
||||
// @PreAuthorize("@ss.hasPermi('dhc:area:list')")
|
||||
@GetMapping("/list") |
||||
public TableDataInfo list(PurchaseOrder purchaseOrder) { |
||||
startPage(); |
||||
List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); |
||||
logger.info("查询采购订单列表结果===:{}", list.toString()); |
||||
|
||||
TableDataInfo tableDataInfo = getDataTable(list); |
||||
logger.info("getDataTable返回结果===:{}", tableDataInfo.toString()); |
||||
|
||||
return tableDataInfo; |
||||
} |
||||
|
||||
@Log(title = "采购订单", businessType = BusinessType.EXPORT) |
||||
@GetMapping("/export") |
||||
public AjaxResult export(PurchaseOrder purchaseOrder) { |
||||
List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); |
||||
ExcelUtil<PurchaseOrder> util = new ExcelUtil<PurchaseOrder>(PurchaseOrder.class); |
||||
return util.exportExcel(list, "采购订单数据"); |
||||
} |
||||
|
||||
@GetMapping(value = "/{id}") |
||||
public AjaxResult getInfo(@PathVariable("id") Long id) { |
||||
return AjaxResult.success(purchaseOrderService.selectPurchaseOrderById(id)); |
||||
} |
||||
|
||||
@Log(title = "采购订单", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody PurchaseOrder purchaseOrder) { |
||||
return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); |
||||
} |
||||
|
||||
@Log(title = "采购订单", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody PurchaseOrder purchaseOrder) { |
||||
return toAjax(purchaseOrderService.updatePurchaseOrder(purchaseOrder)); |
||||
} |
||||
|
||||
@Log(title = "采购订单", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{ids}") |
||||
public AjaxResult remove(@PathVariable Long[] ids) { |
||||
return toAjax(purchaseOrderService.deletePurchaseOrderByIds(ids)); |
||||
} |
||||
} |
@ -0,0 +1,163 @@
@@ -0,0 +1,163 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
public class PurchaseOrder extends BaseEntity { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Excel(name = "主键ID") |
||||
private Long id; |
||||
|
||||
@Excel(name = "滚动计划号") |
||||
private String planNo; |
||||
|
||||
@Excel(name = "采购凭证号") |
||||
private String purchaseNo; |
||||
|
||||
@Excel(name = "供应商编码") |
||||
private String supplierCode; |
||||
|
||||
@Excel(name = "供应商名称") |
||||
private String supplierName; |
||||
|
||||
@Excel(name = "整机编码") |
||||
private String machineCode; |
||||
|
||||
@Excel(name = "内部型号") |
||||
private String internalModel; |
||||
|
||||
@Excel(name = "数量") |
||||
private Integer quantity; |
||||
|
||||
@Excel(name = "意向调整时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
||||
private Date adjustmentTime; |
||||
|
||||
@Excel(name = "未税单价") |
||||
private BigDecimal price; |
||||
|
||||
@Excel(name = "总金额") |
||||
private BigDecimal totalAmount; |
||||
|
||||
@Excel(name = "仓库编码") |
||||
private String warehouseCode; |
||||
|
||||
@Excel(name = "仓库名称") |
||||
private String warehouseName; |
||||
|
||||
private String delFlag; |
||||
|
||||
// getter和setter方法
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public String getPlanNo() { |
||||
return planNo; |
||||
} |
||||
|
||||
public String getPurchaseNo() { |
||||
return purchaseNo; |
||||
} |
||||
|
||||
public String getSupplierCode() { |
||||
return supplierCode; |
||||
} |
||||
|
||||
public String getSupplierName() { |
||||
return supplierName; |
||||
} |
||||
|
||||
public String getMachineCode() { |
||||
return machineCode; |
||||
} |
||||
|
||||
public String getInternalModel() { |
||||
return internalModel; |
||||
} |
||||
|
||||
public Integer getQuantity() { |
||||
return quantity; |
||||
} |
||||
|
||||
public Date getAdjustmentTime() { |
||||
return adjustmentTime; |
||||
} |
||||
|
||||
public BigDecimal getPrice() { |
||||
return price; |
||||
} |
||||
|
||||
public BigDecimal getTotalAmount() { |
||||
return totalAmount; |
||||
} |
||||
|
||||
public String getWarehouseCode() { |
||||
return warehouseCode; |
||||
} |
||||
|
||||
public String getWarehouseName() { |
||||
return warehouseName; |
||||
} |
||||
|
||||
public String getDelFlag() { |
||||
return delFlag; |
||||
} |
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public void setPlanNo(String planNo) { |
||||
this.planNo = planNo; |
||||
} |
||||
|
||||
public void setPurchaseNo(String purchaseNo) { |
||||
this.purchaseNo = purchaseNo; |
||||
} |
||||
|
||||
public void setSupplierCode(String supplierCode) { |
||||
this.supplierCode = supplierCode; |
||||
} |
||||
|
||||
public void setSupplierName(String supplierName) { |
||||
this.supplierName = supplierName; |
||||
} |
||||
|
||||
public void setMachineCode(String machineCode) { |
||||
this.machineCode = machineCode; |
||||
} |
||||
|
||||
public void setInternalModel(String internalModel) { |
||||
this.internalModel = internalModel; |
||||
} |
||||
|
||||
public void setQuantity(Integer quantity) { |
||||
this.quantity = quantity; |
||||
} |
||||
|
||||
public void setAdjustmentTime(Date adjustmentTime) { |
||||
this.adjustmentTime = adjustmentTime; |
||||
} |
||||
|
||||
public void setPrice(BigDecimal price) { |
||||
this.price = price; |
||||
} |
||||
|
||||
public void setTotalAmount(BigDecimal totalAmount) { |
||||
this.totalAmount = totalAmount; |
||||
} |
||||
|
||||
public void setWarehouseCode(String warehouseCode) { |
||||
this.warehouseCode = warehouseCode; |
||||
} |
||||
|
||||
public void setWarehouseName(String warehouseName) { |
||||
this.warehouseName = warehouseName; |
||||
} |
||||
|
||||
public void setDelFlag(String delFlag) { |
||||
this.delFlag = delFlag; |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.PurchaseOrder; |
||||
|
||||
public interface PurchaseOrderMapper { |
||||
public PurchaseOrder selectPurchaseOrderById(Long id); |
||||
|
||||
public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder); |
||||
|
||||
public int insertPurchaseOrder(PurchaseOrder purchaseOrder); |
||||
|
||||
public int updatePurchaseOrder(PurchaseOrder purchaseOrder); |
||||
|
||||
public int deletePurchaseOrderByIds(Long[] ids); |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.PurchaseOrder; |
||||
|
||||
public interface IPurchaseOrderService { |
||||
public PurchaseOrder selectPurchaseOrderById(Long id); |
||||
|
||||
public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder); |
||||
|
||||
public int insertPurchaseOrder(PurchaseOrder purchaseOrder); |
||||
|
||||
public int updatePurchaseOrder(PurchaseOrder purchaseOrder); |
||||
|
||||
public int deletePurchaseOrderByIds(Long[] ids); |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.PurchaseOrderMapper; |
||||
import com.ruoyi.system.domain.PurchaseOrder; |
||||
import com.ruoyi.system.service.IPurchaseOrderService; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
@Service |
||||
public class PurchaseOrderServiceImpl implements IPurchaseOrderService { |
||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseOrderServiceImpl.class); |
||||
|
||||
@Override |
||||
public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder) { |
||||
List<PurchaseOrder> result = purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder); |
||||
logger.info("查询采购订单列表结果:{}", result); |
||||
return result; |
||||
} |
||||
@Autowired |
||||
private PurchaseOrderMapper purchaseOrderMapper; |
||||
|
||||
@Override |
||||
public PurchaseOrder selectPurchaseOrderById(Long id) { |
||||
return purchaseOrderMapper.selectPurchaseOrderById(id); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public int insertPurchaseOrder(PurchaseOrder purchaseOrder) { |
||||
return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); |
||||
} |
||||
|
||||
@Override |
||||
public int updatePurchaseOrder(PurchaseOrder purchaseOrder) { |
||||
return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); |
||||
} |
||||
|
||||
@Override |
||||
public int deletePurchaseOrderByIds(Long[] ids) { |
||||
return purchaseOrderMapper.deletePurchaseOrderByIds(ids); |
||||
} |
||||
} |
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
<?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.ruoyi.system.mapper.PurchaseOrderMapper"> |
||||
|
||||
<resultMap type="PurchaseOrder" id="PurchaseOrderResult"> |
||||
<id property="id" column="id" /> |
||||
<result property="planNo" column="plan_no" /> |
||||
<result property="purchaseNo" column="purchase_no" /> |
||||
<result property="supplierCode" column="supplier_code" /> |
||||
<result property="supplierName" column="supplier_name" /> |
||||
<result property="machineCode" column="machine_code" /> |
||||
<result property="internalModel" column="internal_model" /> |
||||
<result property="quantity" column="quantity" /> |
||||
<result property="adjustmentTime" column="adjustment_time" /> |
||||
<result property="price" column="price" /> |
||||
<result property="totalAmount" column="total_amount" /> |
||||
<result property="warehouseCode" column="warehouse_code" /> |
||||
<result property="warehouseName" column="warehouse_name" /> |
||||
<result property="createBy" column="create_by" /> |
||||
<result property="createTime" column="create_time" /> |
||||
<result property="updateBy" column="update_by" /> |
||||
<result property="updateTime" column="update_time" /> |
||||
<result property="remark" column="remark" /> |
||||
<result property="delFlag" column="del_flag" /> |
||||
</resultMap> |
||||
|
||||
<sql id="selectPurchaseOrderVo"> |
||||
select id, plan_no, purchase_no, supplier_code, supplier_name, machine_code, |
||||
internal_model, quantity, adjustment_time, price, total_amount, |
||||
warehouse_code, warehouse_name, create_by, create_time, update_by, |
||||
update_time, remark, del_flag |
||||
from purchase_order |
||||
</sql> |
||||
|
||||
<select id="selectPurchaseOrderList" parameterType="PurchaseOrder" resultMap="PurchaseOrderResult"> |
||||
<include refid="selectPurchaseOrderVo"/> |
||||
<where> |
||||
<if test="planNo != null and planNo != ''"> and plan_no like concat('%', #{planNo}, '%')</if> |
||||
<if test="purchaseNo != null and purchaseNo != ''"> and purchase_no like concat('%', #{purchaseNo}, '%')</if> |
||||
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if> |
||||
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if> |
||||
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if> |
||||
<if test="internalModel != null and internalModel != ''"> and internal_model like concat('%', #{internalModel}, '%')</if> |
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
||||
AND date_format(adjustment_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
||||
</if> |
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
||||
AND date_format(adjustment_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
||||
</if> |
||||
and del_flag = '0' |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult"> |
||||
<include refid="selectPurchaseOrderVo"/> |
||||
where id = #{id} and del_flag = '0' |
||||
</select> |
||||
|
||||
<insert id="insertPurchaseOrder" parameterType="PurchaseOrder" useGeneratedKeys="true" keyProperty="id"> |
||||
insert into purchase_order( |
||||
plan_no, purchase_no, supplier_code, supplier_name, machine_code, internal_model, |
||||
quantity, adjustment_time, price, total_amount, warehouse_code, warehouse_name, |
||||
create_by, create_time, remark, del_flag |
||||
) values ( |
||||
#{planNo}, #{purchaseNo}, #{supplierCode}, #{supplierName}, #{machineCode}, #{internalModel}, |
||||
#{quantity}, #{adjustmentTime}, #{price}, #{totalAmount}, #{warehouseCode}, #{warehouseName}, |
||||
#{createBy}, sysdate(), #{remark}, '0' |
||||
) |
||||
</insert> |
||||
|
||||
<update id="updatePurchaseOrder" parameterType="PurchaseOrder"> |
||||
update purchase_order |
||||
<set> |
||||
<if test="planNo != null">plan_no = #{planNo},</if> |
||||
<if test="purchaseNo != null">purchase_no = #{purchaseNo},</if> |
||||
<if test="supplierCode != null">supplier_code = #{supplierCode},</if> |
||||
<if test="supplierName != null">supplier_name = #{supplierName},</if> |
||||
<if test="machineCode != null">machine_code = #{machineCode},</if> |
||||
<if test="internalModel != null">internal_model = #{internalModel},</if> |
||||
<if test="quantity != null">quantity = #{quantity},</if> |
||||
<if test="adjustmentTime != null">adjustment_time = #{adjustmentTime},</if> |
||||
<if test="price != null">price = #{price},</if> |
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if> |
||||
<if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if> |
||||
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if> |
||||
<if test="updateBy != null">update_by = #{updateBy},</if> |
||||
update_time = sysdate() |
||||
</set> |
||||
where id = #{id} |
||||
</update> |
||||
|
||||
<update id="deletePurchaseOrderByIds" parameterType="Long"> |
||||
update purchase_order set del_flag = '2' where id in |
||||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
#{id} |
||||
</foreach> |
||||
</update> |
||||
</mapper> |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
--DROP TABLE IF EXISTS purchase_order; |
||||
CREATE TABLE purchase_order |
||||
( |
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', |
||||
plan_no varchar(32) NOT NULL COMMENT '滚动计划号', |
||||
purchase_no varchar(32) NOT NULL COMMENT '采购凭证号', |
||||
supplier_code varchar(32) NOT NULL COMMENT '供应商编码', |
||||
supplier_name varchar(100) NOT NULL COMMENT '供应商名称', |
||||
machine_code varchar(32) NOT NULL COMMENT '整机编码', |
||||
internal_model varchar(50) NOT NULL COMMENT '内部型号', |
||||
quantity int NOT NULL DEFAULT '0' COMMENT '数量', |
||||
adjustment_time datetime DEFAULT NULL COMMENT '意向调整时间', |
||||
price decimal(10, 2) NOT NULL DEFAULT '0.00' COMMENT '未税单价', |
||||
total_amount decimal(10, 2) NOT NULL DEFAULT '0.00' COMMENT '总金额', |
||||
warehouse_code varchar(32) NOT NULL COMMENT '仓库编码', |
||||
warehouse_name varchar(100) NOT NULL COMMENT '仓库名称', |
||||
create_by varchar(64) DEFAULT '' COMMENT '创建者', |
||||
create_time datetime DEFAULT NULL COMMENT '创建时间', |
||||
update_by varchar(64) DEFAULT '' COMMENT '更新者', |
||||
update_time datetime DEFAULT NULL COMMENT '更新时间', |
||||
remark varchar(500) DEFAULT NULL COMMENT '备注', |
||||
del_flag char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', |
||||
PRIMARY KEY (id), |
||||
UNIQUE KEY idx_purchase_no (purchase_no), |
||||
KEY idx_plan_no (plan_no), |
||||
KEY idx_supplier_code (supplier_code) |
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购订单表'; |
Loading…
Reference in new issue