新增采购单
This commit is contained in:
parent
18e65eda0a
commit
00c2ec9bd8
|
@ -0,0 +1,172 @@
|
|||
package com.snow.web.controller.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.snow.common.constant.SequenceContants;
|
||||
import com.snow.framework.excel.FinanceAlipayFlowListener;
|
||||
import com.snow.framework.excel.PurchaseOrderListener;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.FinanceAlipayFlowImport;
|
||||
import com.snow.system.domain.PurchaseOrderImport;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import com.snow.system.service.ISysSequenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.snow.common.annotation.Log;
|
||||
import com.snow.common.enums.BusinessType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.snow.system.domain.PurchaseOrderMain;
|
||||
import com.snow.system.service.IPurchaseOrderMainService;
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.domain.AjaxResult;
|
||||
import com.snow.common.utils.poi.ExcelUtil;
|
||||
import com.snow.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 采购单主表Controller
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/purchaseOrder")
|
||||
public class PurchaseOrderMainController extends BaseController
|
||||
{
|
||||
private String prefix = "system/purchaseOrder";
|
||||
|
||||
@Autowired
|
||||
private IPurchaseOrderMainService purchaseOrderMainService;
|
||||
|
||||
@Autowired
|
||||
private ISysSequenceService sequenceService;
|
||||
@RequiresPermissions("system:purchaseOrder:view")
|
||||
@GetMapping()
|
||||
public String purchaseOrder()
|
||||
{
|
||||
return prefix + "/purchaseOrder";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
startPage();
|
||||
List<PurchaseOrderMain> list = purchaseOrderMainService.selectPurchaseOrderMainList(purchaseOrderMain);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购单主表列表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:export")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
List<PurchaseOrderMain> list = purchaseOrderMainService.selectPurchaseOrderMainList(purchaseOrderMain);
|
||||
ExcelUtil<PurchaseOrderMain> util = new ExcelUtil<PurchaseOrderMain>(PurchaseOrderMain.class);
|
||||
return util.exportExcel(list, "purchaseOrder");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购单主表
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceContants.OA_PURCHASE_SEQUENCE);
|
||||
mmap.put("orderNo", newSequenceNo);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存采购单主表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:add")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
return toAjax(purchaseOrderMainService.insertPurchaseOrderMain(purchaseOrderMain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入采购单子表列表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:import")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/import")
|
||||
@ResponseBody
|
||||
public AjaxResult importData(MultipartFile file)
|
||||
{
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
PurchaseOrderListener purchaseOrderListener = new PurchaseOrderListener(purchaseOrderMainService, sysUser);
|
||||
ExcelReader excelReader = null;
|
||||
try {
|
||||
excelReader = EasyExcel.read(file.getInputStream(), PurchaseOrderImport.class, purchaseOrderListener).build();
|
||||
ReadSheet readSheet = EasyExcel.readSheet(0).build();
|
||||
excelReader.read(readSheet);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.success("导入失败:"+e.getMessage());
|
||||
}finally {
|
||||
// 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
|
||||
excelReader.finish();
|
||||
|
||||
}
|
||||
|
||||
List<PurchaseOrderImport> list = purchaseOrderListener.list;
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
/**
|
||||
* 修改采购单主表
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
PurchaseOrderMain purchaseOrderMain = purchaseOrderMainService.selectPurchaseOrderMainById(id);
|
||||
mmap.put("purchaseOrderMain", purchaseOrderMain);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存采购单主表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:edit")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
return toAjax(purchaseOrderMainService.updatePurchaseOrderMain(purchaseOrderMain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购单主表
|
||||
*/
|
||||
@RequiresPermissions("system:purchaseOrder:remove")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(purchaseOrderMainService.deletePurchaseOrderMainByIds(ids));
|
||||
}
|
||||
}
|
|
@ -382,39 +382,48 @@ var storage = {
|
|||
// 主子表操作封装处理
|
||||
var sub = {
|
||||
editColumn: function() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
var params = new Array();
|
||||
for (var dataIndex = 0; dataIndex <= count; dataIndex++) {
|
||||
var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td');
|
||||
var obj = new Object();
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
var inputValue = $(columns[i]).find('input');
|
||||
var selectValue = $(columns[i]).find('select');
|
||||
var key = table.options.columns[i].field;
|
||||
if ($.common.isNotEmpty(inputValue.val())) {
|
||||
obj[key] = inputValue.val();
|
||||
} else if ($.common.isNotEmpty(selectValue.val())) {
|
||||
obj[key] = selectValue.val();
|
||||
} else {
|
||||
obj[key] = "";
|
||||
}
|
||||
}
|
||||
params.push({ index: dataIndex, row: obj });
|
||||
}
|
||||
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
var params = new Array();
|
||||
for (var dataIndex = 0; dataIndex < count; dataIndex++) {
|
||||
var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td');
|
||||
var obj = new Object();
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
var inputValue = $(columns[i]).find('input');
|
||||
var selectValue = $(columns[i]).find('select');
|
||||
var key = table.options.columns[i].field;
|
||||
if ($.common.isNotEmpty(inputValue.val())) {
|
||||
obj[key] = inputValue.val();
|
||||
} else if ($.common.isNotEmpty(selectValue.val())) {
|
||||
obj[key] = selectValue.val();
|
||||
} else {
|
||||
obj[key] = "";
|
||||
}
|
||||
}
|
||||
params.push({ index: dataIndex, row: obj });
|
||||
}
|
||||
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
||||
},
|
||||
delColumn: function(column) {
|
||||
sub.editColumn();
|
||||
var subColumn = $.common.isEmpty(column) ? "index" : column;
|
||||
var ids = $.table.selectColumns(subColumn);
|
||||
sub.editColumn();
|
||||
var subColumn = $.common.isEmpty(column) ? "index" : column;
|
||||
var ids = $.table.selectColumns(subColumn);
|
||||
if (ids.length == 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
$("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids });
|
||||
},
|
||||
addColumn: function(row, tableId) {
|
||||
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
||||
table.set(currentId);
|
||||
var count = $("#" + currentId).bootstrapTable('getData').length;
|
||||
sub.editColumn();
|
||||
$("#" + currentId).bootstrapTable('insertRow', {
|
||||
index: count + 1,
|
||||
row: row
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 设置全局ajax处理 */
|
||||
$.ajaxSetup({
|
||||
complete: function(XMLHttpRequest, textStatus) {
|
||||
|
|
|
@ -86,13 +86,14 @@
|
|||
$(function() {
|
||||
var options = {
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
sidePagination: "client",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
|
@ -153,8 +154,17 @@
|
|||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
function addColumn() {
|
||||
var row = {
|
||||
name: "",
|
||||
weight: "",
|
||||
price: "",
|
||||
date: "",
|
||||
type: "",
|
||||
}
|
||||
sub.addColumn(row);
|
||||
}
|
||||
/* function addColumn() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
sub.editColumn();
|
||||
|
||||
|
@ -168,7 +178,7 @@
|
|||
type: "",
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,299 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增采购单主表')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-purchaseOrder-add">
|
||||
<h4 class="form-header h4">采购单主表信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订单号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="orderNo" class="form-control" type="text" th:value="${orderNo}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="title" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-3 control-label">总数量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="totalQuantity" class="form-control" type="text">
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购总金额:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="totalPrice" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">供应商名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="supplierName" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订货日期:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="orderTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交货日期:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="deliveryDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="belongUser" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">采购单明细信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-success btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||
<button type="button" class="btn btn-warning btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||
<a class="btn btn-sm btn-info" onclick="importData()" shiro:hasPermission="system:purchaseOrder:import">
|
||||
<i class="fa fa-upload"></i> 导入
|
||||
</a>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<script th:src="@{/js/jquery.tmpl.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/purchaseOrder"
|
||||
$("#form-purchaseOrder-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-purchaseOrder-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$("input[name='orderTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$("input[name='deliveryDate']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
return columnIndex + $.table.serialNumber(index);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsNo',
|
||||
align: 'center',
|
||||
title: '货物编号',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].createTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsName',
|
||||
align: 'center',
|
||||
title: '名称',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsSize',
|
||||
align: 'center',
|
||||
title: '规格',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsSize' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsQuantity',
|
||||
align: 'center',
|
||||
title: '数量',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsQuantity' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsPrice',
|
||||
align: 'center',
|
||||
title: '单价',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsPrice' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
align: 'center',
|
||||
title: '总价',
|
||||
formatter: function(value, row, index) {
|
||||
value=row.goodsPrice*row.goodsQuantity;
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].totalPrice' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
align: 'center',
|
||||
title: '备注',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].remark' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function addColumn() {
|
||||
var row = {
|
||||
goodsNo: "",
|
||||
goodsName: "",
|
||||
goodsSize: "",
|
||||
goodsQuantity: "",
|
||||
goodsPrice: "",
|
||||
totalPrice: "",
|
||||
remark: ""
|
||||
};
|
||||
sub.addColumn(row);
|
||||
}
|
||||
|
||||
|
||||
function importData(formId) {
|
||||
var prefix = ctx + "system/purchaseOrder";
|
||||
table.set();
|
||||
var currentId = $.common.isEmpty(formId) ? 'importTpl' : formId;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['400px', '230px'],
|
||||
fix: false,
|
||||
//不固定
|
||||
maxmin: true,
|
||||
shade: 0.3,
|
||||
title: '导入采购单明细数据',
|
||||
content: $('#' + currentId).html(),
|
||||
btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'],
|
||||
// 弹层外区域关闭
|
||||
shadeClose: true,
|
||||
btn1: function(index, layero){
|
||||
var file = layero.find('#file').val();
|
||||
if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){
|
||||
$.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。");
|
||||
return false;
|
||||
}
|
||||
var index = layer.load(2, {shade: false});
|
||||
$.modal.disable();
|
||||
var formData = new FormData(layero.find('form')[0]);
|
||||
$.ajax({
|
||||
url:prefix+'/import',
|
||||
data: formData,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
success: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
layer.closeAll(); //关闭加载层
|
||||
$.modal.enable();
|
||||
$.table.refresh();
|
||||
//console.log(JSON.stringify(result))
|
||||
var data= result.data;
|
||||
|
||||
for (var i = 0; i < data.length; i++){
|
||||
sub.addColumn(data[i]);
|
||||
}
|
||||
|
||||
|
||||
// $.modal.alertSuccess(result.msg);
|
||||
} else if (result.code == web_status.WARNING) {
|
||||
layer.close(index);
|
||||
$.modal.enable();
|
||||
$.modal.alertWarning(result.msg)
|
||||
} else {
|
||||
layer.close(index);
|
||||
$.modal.enable();
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 导入区域 -->
|
||||
<script id="importTpl" type="text/template">
|
||||
<form enctype="multipart/form-data" class=" form-horizontal m mt20 mb10" >
|
||||
<div class="col-xs-offset-1">
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">导入数据:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="file" id="file" name="file"/>
|
||||
</div>
|
||||
<!-- <div class="col-sm-4">
|
||||
<a onclick="$.table.importTemplate()" class="btn btn-xs btn-danger"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<font color="red" class="pull-left mt10">
|
||||
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||
</font>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,251 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改采购单主表')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-purchaseOrder-edit" th:object="${purchaseOrderMain}">
|
||||
<h4 class="form-header h4">采购单主表信息</h4>
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订单号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="orderNo" th:field="*{orderNo}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">总数量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="totalQuantity" th:field="*{totalQuantity}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购总金额:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="totalPrice" th:field="*{totalPrice}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="title" th:field="*{title}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">供应商名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订货日期:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="orderTime" th:value="${#dates.format(purchaseOrderMain.orderTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交货日期:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="deliveryDate" th:value="${#dates.format(purchaseOrderMain.deliveryDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审批状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('process_status')}">
|
||||
<input type="radio" th:id="${'processStatus_' + dict.dictCode}" name="processStatus" th:value="${dict.dictValue}" th:field="*{processStatus}">
|
||||
<label th:for="${'processStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采购人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="belongUser" th:field="*{belongUser}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">${subTable.functionName}信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/purchaseOrder";
|
||||
$("#form-purchaseOrder-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-purchaseOrder-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$("input[name='orderTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$("input[name='deliveryDate']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
data: [[${purchaseOrderMain.purchaseOrderItemList}]],
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
return columnIndex + $.table.serialNumber(index);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsName',
|
||||
align: 'center',
|
||||
title: '名称',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsSize',
|
||||
align: 'center',
|
||||
title: '规格',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsSize' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsQuantity',
|
||||
align: 'center',
|
||||
title: '数量',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsQuantity' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsPrice',
|
||||
align: 'center',
|
||||
title: '单价',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsPrice' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
align: 'center',
|
||||
title: '总价',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].totalPrice' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
align: 'center',
|
||||
title: '备注',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].remark' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goodsNo',
|
||||
align: 'center',
|
||||
title: '货物编号',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].goodsNo' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'isDelete',
|
||||
align: 'center',
|
||||
title: '货物编号',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].isDelete' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
title: '货物编号',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].createTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
align: 'center',
|
||||
title: '货物编号',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='purchaseOrderItemList[%s].createBy' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function addColumn() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
sub.editColumn();
|
||||
|
||||
$("#" + table.options.id).bootstrapTable('insertRow', {
|
||||
index: count,
|
||||
row: {
|
||||
index: $.table.serialNumber(count),
|
||||
goodsName: "",
|
||||
goodsSize: "",
|
||||
goodsQuantity: "",
|
||||
goodsPrice: "",
|
||||
totalPrice: "",
|
||||
remark: "",
|
||||
goodsNo: "",
|
||||
isDelete: "",
|
||||
createTime: "",
|
||||
createBy: ""
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,149 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('采购单主表列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>订单号:</label>
|
||||
<input type="text" name="orderNo" />
|
||||
</li>
|
||||
<li>
|
||||
<label>采购标题:</label>
|
||||
<input type="text" name="title"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>供应商名称:</label>
|
||||
<input type="text" name="supplierName"/>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>订货日期:</label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginOrderTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endOrderTime]"/>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>交货日期:</label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDeliveryDate]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDeliveryDate]"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>审批状态:</label>
|
||||
<select name="processStatus" th:with="type=${@dict.getType('process_status')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:purchaseOrder:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:purchaseOrder:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:purchaseOrder:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:purchaseOrder:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:purchaseOrder:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:purchaseOrder:remove')}]];
|
||||
var processStatusDatas = [[${@dict.getType('process_status')}]];
|
||||
var prefix = ctx + "system/purchaseOrder";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "采购单",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'id',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'orderNo',
|
||||
title: '订单号'
|
||||
},
|
||||
{
|
||||
field: 'totalQuantity',
|
||||
title: '总数量'
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '采购总金额'
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '采购标题'
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商名称'
|
||||
},
|
||||
{
|
||||
field: 'orderTime',
|
||||
title: '订货日期'
|
||||
},
|
||||
{
|
||||
field: 'deliveryDate',
|
||||
title: '交货日期'
|
||||
},
|
||||
{
|
||||
field: 'processStatus',
|
||||
title: '审批状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(processStatusDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'belongUser',
|
||||
title: '采购人'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -11,4 +11,9 @@ public class SequenceContants {
|
|||
*请假
|
||||
*/
|
||||
public static final String OA_LEAVE_SEQUENCE = "OA_QJ";
|
||||
|
||||
/**
|
||||
* 采购单
|
||||
*/
|
||||
public static final String OA_PURCHASE_SEQUENCE="OA_CG";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package com.snow.framework.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.snow.system.domain.PurchaseOrderImport;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import com.snow.system.service.IPurchaseOrderMainService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2021/1/7 15:54
|
||||
*/
|
||||
public class PurchaseOrderListener extends AnalysisEventListener<PurchaseOrderImport> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AnalysisEventListener.class);
|
||||
|
||||
/**
|
||||
* 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。
|
||||
*/
|
||||
|
||||
private IPurchaseOrderMainService purchaseOrderMainService;
|
||||
|
||||
/**
|
||||
* 导入人
|
||||
*/
|
||||
private SysUser sysUser;
|
||||
|
||||
//创建list集合封装最终的数据
|
||||
public List<PurchaseOrderImport> list = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来
|
||||
*
|
||||
* @param purchaseOrderMainService
|
||||
*/
|
||||
public PurchaseOrderListener(IPurchaseOrderMainService purchaseOrderMainService, SysUser sysUser) {
|
||||
this.purchaseOrderMainService = purchaseOrderMainService;
|
||||
this.sysUser=sysUser;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invoke(PurchaseOrderImport purchaseOrderImport, AnalysisContext analysisContext) {
|
||||
BigDecimal goodsPrice=Optional.ofNullable(purchaseOrderImport.getGoodsPrice()).orElse(new BigDecimal(0));
|
||||
BigDecimal goodsQuantity=Optional.ofNullable(purchaseOrderImport.getGoodsQuantity()).orElse(new BigDecimal(0));
|
||||
purchaseOrderImport.setTotalPrice(goodsPrice.multiply(goodsQuantity));
|
||||
list.add(purchaseOrderImport);
|
||||
}
|
||||
|
||||
//读取完成后执行
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.snow.system.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.snow.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2021/1/7 15:55
|
||||
*/
|
||||
@Data
|
||||
public class PurchaseOrderImport {
|
||||
|
||||
/** 货物编号 */
|
||||
@ExcelProperty(index = 0)
|
||||
private String goodsNo;
|
||||
/** 名称 */
|
||||
@ExcelProperty(index = 1)
|
||||
private String goodsName;
|
||||
|
||||
/** 规格 */
|
||||
@ExcelProperty(index = 2)
|
||||
private String goodsSize;
|
||||
|
||||
/** 数量 */
|
||||
@ExcelProperty(index = 3)
|
||||
private BigDecimal goodsQuantity;
|
||||
|
||||
/** 单价 */
|
||||
@ExcelProperty(index = 4)
|
||||
private BigDecimal goodsPrice;
|
||||
/** 备注 */
|
||||
@ExcelProperty(index = 5)
|
||||
private String remark;
|
||||
/** 总价 */
|
||||
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
package com.snow.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.snow.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.snow.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* ${subTable.functionName}对象 purchase_order_item
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
public class PurchaseOrderItem extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Integer id;
|
||||
|
||||
/** 采购单号(主表单号) */
|
||||
@Excel(name = "采购单号", readConverterExp = "主=表单号")
|
||||
private String purchaseOrderNo;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String goodsName;
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
private String goodsSize;
|
||||
|
||||
/** 数量 */
|
||||
@Excel(name = "数量")
|
||||
private BigDecimal goodsQuantity;
|
||||
|
||||
/** 单价 */
|
||||
@Excel(name = "单价")
|
||||
private BigDecimal goodsPrice;
|
||||
|
||||
/** 总价 */
|
||||
@Excel(name = "总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 货物编号 */
|
||||
@Excel(name = "货物编号")
|
||||
private String goodsNo;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "货物编号")
|
||||
private Long isDelete;
|
||||
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setPurchaseOrderNo(String purchaseOrderNo)
|
||||
{
|
||||
this.purchaseOrderNo = purchaseOrderNo;
|
||||
}
|
||||
|
||||
public String getPurchaseOrderNo()
|
||||
{
|
||||
return purchaseOrderNo;
|
||||
}
|
||||
public void setGoodsName(String goodsName)
|
||||
{
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsName()
|
||||
{
|
||||
return goodsName;
|
||||
}
|
||||
public void setGoodsSize(String goodsSize)
|
||||
{
|
||||
this.goodsSize = goodsSize;
|
||||
}
|
||||
|
||||
public String getGoodsSize()
|
||||
{
|
||||
return goodsSize;
|
||||
}
|
||||
public void setGoodsQuantity(BigDecimal goodsQuantity)
|
||||
{
|
||||
this.goodsQuantity = goodsQuantity;
|
||||
}
|
||||
|
||||
public BigDecimal getGoodsQuantity()
|
||||
{
|
||||
return goodsQuantity;
|
||||
}
|
||||
public void setGoodsPrice(BigDecimal goodsPrice)
|
||||
{
|
||||
this.goodsPrice = goodsPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getGoodsPrice()
|
||||
{
|
||||
return goodsPrice;
|
||||
}
|
||||
public void setTotalPrice(BigDecimal totalPrice)
|
||||
{
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice()
|
||||
{
|
||||
return totalPrice;
|
||||
}
|
||||
public void setGoodsNo(String goodsNo)
|
||||
{
|
||||
this.goodsNo = goodsNo;
|
||||
}
|
||||
|
||||
public String getGoodsNo()
|
||||
{
|
||||
return goodsNo;
|
||||
}
|
||||
public void setIsDelete(Long isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("purchaseOrderNo", getPurchaseOrderNo())
|
||||
.append("goodsName", getGoodsName())
|
||||
.append("goodsSize", getGoodsSize())
|
||||
.append("goodsQuantity", getGoodsQuantity())
|
||||
.append("goodsPrice", getGoodsPrice())
|
||||
.append("totalPrice", getTotalPrice())
|
||||
.append("remark", getRemark())
|
||||
.append("goodsNo", getGoodsNo())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
package com.snow.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.snow.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.snow.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 采购单主表对象 purchase_order_main
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
public class PurchaseOrderMain extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Integer id;
|
||||
|
||||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private String orderNo;
|
||||
|
||||
/** 总数量 */
|
||||
@Excel(name = "总数量")
|
||||
private BigDecimal totalQuantity;
|
||||
|
||||
/** 采购总金额 */
|
||||
@Excel(name = "采购总金额")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 采购标题 */
|
||||
@Excel(name = "采购标题")
|
||||
private String title;
|
||||
|
||||
/** 供应商名称 */
|
||||
@Excel(name = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
/** 订货日期 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "订货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date orderTime;
|
||||
|
||||
/** 交货日期 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "交货日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deliveryDate;
|
||||
|
||||
/** 审批状态 */
|
||||
@Excel(name = "审批状态")
|
||||
private Long processStatus;
|
||||
|
||||
/** 采购人 */
|
||||
@Excel(name = "采购人")
|
||||
private String belongUser;
|
||||
|
||||
/** null */
|
||||
private Long isDelete;
|
||||
|
||||
/** $table.subTable.functionName信息 */
|
||||
private List<PurchaseOrderItem> purchaseOrderItemList;
|
||||
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setOrderNo(String orderNo)
|
||||
{
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getOrderNo()
|
||||
{
|
||||
return orderNo;
|
||||
}
|
||||
public void setTotalQuantity(BigDecimal totalQuantity)
|
||||
{
|
||||
this.totalQuantity = totalQuantity;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalQuantity()
|
||||
{
|
||||
return totalQuantity;
|
||||
}
|
||||
public void setTotalPrice(BigDecimal totalPrice)
|
||||
{
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice()
|
||||
{
|
||||
return totalPrice;
|
||||
}
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
public void setSupplierName(String supplierName)
|
||||
{
|
||||
this.supplierName = supplierName;
|
||||
}
|
||||
|
||||
public String getSupplierName()
|
||||
{
|
||||
return supplierName;
|
||||
}
|
||||
public void setOrderTime(Date orderTime)
|
||||
{
|
||||
this.orderTime = orderTime;
|
||||
}
|
||||
|
||||
public Date getOrderTime()
|
||||
{
|
||||
return orderTime;
|
||||
}
|
||||
public void setDeliveryDate(Date deliveryDate)
|
||||
{
|
||||
this.deliveryDate = deliveryDate;
|
||||
}
|
||||
|
||||
public Date getDeliveryDate()
|
||||
{
|
||||
return deliveryDate;
|
||||
}
|
||||
public void setProcessStatus(Long processStatus)
|
||||
{
|
||||
this.processStatus = processStatus;
|
||||
}
|
||||
|
||||
public Long getProcessStatus()
|
||||
{
|
||||
return processStatus;
|
||||
}
|
||||
public void setBelongUser(String belongUser)
|
||||
{
|
||||
this.belongUser = belongUser;
|
||||
}
|
||||
|
||||
public String getBelongUser()
|
||||
{
|
||||
return belongUser;
|
||||
}
|
||||
public void setIsDelete(Long isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public List<PurchaseOrderItem> getPurchaseOrderItemList()
|
||||
{
|
||||
return purchaseOrderItemList;
|
||||
}
|
||||
|
||||
public void setPurchaseOrderItemList(List<PurchaseOrderItem> purchaseOrderItemList)
|
||||
{
|
||||
this.purchaseOrderItemList = purchaseOrderItemList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderNo", getOrderNo())
|
||||
.append("totalQuantity", getTotalQuantity())
|
||||
.append("totalPrice", getTotalPrice())
|
||||
.append("title", getTitle())
|
||||
.append("supplierName", getSupplierName())
|
||||
.append("orderTime", getOrderTime())
|
||||
.append("deliveryDate", getDeliveryDate())
|
||||
.append("processStatus", getProcessStatus())
|
||||
.append("belongUser", getBelongUser())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("remark", getRemark())
|
||||
.append("purchaseOrderItemList", getPurchaseOrderItemList())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.snow.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.snow.system.domain.PurchaseOrderMain;
|
||||
import com.snow.system.domain.PurchaseOrderItem;
|
||||
|
||||
/**
|
||||
* 采购单主表Mapper接口
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
public interface PurchaseOrderMainMapper
|
||||
{
|
||||
/**
|
||||
* 查询采购单主表
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 采购单主表
|
||||
*/
|
||||
public PurchaseOrderMain selectPurchaseOrderMainById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 采购单主表集合
|
||||
*/
|
||||
public List<PurchaseOrderMain> selectPurchaseOrderMainList(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 新增采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPurchaseOrderMain(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 修改采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePurchaseOrderMain(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 删除采购单主表
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderMainById(Integer id);
|
||||
|
||||
/**
|
||||
* 批量删除采购单主表
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderMainByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除${subTable.functionName}
|
||||
*
|
||||
* @param customerIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderItemByPurchaseOrderNos(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增${subTable.functionName}
|
||||
*
|
||||
* @param purchaseOrderItemList ${subTable.functionName}列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchPurchaseOrderItem(List<PurchaseOrderItem> purchaseOrderItemList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过采购单主表ID删除${subTable.functionName}信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderItemByPurchaseOrderNo(Integer id);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.snow.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.snow.system.domain.PurchaseOrderMain;
|
||||
|
||||
/**
|
||||
* 采购单主表Service接口
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
public interface IPurchaseOrderMainService
|
||||
{
|
||||
/**
|
||||
* 查询采购单主表
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 采购单主表
|
||||
*/
|
||||
public PurchaseOrderMain selectPurchaseOrderMainById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 采购单主表集合
|
||||
*/
|
||||
public List<PurchaseOrderMain> selectPurchaseOrderMainList(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 新增采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPurchaseOrderMain(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 修改采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePurchaseOrderMain(PurchaseOrderMain purchaseOrderMain);
|
||||
|
||||
/**
|
||||
* 批量删除采购单主表
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderMainByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除采购单主表信息
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePurchaseOrderMainById(Integer id);
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.snow.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.snow.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.snow.system.domain.PurchaseOrderItem;
|
||||
import com.snow.system.mapper.PurchaseOrderMainMapper;
|
||||
import com.snow.system.domain.PurchaseOrderMain;
|
||||
import com.snow.system.service.IPurchaseOrderMainService;
|
||||
import com.snow.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 采购单主表Service业务层处理
|
||||
*
|
||||
* @author snow
|
||||
* @date 2021-01-07
|
||||
*/
|
||||
@Service
|
||||
public class PurchaseOrderMainServiceImpl implements IPurchaseOrderMainService
|
||||
{
|
||||
@Autowired
|
||||
private PurchaseOrderMainMapper purchaseOrderMainMapper;
|
||||
|
||||
/**
|
||||
* 查询采购单主表
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 采购单主表
|
||||
*/
|
||||
@Override
|
||||
public PurchaseOrderMain selectPurchaseOrderMainById(Integer id)
|
||||
{
|
||||
return purchaseOrderMainMapper.selectPurchaseOrderMainById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 采购单主表
|
||||
*/
|
||||
@Override
|
||||
public List<PurchaseOrderMain> selectPurchaseOrderMainList(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
return purchaseOrderMainMapper.selectPurchaseOrderMainList(purchaseOrderMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertPurchaseOrderMain(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
purchaseOrderMain.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = purchaseOrderMainMapper.insertPurchaseOrderMain(purchaseOrderMain);
|
||||
insertPurchaseOrderItem(purchaseOrderMain);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购单主表
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updatePurchaseOrderMain(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
purchaseOrderMain.setUpdateTime(DateUtils.getNowDate());
|
||||
purchaseOrderMainMapper.deletePurchaseOrderItemByPurchaseOrderNo(purchaseOrderMain.getId());
|
||||
insertPurchaseOrderItem(purchaseOrderMain);
|
||||
return purchaseOrderMainMapper.updatePurchaseOrderMain(purchaseOrderMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购单主表对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deletePurchaseOrderMainByIds(String ids)
|
||||
{
|
||||
purchaseOrderMainMapper.deletePurchaseOrderItemByPurchaseOrderNos(Convert.toStrArray(ids));
|
||||
return purchaseOrderMainMapper.deletePurchaseOrderMainByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购单主表信息
|
||||
*
|
||||
* @param id 采购单主表ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePurchaseOrderMainById(Integer id)
|
||||
{
|
||||
purchaseOrderMainMapper.deletePurchaseOrderItemByPurchaseOrderNo(id);
|
||||
return purchaseOrderMainMapper.deletePurchaseOrderMainById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增${subTable.functionName}信息
|
||||
*
|
||||
* @param purchaseOrderMain 采购单主表对象
|
||||
*/
|
||||
public void insertPurchaseOrderItem(PurchaseOrderMain purchaseOrderMain)
|
||||
{
|
||||
List<PurchaseOrderItem> purchaseOrderItemList = purchaseOrderMain.getPurchaseOrderItemList();
|
||||
String orderNo = purchaseOrderMain.getOrderNo();
|
||||
if (StringUtils.isNotNull(purchaseOrderItemList))
|
||||
{
|
||||
List<PurchaseOrderItem> list = new ArrayList<>();
|
||||
for (PurchaseOrderItem purchaseOrderItem : purchaseOrderItemList)
|
||||
{
|
||||
purchaseOrderItem.setPurchaseOrderNo(orderNo);
|
||||
list.add(purchaseOrderItem);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
purchaseOrderMainMapper.batchPurchaseOrderItem(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
<?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.snow.system.mapper.PurchaseOrderMainMapper">
|
||||
|
||||
<resultMap type="PurchaseOrderMain" id="PurchaseOrderMainResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="totalQuantity" column="total_quantity" />
|
||||
<result property="totalPrice" column="total_price" />
|
||||
<result property="title" column="title" />
|
||||
<result property="supplierName" column="supplier_name" />
|
||||
<result property="orderTime" column="order_time" />
|
||||
<result property="deliveryDate" column="delivery_date" />
|
||||
<result property="processStatus" column="process_status" />
|
||||
<result property="belongUser" column="belong_user" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PurchaseOrderMainPurchaseOrderItemResult" type="PurchaseOrderMain" extends="PurchaseOrderMainResult">
|
||||
<collection property="purchaseOrderItemList" notNullColumn="id" javaType="java.util.List" resultMap="PurchaseOrderItemResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="PurchaseOrderItem" id="PurchaseOrderItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseOrderNo" column="purchase_order_no" />
|
||||
<result property="goodsName" column="goods_name" />
|
||||
<result property="goodsSize" column="goods_size" />
|
||||
<result property="goodsQuantity" column="goods_quantity" />
|
||||
<result property="goodsPrice" column="goods_price" />
|
||||
<result property="totalPrice" column="total_price" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="goodsNo" column="goods_no" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPurchaseOrderMainVo">
|
||||
select id, order_no, total_quantity, total_price, title, supplier_name, order_time, delivery_date, process_status, belong_user, is_delete, create_time, create_by, update_time, update_by, remark from purchase_order_main
|
||||
</sql>
|
||||
|
||||
<select id="selectPurchaseOrderMainList" parameterType="PurchaseOrderMain" resultMap="PurchaseOrderMainResult">
|
||||
<include refid="selectPurchaseOrderMainVo"/>
|
||||
<where>
|
||||
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
|
||||
<if test="totalQuantity != null "> and total_quantity = #{totalQuantity}</if>
|
||||
<if test="totalPrice != null "> and total_price = #{totalPrice}</if>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
|
||||
<if test="orderTime != null "> and order_time = #{orderTime}</if>
|
||||
<if test="deliveryDate != null "> and delivery_date = #{deliveryDate}</if>
|
||||
<if test="processStatus != null "> and process_status = #{processStatus}</if>
|
||||
<if test="belongUser != null and belongUser != ''"> and belong_user = #{belongUser}</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPurchaseOrderMainById" parameterType="Integer" resultMap="PurchaseOrderMainPurchaseOrderItemResult">
|
||||
select a.id, a.order_no, a.total_quantity, a.total_price, a.title, a.supplier_name, a.order_time, a.delivery_date, a.process_status, a.belong_user, a.is_delete, a.create_time, a.create_by, a.update_time, a.update_by, a.remark,
|
||||
b.id, b.purchase_order_no, b.goods_name, b.goods_size, b.goods_quantity, b.goods_price, b.total_price, b.remark, b.goods_no, b.is_delete, b.create_time, b.create_by
|
||||
from purchase_order_main a
|
||||
left join purchase_order_item b on b.purchase_order_no = a.order_no
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPurchaseOrderMain" parameterType="PurchaseOrderMain" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into purchase_order_main
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null">order_no,</if>
|
||||
<if test="totalQuantity != null">total_quantity,</if>
|
||||
<if test="totalPrice != null">total_price,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="supplierName != null">supplier_name,</if>
|
||||
<if test="orderTime != null">order_time,</if>
|
||||
<if test="deliveryDate != null">delivery_date,</if>
|
||||
<if test="processStatus != null">process_status,</if>
|
||||
<if test="belongUser != null">belong_user,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null">#{orderNo},</if>
|
||||
<if test="totalQuantity != null">#{totalQuantity},</if>
|
||||
<if test="totalPrice != null">#{totalPrice},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="supplierName != null">#{supplierName},</if>
|
||||
<if test="orderTime != null">#{orderTime},</if>
|
||||
<if test="deliveryDate != null">#{deliveryDate},</if>
|
||||
<if test="processStatus != null">#{processStatus},</if>
|
||||
<if test="belongUser != null">#{belongUser},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePurchaseOrderMain" parameterType="PurchaseOrderMain">
|
||||
update purchase_order_main
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderNo != null">order_no = #{orderNo},</if>
|
||||
<if test="totalQuantity != null">total_quantity = #{totalQuantity},</if>
|
||||
<if test="totalPrice != null">total_price = #{totalPrice},</if>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="supplierName != null">supplier_name = #{supplierName},</if>
|
||||
<if test="orderTime != null">order_time = #{orderTime},</if>
|
||||
<if test="deliveryDate != null">delivery_date = #{deliveryDate},</if>
|
||||
<if test="processStatus != null">process_status = #{processStatus},</if>
|
||||
<if test="belongUser != null">belong_user = #{belongUser},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePurchaseOrderMainById" parameterType="Integer">
|
||||
delete from purchase_order_main where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePurchaseOrderMainByIds" parameterType="String">
|
||||
delete from purchase_order_main where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePurchaseOrderItemByPurchaseOrderNos" parameterType="String">
|
||||
delete from purchase_order_item where purchase_order_no in
|
||||
<foreach item="purchaseOrderNo" collection="array" open="(" separator="," close=")">
|
||||
#{purchaseOrderNo}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePurchaseOrderItemByPurchaseOrderNo" parameterType="Long">
|
||||
delete from purchase_order_item where purchase_order_no = #{purchaseOrderNo}
|
||||
</delete>
|
||||
|
||||
<insert id="batchPurchaseOrderItem">
|
||||
insert into purchase_order_item( id, purchase_order_no, goods_name, goods_size, goods_quantity, goods_price, total_price, remark, goods_no, is_delete, create_time, create_by) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.purchaseOrderNo}, #{item.goodsName}, #{item.goodsSize}, #{item.goodsQuantity}, #{item.goodsPrice}, #{item.totalPrice}, #{item.remark}, #{item.goodsNo}, #{item.isDelete}, #{item.createTime}, #{item.createBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue