进货 退货
This commit is contained in:
parent
99582ce083
commit
179438917a
@ -4,6 +4,14 @@ import request from '@/utils/request'
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
|
||||
export function getPurchasePageApi(query) {
|
||||
return request({
|
||||
url: '/business/convenience/mtPurchase/getListByPage',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 新增
|
||||
export function addPurchaseApi(data) {
|
||||
return request({
|
||||
|
@ -119,6 +119,14 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
|
||||
// {
|
||||
// path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus',
|
||||
// component: () => import('@/views/convenienceStore/purchase/details'),
|
||||
// name: 'purchase-details',
|
||||
// props: true, // 启用路由参数作为组件的props
|
||||
// meta: { title: '', icon: 'user' }
|
||||
// }
|
||||
|
||||
{
|
||||
path: '/purchase',
|
||||
component: Layout,
|
||||
@ -126,10 +134,27 @@ export const constantRoutes = [
|
||||
redirect: 'noredirect',
|
||||
children: [
|
||||
{
|
||||
path: 'details',
|
||||
path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus/:orderNumber',
|
||||
component: () => import('@/views/convenienceStore/purchase/details'),
|
||||
name: 'Profile',
|
||||
meta: { title: '盘点详情', icon: 'user' }
|
||||
name: 'purchase-details',
|
||||
props: true, // 启用路由参数作为组件的props
|
||||
meta: { title: '进货详情', icon: 'user' }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/returns',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
children: [
|
||||
{
|
||||
path: '/returns/details/:PreturnsId/:PorderDate/:PapprovalStatus/:orderNumber',
|
||||
component: () => import('@/views/convenienceStore/returns/details'),
|
||||
name: 'returns-details',
|
||||
props: true, // 启用路由参数作为组件的props
|
||||
meta: { title: '退货详情', icon: 'user' }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
@ -89,17 +89,17 @@
|
||||
<el-table-column label="当前库存" align="center" prop="stock"/>
|
||||
<el-table-column label="进货数量" align="center" prop="quantityPurchased">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number :disabled="false" v-model="scope.row.quantityPurchased" @change="change(scope.row,1)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
<el-input-number :disabled="numberInput" v-model="scope.row.quantityPurchased" @change="change(scope.row,1)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="进货单价" align="center" prop="unitPrice">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number :disabled="false" v-model="scope.row.unitPrice" @change="change(scope.row,2)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
<el-input-number :disabled="numberInput" v-model="scope.row.unitPrice" @change="change(scope.row,2)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计金额" align="center" prop="subtotalAmount">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number :disabled="false" v-model="scope.row.subtotalAmount" @change="change(scope.row,3)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
<el-input-number :disabled="numberInput" v-model="scope.row.subtotalAmount" @change="change(scope.row,3)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="state =='await' || state=='ysh'"label="操作" align="center" class-name="small-padding fixed-width">
|
||||
@ -228,7 +228,12 @@ import {
|
||||
|
||||
export default {
|
||||
name: "details",
|
||||
|
||||
props:[
|
||||
'PpurchaseId',
|
||||
'PorderNumber',
|
||||
'PorderDate',
|
||||
'PapprovalStatus'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
detailsList: [],
|
||||
@ -245,9 +250,9 @@ export default {
|
||||
isRecovery:0,
|
||||
},
|
||||
purchaseForm: {
|
||||
orderNumber: "",
|
||||
orderNumber: null,
|
||||
approvalStatus: "",
|
||||
orderDate: "",
|
||||
orderDate: null,
|
||||
totalAmount: 0, //总金额
|
||||
productQuantity: 0, //商品数量
|
||||
quantityPurchased: 0 //进货数量
|
||||
@ -299,9 +304,32 @@ export default {
|
||||
|
||||
async created() {
|
||||
|
||||
this.purchaseForm.purchaseId = this.$props.PpurchaseId
|
||||
this.purchaseId = this.$props.PpurchaseId
|
||||
this.purchaseForm.orderNumber = this.$props.PorderNumber
|
||||
this.purchaseForm.orderDate = this.$props.PorderDate
|
||||
this.purchaseForm.approvalStatus = this.$props.PapprovalStatus
|
||||
this.state = this.$props.PapprovalStatus
|
||||
|
||||
console.log("this.purchaseForm",this.purchaseForm)
|
||||
|
||||
if ( this.state == null) {
|
||||
this.state = 'await'
|
||||
}
|
||||
|
||||
if (this.state=='await') {
|
||||
this.numberInput = false
|
||||
}else {
|
||||
this.numberInput = true
|
||||
}
|
||||
|
||||
|
||||
if (this.purchaseForm.orderNumber == null) {
|
||||
this.refresh();
|
||||
}
|
||||
if (this.purchaseForm.orderDate == null) {
|
||||
this.purchaseForm.orderDate =new Date()
|
||||
}
|
||||
|
||||
this.getDetailsList();
|
||||
this.getQueryList();
|
||||
@ -312,13 +340,14 @@ export default {
|
||||
getPurchaseDetailsPageApi().then(res=>{
|
||||
this_.detailsList = res.data.records;
|
||||
this.total = res.data.total;
|
||||
|
||||
this.sumMethod(res.data.records);
|
||||
})
|
||||
},
|
||||
getCommodityList() {
|
||||
let this_ = this
|
||||
listLJGoods(this_.commodityForm).then(res=>{
|
||||
this_.commodityList = res.data.records;
|
||||
this_.sumMethod(res.data.records);
|
||||
// this.total = response.data.total;
|
||||
})
|
||||
},
|
||||
@ -355,12 +384,10 @@ export default {
|
||||
|
||||
if (flag == 3) {
|
||||
data.unitPrice = subtotalAmount.dividedBy(quantityPurchased);
|
||||
|
||||
}
|
||||
|
||||
// this.sumMethod(this.detailsList);
|
||||
|
||||
// this.sumMethod(this.orderList)
|
||||
this.sumMethod(this.detailsList);
|
||||
console.log("this.detailsList",this.detailsList)
|
||||
// 进行保存
|
||||
// this.detailsList = data
|
||||
// this.edit()
|
||||
@ -368,27 +395,26 @@ export default {
|
||||
|
||||
// 计算header数据
|
||||
sumMethod(data) {
|
||||
console.log("sumMethod",data)
|
||||
let this_ = this
|
||||
|
||||
this_.purchaseForm.totalAmount = data.length
|
||||
|
||||
this_.purchaseForm.productQuantity = new BigNumber(0),
|
||||
this_.purchaseForm.productQuantity = data.length,
|
||||
this_.purchaseForm.totalAmount = new BigNumber(0),
|
||||
this_.purchaseForm.quantityPurchased = new BigNumber(0),
|
||||
|
||||
data.forEach(da => {
|
||||
if (da.unitPrice != null) {
|
||||
this_.purchaseForm.productQuantity= this_.purchaseForm.productQuantity.plus(da.unitPrice)
|
||||
this_.purchaseForm.quantityPurchased= this_.purchaseForm.quantityPurchased.plus(da.quantityPurchased)
|
||||
}
|
||||
if (da.subtotalAmount != null) {
|
||||
this_.purchaseForm.quantityPurchased= this_.purchaseForm.quantityPurchased.plus(da.subtotalAmount)
|
||||
this_.purchaseForm.totalAmount= this_.purchaseForm.totalAmount.plus(da.subtotalAmount)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
addCommodity () {
|
||||
let this_ = this
|
||||
|
||||
console.log("this.multipleSelection",this.multipleSelection)
|
||||
this.multipleSelection.forEach(mul=>{
|
||||
let now = {
|
||||
goodsId: mul.id,
|
||||
@ -404,10 +430,8 @@ export default {
|
||||
this_.detailsList.push(now)
|
||||
})
|
||||
this_.open = false
|
||||
console.log("this.multipleSelection",this.multipleSelection)
|
||||
|
||||
this_.sumMethod(this_.detailsList);
|
||||
|
||||
},
|
||||
|
||||
// 查询搜索列表信息
|
||||
@ -470,12 +494,24 @@ export default {
|
||||
|
||||
async save(){
|
||||
let this_ = this
|
||||
// 保存之前进行判断
|
||||
if (this_.purchaseForm.orderNumber == null) {
|
||||
this.$modal.msgError("进货单号不能为空");
|
||||
return -1;
|
||||
}else if (this_.purchaseForm.orderDate == null) {
|
||||
this.$modal.msgError("进货时间不能为空");
|
||||
return -1;
|
||||
}else if(this_.detailsList.length<=0) {
|
||||
this.$modal.msgError("进货单不能为空");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this_.purchaseId == null) {
|
||||
// 新增
|
||||
await addPurchaseApi(this_.purchaseForm).then(res=>{
|
||||
this_.purchaseId = res.data.id
|
||||
}).catch(res=>{
|
||||
this.$modal.msgError("保存失败");
|
||||
return;
|
||||
})
|
||||
}else {
|
||||
@ -483,23 +519,28 @@ export default {
|
||||
this_.purchaseForm.id = this_.purchaseId
|
||||
await editPurchaseApi(this_.purchaseForm).then(res=> {
|
||||
}).catch(res=>{
|
||||
this.$modal.msgError("保存失败");
|
||||
return;
|
||||
})
|
||||
}
|
||||
// 批量保存订单
|
||||
console.log("::::::::::",this_.detailsList)
|
||||
this_.detailsList.fill(this_.purchaseId)
|
||||
console.log("**********",this_.detailsList)
|
||||
|
||||
this_.detailsList.forEach(data=>{
|
||||
data.purchaseId = this_.purchaseId
|
||||
})
|
||||
|
||||
await batchProcessingApi(this_.detailsList).then(res=>{
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
}).catch()
|
||||
this.goToAbout();
|
||||
}).catch(res=>{
|
||||
this.$modal.msgError("保存失败");
|
||||
})
|
||||
|
||||
},
|
||||
// 保存并审核
|
||||
audit(){
|
||||
// 保存
|
||||
let number = this.saveInventory();
|
||||
let number = this.save();
|
||||
if (number != -1) {
|
||||
// 审核
|
||||
let fil ={
|
||||
|
@ -5,27 +5,27 @@
|
||||
<el-form-item label="业务单号" prop="orderNumber">
|
||||
<el-input v-model="queryParams.orderNumber" placeholder="请输入业务单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" v-model="queryParams.status" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择供应商" style="width:100%">
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in dict.type.oilPurchasedStatus"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<el-form-item label="供应商" v-model="queryParams.supplierId" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.supplierId"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
style="width: 230px"
|
||||
>
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" v-model="queryParams.approvalStatus" prop="status">
|
||||
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" style="width:100%">
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in dict.type.oilPurchasedStatus"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" style="150px">
|
||||
<el-option
|
||||
v-for="dict in dict.type.oilPurchasedStatus"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期选择" prop="status">
|
||||
<!-- <el-form-item label="日期选择" prop="status">
|
||||
<el-date-picker
|
||||
v-model="queryParams.dateRange"
|
||||
type="datetimerange"
|
||||
@ -33,7 +33,7 @@
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
@ -58,22 +58,22 @@
|
||||
v-loading="loading"
|
||||
:data="purchaseList"
|
||||
:default-sort="defaultSort">
|
||||
<el-table-column label="业务单号" align="center" prop="inventoryNumber"/>
|
||||
<el-table-column label="业务单号" align="center" prop="inventoryNumber"/>
|
||||
<el-table-column label="业务单号" align="center" prop="inventoryNumber"/>
|
||||
<el-table-column label="业务单号" align="center" prop="inventoryNumber"/>
|
||||
<el-table-column label="业务单号" align="center" prop="orderNumber"/>
|
||||
<el-table-column label="供应商" align="center" prop="supplierName"/>
|
||||
<el-table-column label="商品数量" align="center" prop="productQuantity"/>
|
||||
<el-table-column label="单据金额" align="center" prop="totalAmount"/>
|
||||
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag v-if ="scope.row.status == 'await'" size="medium">待审核</el-tag>
|
||||
<el-tag v-if ="scope.row.status == 'qrts'" type="success" size="medium">已审核入库</el-tag>
|
||||
<el-tag v-if ="scope.row.status == 'yzf'" type="danger" size="medium">已作废</el-tag>
|
||||
<el-tag v-if ="scope.row.status == 'ysh'" type="danger" size="medium">已审核</el-tag>
|
||||
<el-tag v-if ="scope.row.approvalStatus == 'await'" size="medium">待审核</el-tag>
|
||||
<el-tag v-if ="scope.row.approvalStatus == 'qrts'" type="success" size="medium">已审核入库</el-tag>
|
||||
<el-tag v-if ="scope.row.approvalStatus == 'yzf'" type="danger" size="medium">已作废</el-tag>
|
||||
<el-tag v-if ="scope.row.approvalStatus == 'ysh'" type="danger" size="medium">已审核</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="制单人" align="center" prop="creatorName"/>
|
||||
<el-table-column label="制单人" align="center" prop="createByName"/>
|
||||
<el-table-column label="制单日期" align="center" prop="orderDate" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.orderDate) }}</span>
|
||||
@ -108,6 +108,8 @@
|
||||
|
||||
<script>
|
||||
import {delInventoryApi, getInventoryApi} from "@/api/oilConfig/oilInventory";
|
||||
import {getPurchasePageApi} from "@/api/convenienceStore/purchase";
|
||||
import {listSupplier} from "@/api/convenienceStore/supplier";
|
||||
|
||||
export default {
|
||||
name: "index",
|
||||
@ -116,6 +118,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
purchaseList:[],
|
||||
// 供应商列表
|
||||
supplierList:[],
|
||||
// 弹出框标题
|
||||
title:'',
|
||||
// 显示搜索条件
|
||||
@ -131,6 +135,7 @@ export default {
|
||||
orderNumber: "",
|
||||
approvalStatus: "",
|
||||
status: '',
|
||||
supplierId: '',
|
||||
dateRange: '',
|
||||
page: null,
|
||||
pageSize: null,
|
||||
@ -143,38 +148,52 @@ export default {
|
||||
|
||||
},
|
||||
async created() {
|
||||
// await this.getList();
|
||||
await this.getList();
|
||||
this.getQueryList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 获取列表
|
||||
getList(){
|
||||
// this.loading = true;
|
||||
// getInventoryApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
// this.inventoryList = response.data.records;
|
||||
// this.total = response.data.total;
|
||||
// })
|
||||
// this.loading = false;
|
||||
this.loading = true;
|
||||
getPurchasePageApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.purchaseList = response.data.records;
|
||||
this.total = response.data.total;
|
||||
})
|
||||
this.loading = false;
|
||||
},
|
||||
// 查询搜索列表信息
|
||||
getQueryList(){
|
||||
// selectTree().then(response => {
|
||||
// this.cvsGoodList = response.data.records
|
||||
// });
|
||||
listSupplier().then(response => {
|
||||
this.supplierList = response.data.records
|
||||
})
|
||||
},
|
||||
|
||||
detailsAdd() {
|
||||
this.$router.push('/purchase/details');
|
||||
this.$router.push({
|
||||
name:'purchase-details',
|
||||
});
|
||||
},
|
||||
// 处理单据
|
||||
dispose(data) {
|
||||
this.$router.push({
|
||||
path: '/purchase/details',
|
||||
name: 'purchase-details', // 将组件名称更改为避免冲突
|
||||
// params: {
|
||||
// inventoryId: data.id
|
||||
// },
|
||||
name: 'purchase-details',
|
||||
params: {
|
||||
PpurchaseId: data.id,
|
||||
PorderNumber: data.orderNumber,
|
||||
PorderDate: data.orderDate,
|
||||
PapprovalStatus: data.approvalStatus
|
||||
},
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
// 重置
|
||||
resetQuery() {
|
||||
|
||||
this.queryParams = {}
|
||||
},
|
||||
// 删除
|
||||
handleDel(data) {
|
||||
|
@ -334,6 +334,16 @@ export default {
|
||||
this.inventoryId = this.$route.query.inventoryId;
|
||||
|
||||
|
||||
this.$route.query.inventoryTime;
|
||||
|
||||
|
||||
|
||||
this.inventoryNo.inventoryDate = new Date(parseInt(this.$route.query.inventoryDate))
|
||||
|
||||
if (this.inventoryNo.inventoryDate == null) {
|
||||
this.inventoryNo.inventoryDate = new Date()
|
||||
}
|
||||
|
||||
if (this.inventoryNo.inventoryNo == null) {
|
||||
this.refresh();
|
||||
}
|
||||
|
@ -342,7 +342,6 @@ export default {
|
||||
if (this.$route.query.purchaseId != null) {
|
||||
this.queryParams.purchaseId = this.$route.query.purchaseId;
|
||||
this.purchaseId = this.$route.query.purchaseId;
|
||||
// this.purchaseForm.purchaseDate = this.$route.query.purchaseDate;
|
||||
}else if (this.$route.query.purchaseId == null && this.purchaseId>0) {
|
||||
|
||||
}else {
|
||||
@ -361,6 +360,19 @@ export default {
|
||||
}else {
|
||||
this.numberInput = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this.purchaseForm.purchaseDate = localDate;
|
||||
// console.log("this.purchaseForm.purchaseDate:", this.purchaseForm.purchaseDate);
|
||||
this.purchaseForm.purchaseDate = new Date(parseInt(this.$route.query.purchaseDate))
|
||||
|
||||
|
||||
if (this.purchaseForm.purchaseDate == null) {
|
||||
this.purchaseForm.purchaseDate = new Date()
|
||||
}
|
||||
|
||||
|
||||
this.purchaseForm.purchaseNo = this.$route.query.purchaseNo;
|
||||
|
||||
if (this.purchaseForm.purchaseNo == null) {
|
||||
|
@ -2,8 +2,10 @@ package com.fuint.business.convenienceSore.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.service.MtPurchaseService;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -42,6 +44,23 @@ public class MtPurchaseController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param mtPurchase 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("getListByPage")
|
||||
public ResponseObject getListByPage(MtPurchaseDto mtPurchase,
|
||||
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
|
||||
IPage<MtPurchaseVO> list = mtPurchaseService.getListByPage(page,mtPurchase);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
@ -50,8 +69,8 @@ public class MtPurchaseController extends BaseController {
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<MtPurchase> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.mtPurchaseService.queryById(id));
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.mtPurchaseService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,8 +80,8 @@ public class MtPurchaseController extends BaseController {
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<MtPurchase> add(MtPurchase mtPurchase) {
|
||||
return ResponseEntity.ok(this.mtPurchaseService.insert(mtPurchase));
|
||||
public ResponseObject add(@RequestBody MtPurchase mtPurchase) {
|
||||
return getSuccessResult(this.mtPurchaseService.insert(mtPurchase));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,8 +91,8 @@ public class MtPurchaseController extends BaseController {
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<MtPurchase> edit(MtPurchase mtPurchase) {
|
||||
return ResponseEntity.ok(this.mtPurchaseService.update(mtPurchase));
|
||||
public ResponseObject edit(@RequestBody MtPurchase mtPurchase) {
|
||||
return getSuccessResult(this.mtPurchaseService.update(mtPurchase));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,9 +102,31 @@ public class MtPurchaseController extends BaseController {
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.mtPurchaseService.deleteById(id));
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.mtPurchaseService.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 盘点审核
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("audit")
|
||||
public ResponseObject audit(Integer id) {
|
||||
return getSuccessResult(this.mtPurchaseService.audit(id));
|
||||
}
|
||||
|
||||
@GetMapping("abolition")
|
||||
public ResponseObject abolition(Integer id) {
|
||||
return getSuccessResult(this.mtPurchaseService.abolition(id));
|
||||
}
|
||||
|
||||
@GetMapping("storage")
|
||||
public ResponseObject storage(Integer id) {
|
||||
return getSuccessResult(this.mtPurchaseService.storage(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class MtPurchaseDetailsController extends BaseController {
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("batchProcessing")
|
||||
public ResponseObject batchProcessing(List<MtPurchaseDetails> mtPurchaseDetails) {
|
||||
public ResponseObject batchProcessing(@RequestBody List<MtPurchaseDetails> mtPurchaseDetails) {
|
||||
return getSuccessResult(this.mtPurchaseDetailsService.batchProcessing(mtPurchaseDetails));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,118 @@
|
||||
package com.fuint.business.convenienceSore.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.business.convenienceSore.dto.MtReturnsDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturns;
|
||||
import com.fuint.business.convenienceSore.service.MtReturnsService;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseDetailsVO;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsVO;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 退货表(MtReturns)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/convenience/mtReturns")
|
||||
public class MtReturnsController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private MtReturnsService mtReturnsService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param mtReturns 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/getListByPage")
|
||||
public ResponseObject getListByPage(MtReturnsDto mtReturns,
|
||||
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
|
||||
IPage<MtReturnsVO> list = mtReturnsService.queryByPage(page,mtReturns);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.mtReturnsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturns 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@RequestBody MtReturns mtReturns) {
|
||||
return getSuccessResult(this.mtReturnsService.insert(mtReturns));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param mtReturns 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@RequestBody MtReturns mtReturns) {
|
||||
return getSuccessResult(this.mtReturnsService.update(mtReturns));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.mtReturnsService.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 盘点审核
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("audit")
|
||||
public ResponseObject audit(Integer id) {
|
||||
return getSuccessResult(this.mtReturnsService.audit(id));
|
||||
}
|
||||
|
||||
@GetMapping("abolition")
|
||||
public ResponseObject abolition(Integer id) {
|
||||
return getSuccessResult(this.mtReturnsService.abolition(id));
|
||||
}
|
||||
|
||||
@GetMapping("storage")
|
||||
public ResponseObject storage(Integer id) {
|
||||
return getSuccessResult(this.mtReturnsService.storage(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
package com.fuint.business.convenienceSore.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturnsDetails;
|
||||
import com.fuint.business.convenienceSore.service.MtReturnsDetailsService;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsDetailsVO;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退货详情表(MtReturnsDetails)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/convenience/mtReturnsDetails")
|
||||
public class MtReturnsDetailsController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private MtReturnsDetailsService mtReturnsDetailsService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param mtReturnsDetails 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/queryByPage")
|
||||
public ResponseObject queryByPage(MtReturnsDetails mtReturnsDetails,
|
||||
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
|
||||
IPage<MtReturnsDetails> list = mtReturnsDetailsService.queryByPage(page,mtReturnsDetails);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getListByPage")
|
||||
public ResponseObject getListByPage(MtReturnsDetails mtReturnsDetails,
|
||||
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
|
||||
IPage<MtReturnsDetailsVO> list = mtReturnsDetailsService.getListByPage(page,mtReturnsDetails);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<MtReturnsDetails> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.mtReturnsDetailsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturnsDetails 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<MtReturnsDetails> add(@RequestParam MtReturnsDetails mtReturnsDetails) {
|
||||
return ResponseEntity.ok(this.mtReturnsDetailsService.insert(mtReturnsDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理数据
|
||||
*
|
||||
* @param mtReturnsDetails 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("batchProcessing")
|
||||
public ResponseObject batchProcessing(@RequestBody List<MtReturnsDetails> mtReturnsDetails) {
|
||||
return getSuccessResult(this.mtReturnsDetailsService.batchProcessing(mtReturnsDetails));
|
||||
}
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param mtReturnsDetails 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<MtReturnsDetails> edit(@RequestParam MtReturnsDetails mtReturnsDetails) {
|
||||
return ResponseEntity.ok(this.mtReturnsDetailsService.update(mtReturnsDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.mtReturnsDetailsService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.business.convenienceSore.dto;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MtPurchaseDto extends MtPurchase {
|
||||
private Integer supplierId;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.fuint.business.convenienceSore.dto;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MtReturnsDto extends MtPurchase {
|
||||
private Integer supplierId;
|
||||
|
||||
}
|
@ -35,6 +35,7 @@ public class MtPurchase extends BaseEntity {
|
||||
* 审核人
|
||||
*/
|
||||
private String approver;
|
||||
private String status;
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.fuint.business.convenienceSore.entity;
|
||||
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 退货表(MtReturns)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:17
|
||||
*/
|
||||
@Data
|
||||
public class MtReturns extends BaseEntity {
|
||||
private static final long serialVersionUID = -99640955686348499L;
|
||||
/**
|
||||
* 退货ID(主键)
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 业务单号
|
||||
*/
|
||||
private String orderNumber;
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String approvalStatus;
|
||||
/**
|
||||
* 制单日期
|
||||
*/
|
||||
private Date orderDate;
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private String approver;
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private Double totalAmount;
|
||||
/**
|
||||
* 产品数量
|
||||
*/
|
||||
private Double productQuantity;
|
||||
/**
|
||||
* 退货数量
|
||||
*/
|
||||
private Integer returnQuantity;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.fuint.business.convenienceSore.entity;
|
||||
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 进货详情表(MtReturnsDetails)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:44
|
||||
*/
|
||||
@Data
|
||||
public class MtReturnsDetails extends BaseEntity {
|
||||
private static final long serialVersionUID = -17740830916333375L;
|
||||
/**
|
||||
* 退货详情ID(主键)
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 关联商品ID
|
||||
*/
|
||||
private Integer goodsId;
|
||||
/**
|
||||
* 关联商品ID
|
||||
*/
|
||||
private Integer returnsId;
|
||||
/**
|
||||
* 退货数量
|
||||
*/
|
||||
private Integer returnQuantity;
|
||||
/**
|
||||
* 退货单价
|
||||
*/
|
||||
private Double returnPrice;
|
||||
/**
|
||||
* 小计金额
|
||||
*/
|
||||
private Double subtotalAmount;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 入库前库存
|
||||
*/
|
||||
private Integer preInboundInventory;
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package com.fuint.business.convenienceSore.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
@ -32,6 +35,11 @@ public interface MtPurchaseMapper {
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<MtPurchase> queryAllByLimit(Page page, @Param("mtPurchase") MtPurchase mtPurchase);
|
||||
|
||||
IPage<MtPurchaseVO> getListByPage(Page page, @Param("mtPurchase") MtPurchaseDto mtPurchase);
|
||||
|
||||
|
||||
List<MtPurchaseVO> getPurcaseList(@Param("pId") Integer pId);
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
@ -81,5 +89,7 @@ public interface MtPurchaseMapper {
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
int editStateById(Integer id,String status);
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.fuint.business.convenienceSore.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturnsDetails;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseDetailsVO;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsDetailsVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进货详情表(MtReturnsDetails)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:44
|
||||
*/
|
||||
public interface MtReturnsDetailsMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturnsDetails queryById(Integer purchaseDetailId);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param mtReturnsDetails 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<MtReturnsDetails> queryAllByLimit(Page page, @Param("mtReturnsDetails") MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
IPage<MtReturnsDetailsVO> getListByPage(Page page, @Param("mtReturnsDetails") MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param mtReturnsDetails 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<MtReturnsDetails> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<MtReturnsDetails> entities);
|
||||
|
||||
int editBatch(@Param("list") List<MtReturnsDetails> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<MtReturnsDetails> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<MtReturnsDetails> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer purchaseDetailId);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
package com.fuint.business.convenienceSore.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
|
||||
import com.fuint.business.convenienceSore.dto.MtReturnsDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturns;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退货表(MtReturns)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:17
|
||||
*/
|
||||
public interface MtReturnsMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturns queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param mtReturns 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<MtReturns> queryAllByLimit(Page page, @Param("mtReturns") MtReturns mtReturns);
|
||||
|
||||
IPage<MtReturnsVO> getListByPage(Page page, @Param("mtReturns") MtReturnsDto mtPurchase);
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param mtReturns 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(MtReturns mtReturns);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(MtReturns mtReturns);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<MtReturns> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<MtReturns> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<MtReturns> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<MtReturns> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(MtReturns mtReturns);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
@ -154,7 +154,7 @@
|
||||
insert into mt_purchase_details(goods_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.goodsId}, #{entity.purchaseId}, #{entity.quantityPurchased}, #{entity.unitPrice}, #{entity.subtotalAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
(#{entity.goodsId}, #{entity.purchaseId}, #{entity.quantityPurchased}, #{entity.unitPrice}, #{entity.subtotalAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -120,11 +120,55 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtPurchaseVO">
|
||||
SELECT
|
||||
mp.id id,
|
||||
mp.order_number orderNumber,
|
||||
mp.total_amount totalAmount,
|
||||
mp.quantity_purchased quantityPurchased,
|
||||
mp.product_quantity productQuantity,
|
||||
mp.approval_status approvalStatus,
|
||||
mp.order_date orderDate,
|
||||
ms1.real_name createByName,
|
||||
ms2.real_name approverName,
|
||||
mp.create_time createTime
|
||||
FROM
|
||||
mt_purchase mp
|
||||
LEFT JOIN mt_purchase_details mpd ON mp.id = mpd.purchase_id
|
||||
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
|
||||
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
|
||||
<where>
|
||||
<if test="mtPurchase.approvalStatus != null and mtPurchase.approvalStatus != ''">
|
||||
and approval_status = #{mtPurchase.approvalStatus}
|
||||
</if>
|
||||
<if test="mtPurchase.orderNumber != null and mtPurchase.orderNumber != ''">
|
||||
and order_number LIKE CONCAT('%', #{mtPurchase.orderNumber}, '%')
|
||||
</if>
|
||||
<if test="mtPurchase.storeId != null">
|
||||
and mp.store_id = #{mtPurchase.storeId}
|
||||
</if>
|
||||
<if test="mtPurchase.supplierId != null">
|
||||
and mp.store_id = #{mtPurchase.storeId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
mp.id
|
||||
</select>
|
||||
<select id="getPurcaseList" resultType="com.fuint.business.convenienceSore.vo.MtPurchaseVO">
|
||||
|
||||
select
|
||||
mpd.id detailsId,
|
||||
s.id supplierId,
|
||||
s.name supplierName
|
||||
from mt_purchase_details mpd
|
||||
left join mt_goods mg ON mg.id = mpd.goods_id
|
||||
left join supplier s ON mg.supplier_id = s.id
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_purchase(order_number, approval_status, order_date, approver, total_amount, product_quantity, quantity_purchased, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{totalAmount}, #{productQuantity}, #{quantityPurchased}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{totalAmount}, #{productQuantity}, #{quantityPurchased}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
@ -196,9 +240,16 @@
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="editStateById">
|
||||
update mt_purchase
|
||||
set approval_status = #{status}
|
||||
where id = #{id}
|
||||
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
|
@ -0,0 +1,260 @@
|
||||
<?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.fuint.business.convenienceSore.mapper.MtReturnsDetailsMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.convenienceSore.entity.MtReturnsDetails" id="MtReturnsDetailsMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="goodsId" column="goods_id" jdbcType="INTEGER"/>
|
||||
<result property="returnsId" column="returns_id" jdbcType="INTEGER"/>
|
||||
<result property="returnQuantity" column="return_quantity" jdbcType="INTEGER"/>
|
||||
<result property="returnPrice" column="return_price" jdbcType="NUMERIC"/>
|
||||
<result property="subtotalAmount" column="subtotal_amount" jdbcType="NUMERIC"/>
|
||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||
<result property="preInboundInventory" column="pre_inbound_inventory" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="MtReturnsDetailsMap">
|
||||
select
|
||||
id, goods_id, returns_id, return_quantity, return_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by
|
||||
from mt_returns_details
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="MtReturnsDetailsMap">
|
||||
select
|
||||
id, goods_id, returns_id, return_quantity, return_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by
|
||||
from mt_returns_details
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="goodsId != null">
|
||||
and goods_id = #{goodsId}
|
||||
</if>
|
||||
<if test="returnsId != null">
|
||||
and returns_id = #{returnsId}
|
||||
</if>
|
||||
<if test="returnQuantity != null">
|
||||
and return_quantity = #{returnQuantity}
|
||||
</if>
|
||||
<if test="returnPrice != null">
|
||||
and return_price = #{returnPrice}
|
||||
</if>
|
||||
<if test="subtotalAmount != null">
|
||||
and subtotal_amount = #{subtotalAmount}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from mt_returns_details
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="goodsId != null">
|
||||
and goods_id = #{goodsId}
|
||||
</if>
|
||||
<if test="returnsId != null">
|
||||
and returns_id = #{returnsId}
|
||||
</if>
|
||||
<if test="returnQuantity != null">
|
||||
and return_quantity = #{returnQuantity}
|
||||
</if>
|
||||
<if test="returnPrice != null">
|
||||
and return_price = #{returnPrice}
|
||||
</if>
|
||||
<if test="subtotalAmount != null">
|
||||
and subtotal_amount = #{subtotalAmount}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtReturnsDetailsVO">
|
||||
select
|
||||
md.id id,
|
||||
md.return_quantity returnQuantity,
|
||||
md.return_price returnPrice,
|
||||
md.subtotal_amount subtotalAmount,
|
||||
mg.name commodityName,
|
||||
mg.cvs_good_id cvsGoodId,
|
||||
mg.unit unit,
|
||||
mg.supplier_id supplierId,
|
||||
mg.id goodsId,
|
||||
mg.stock stock
|
||||
from mt_returns_details md
|
||||
left join mt_goods mg ON md.goods_id = mg.id
|
||||
<where>
|
||||
<if test="mtReturnsDetails.goodsId != null">
|
||||
and goods_id = #{mtReturnsDetails.goodsId}
|
||||
</if>
|
||||
<if test="mtReturnsDetails.returnsId != null">
|
||||
and returns_id = #{mtReturnsDetails.returnsId}
|
||||
</if>
|
||||
<if test="mtReturnsDetails.returnQuantity != null">
|
||||
and return_quantity = #{mtReturnsDetails.returnQuantity}
|
||||
</if>
|
||||
<if test="mtReturnsDetails.returnPrice != null">
|
||||
and return_price = #{mtReturnsDetails.returnPrice}
|
||||
</if>
|
||||
<if test="mtReturnsDetails.subtotalAmount != null">
|
||||
and subtotal_amount = #{mtReturnsDetails.subtotalAmount}
|
||||
</if>
|
||||
<if test="mtReturnsDetails.storeId != null">
|
||||
and md.store_id = #{mtReturnsDetails.storeId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns_details(goods_id, returns_id, return_quantity, return_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{goodsId}, #{returnsId}, #{returnQuantity}, #{returnPrice}, #{subtotalAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns_details(goods_id, returns_id, return_quantity, return_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by, pre_inbound_inventory)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.goodsId}, #{entity.returnsId}, #{entity.returnQuantity}, #{entity.returnPrice}, #{entity.subtotalAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy}, #{preInboundInventory})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns_details(goods_id, returns_id, return_quantity, return_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.goodsId}, #{entity.returnsId}, #{entity.returnQuantity}, #{entity.returnPrice}, #{entity.subtotalAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
goods_id = values(goods_id),
|
||||
returns_id = values(returns_id),
|
||||
return_quantity = values(return_quantity),
|
||||
return_price = values(return_price),
|
||||
subtotal_amount = values(subtotal_amount),
|
||||
store_id = values(store_id),
|
||||
create_time = values(create_time),
|
||||
update_time = values(update_time),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update mt_returns_details
|
||||
<set>
|
||||
<if test="goodsId != null">
|
||||
goods_id = #{goodsId},
|
||||
</if>
|
||||
<if test="returnsId != null">
|
||||
returns_id = #{returnsId},
|
||||
</if>
|
||||
<if test="returnQuantity != null">
|
||||
return_quantity = #{returnQuantity},
|
||||
</if>
|
||||
<if test="returnPrice != null">
|
||||
return_price = #{returnPrice},
|
||||
</if>
|
||||
<if test="subtotalAmount != null">
|
||||
subtotal_amount = #{subtotalAmount},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="editBatch">
|
||||
<foreach collection="list" item="user" separator=";">
|
||||
update mt_returns_details
|
||||
<set>
|
||||
<if test="user.goodsId != null">
|
||||
goods_id = #{user.goodsId},
|
||||
</if>
|
||||
<if test="user.returnsId != null">
|
||||
returns_id = #{user.returnsId},
|
||||
</if>
|
||||
<if test="user.returnQuantity != null">
|
||||
return_quantity = #{user.returnQuantity},
|
||||
</if>
|
||||
<if test="user.returnPrice != null">
|
||||
return_price = #{user.returnPrice},
|
||||
</if>
|
||||
<if test="user.subtotalAmount != null">
|
||||
subtotal_amount = #{user.subtotalAmount},
|
||||
</if>
|
||||
<if test="user.storeId != null">
|
||||
store_id = #{user.storeId},
|
||||
</if>
|
||||
<if test="user.createBy != null">
|
||||
create_by = #{user.createBy},
|
||||
</if>
|
||||
<if test="user.updateBy != null">
|
||||
update_by = #{user.updateBy},
|
||||
</if>
|
||||
<if test="user.preInboundInventory != null">
|
||||
pre_inbound_inventory = #{user.preInboundInventory},
|
||||
</if>
|
||||
update_time = NOW()
|
||||
</set>
|
||||
where id = #{user.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from mt_returns_details where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,243 @@
|
||||
<?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.fuint.business.convenienceSore.mapper.MtReturnsMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.convenienceSore.entity.MtReturns" id="MtReturnsMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="orderNumber" column="order_number" jdbcType="VARCHAR"/>
|
||||
<result property="approvalStatus" column="approval_status" jdbcType="VARCHAR"/>
|
||||
<result property="orderDate" column="order_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="approver" column="approver" jdbcType="VARCHAR"/>
|
||||
<result property="totalAmount" column="total_amount" jdbcType="NUMERIC"/>
|
||||
<result property="productQuantity" column="product_quantity" jdbcType="NUMERIC"/>
|
||||
<result property="returnQuantity" column="return_quantity" jdbcType="INTEGER"/>
|
||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="MtReturnsMap">
|
||||
select
|
||||
id, order_number, approval_status, order_date, approver, total_amount, product_quantity, return_quantity, store_id, create_time, update_time, create_by, update_by
|
||||
from mt_returns
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="MtReturnsMap">
|
||||
select
|
||||
id, order_number, approval_status, order_date, approver, total_amount, product_quantity, return_quantity, store_id, create_time, update_time, create_by, update_by
|
||||
from mt_returns
|
||||
<where>
|
||||
<if test="mtReturns.id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="mtReturns.orderNumber != null and mtReturns.orderNumber != ''">
|
||||
and order_number = #{mtReturns.orderNumber}
|
||||
</if>
|
||||
<if test="mtReturns.approvalStatus != null and mtReturns.approvalStatus != ''">
|
||||
and approval_status = #{mtReturns.approvalStatus}
|
||||
</if>
|
||||
<if test="mtReturns.orderDate != null">
|
||||
and order_date = #{mtReturns.orderDate}
|
||||
</if>
|
||||
<if test="mtReturns.approver != null and mtReturns.approver != ''">
|
||||
and approver = #{approver}
|
||||
</if>
|
||||
<if test="mtReturns.totalAmount != null">
|
||||
and total_amount = #{mtReturns.totalAmount}
|
||||
</if>
|
||||
<if test="mtReturns.productQuantity != null">
|
||||
and product_quantity = #{mtReturns.productQuantity}
|
||||
</if>
|
||||
<if test="mtReturns.returnQuantity != null">
|
||||
and return_quantity = #{mtReturns.returnQuantity}
|
||||
</if>
|
||||
<if test="mtReturns.storeId != null">
|
||||
and store_id = #{mtReturns.storeId}
|
||||
</if>
|
||||
<if test="mtReturns.createTime != null">
|
||||
and create_time = #{mtReturns.createTime}
|
||||
</if>
|
||||
<if test="mtReturns.updateTime != null">
|
||||
and update_time = #{mtReturns.updateTime}
|
||||
</if>
|
||||
<if test="mtReturns.createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="mtReturns.updateBy != null">
|
||||
and update_by = #{mtReturns.updateBy}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from mt_returns
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="orderNumber != null and orderNumber != ''">
|
||||
and order_number = #{orderNumber}
|
||||
</if>
|
||||
<if test="approvalStatus != null and approvalStatus != ''">
|
||||
and approval_status = #{approvalStatus}
|
||||
</if>
|
||||
<if test="orderDate != null">
|
||||
and order_date = #{orderDate}
|
||||
</if>
|
||||
<if test="approver != null and approver != ''">
|
||||
and approver = #{approver}
|
||||
</if>
|
||||
<if test="totalAmount != null">
|
||||
and total_amount = #{totalAmount}
|
||||
</if>
|
||||
<if test="productQuantity != null">
|
||||
and product_quantity = #{productQuantity}
|
||||
</if>
|
||||
<if test="returnQuantity != null">
|
||||
and return_quantity = #{returnQuantity}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtReturnsVO">
|
||||
SELECT
|
||||
mp.id id,
|
||||
mp.order_number orderNumber,
|
||||
mp.total_amount totalAmount,
|
||||
mp.product_quantity productQuantity,
|
||||
mp.return_quantity returnQuantity,
|
||||
mp.approval_status approvalStatus,
|
||||
mp.order_date orderDate,
|
||||
ms1.real_name createByName,
|
||||
ms2.real_name approverName,
|
||||
mp.create_time createTime
|
||||
FROM
|
||||
mt_returns mp
|
||||
LEFT JOIN mt_returns_details mpd ON mp.id = mpd.returns_id
|
||||
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
|
||||
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
|
||||
<where>
|
||||
<if test="mtReturns.approvalStatus != null and mtReturns.approvalStatus != ''">
|
||||
and approval_status = #{mtReturns.approvalStatus}
|
||||
</if>
|
||||
<if test="mtReturns.orderNumber != null and mtReturns.orderNumber != ''">
|
||||
and order_number LIKE CONCAT('%', #{mtReturns.orderNumber}, '%')
|
||||
</if>
|
||||
<if test="mtReturns.storeId != null">
|
||||
and mp.store_id = #{mtReturns.storeId}
|
||||
</if>
|
||||
<if test="mtReturns.supplierId != null">
|
||||
and mp.store_id = #{mtReturns.storeId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
mp.id
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns(order_number, approval_status, order_date, approver, total_amount, product_quantity, return_quantity, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{totalAmount}, #{productQuantity}, #{returnQuantity}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns(order_number, approval_status, order_date, approver, total_amount, product_quantity, return_quantity, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.orderNumber}, #{entity.approvalStatus}, #{entity.orderDate}, #{entity.approver}, #{entity.totalAmount}, #{entity.productQuantity}, #{entity.returnQuantity}, #{entity.storeId}, #{entity.createTime}, NOW(), #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into mt_returns(order_number, approval_status, order_date, approver, total_amount, product_quantity, return_quantity, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.orderNumber}, #{entity.approvalStatus}, #{entity.orderDate}, #{entity.approver}, #{entity.totalAmount}, #{entity.productQuantity}, #{entity.returnQuantity}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
order_number = values(order_number),
|
||||
approval_status = values(approval_status),
|
||||
order_date = values(order_date),
|
||||
approver = values(approver),
|
||||
total_amount = values(total_amount),
|
||||
product_quantity = values(product_quantity),
|
||||
return_quantity = values(return_quantity),
|
||||
store_id = values(store_id),
|
||||
create_time = values(create_time),
|
||||
update_time = values(update_time),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update mt_returns
|
||||
<set>
|
||||
<if test="orderNumber != null and orderNumber != ''">
|
||||
order_number = #{orderNumber},
|
||||
</if>
|
||||
<if test="approvalStatus != null and approvalStatus != ''">
|
||||
approval_status = #{approvalStatus},
|
||||
</if>
|
||||
<if test="orderDate != null">
|
||||
order_date = #{orderDate},
|
||||
</if>
|
||||
<if test="approver != null and approver != ''">
|
||||
approver = #{approver},
|
||||
</if>
|
||||
<if test="totalAmount != null">
|
||||
total_amount = #{totalAmount},
|
||||
</if>
|
||||
<if test="productQuantity != null">
|
||||
product_quantity = #{productQuantity},
|
||||
</if>
|
||||
<if test="returnQuantity != null">
|
||||
return_quantity = #{returnQuantity},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from mt_returns where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -2,7 +2,9 @@ package com.fuint.business.convenienceSore.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
|
||||
/**
|
||||
* 商品进货表(MtPurchase)表服务接口
|
||||
@ -29,6 +31,8 @@ public interface MtPurchaseService {
|
||||
*/
|
||||
IPage<MtPurchase> queryByPage(Page page, MtPurchase mtPurchase);
|
||||
|
||||
IPage<MtPurchaseVO> getListByPage(Page page, MtPurchaseDto mtPurchase);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
@ -53,4 +57,8 @@ public interface MtPurchaseService {
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
boolean audit(Integer id);
|
||||
boolean abolition(Integer id);
|
||||
boolean storage(Integer id);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.fuint.business.convenienceSore.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturnsDetails;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsDetailsVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进货详情表(MtReturnsDetails)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:44
|
||||
*/
|
||||
public interface MtReturnsDetailsService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturnsDetails queryById(Integer purchaseDetailId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param mtReturnsDetails 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<MtReturnsDetails> queryByPage(Page page, MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
IPage<MtReturnsDetailsVO> getListByPage(Page page, MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturnsDetails insert(MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturnsDetails update(MtReturnsDetails mtReturnsDetails);
|
||||
|
||||
boolean batchProcessing(List<MtReturnsDetails> mtReturnsDetails);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer purchaseDetailId);
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.fuint.business.convenienceSore.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.MtReturnsDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturns;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsVO;
|
||||
|
||||
/**
|
||||
* 退货表(MtReturns)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:17
|
||||
*/
|
||||
public interface MtReturnsService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturns queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param mtReturns 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<MtReturnsVO> queryByPage(Page page, MtReturnsDto mtReturns);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturns insert(MtReturns mtReturns);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
MtReturns update(MtReturns mtReturns);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
boolean audit(Integer id);
|
||||
boolean abolition(Integer id);
|
||||
boolean storage(Integer id);
|
||||
|
||||
}
|
@ -62,7 +62,6 @@ public class MtPurchaseDetailsServiceImpl implements MtPurchaseDetailsService {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
mtPurchaseDetails.setStoreId(storeId);
|
||||
|
||||
IPage<MtPurchaseDetailsVO> mtPurchaseIPage = mtPurchaseDetailsDao.getListByPage(page, mtPurchaseDetails);
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
@ -80,24 +79,37 @@ public class MtPurchaseDetailsServiceImpl implements MtPurchaseDetailsService {
|
||||
return mtPurchaseDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理
|
||||
* @param mtPurchaseDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean batchProcessing(List<MtPurchaseDetails> mtPurchaseDetails) {
|
||||
List<MtPurchaseDetails> mtPurchaseDetailsIns = new ArrayList<>();
|
||||
List<MtPurchaseDetails> mtPurchaseDetailsEdit = new ArrayList<>();
|
||||
for (MtPurchaseDetails mtPurchaseDetail : mtPurchaseDetails) {
|
||||
if (mtPurchaseDetail.getId() != null) {
|
||||
mtPurchaseDetailsEdit.add(mtPurchaseDetail);
|
||||
}else {
|
||||
mtPurchaseDetailsIns.add(mtPurchaseDetail);
|
||||
|
||||
AccountInfo accountInfoByToken = TokenUtil.getNowAccountInfo();
|
||||
|
||||
if (mtPurchaseDetails.size() > 0) {
|
||||
for (MtPurchaseDetails mtPurchaseDetail : mtPurchaseDetails) {
|
||||
mtPurchaseDetail.setStoreId(accountInfoByToken.getStoreId());
|
||||
mtPurchaseDetail.setCreateBy(accountInfoByToken.getStaffId().toString());
|
||||
if (mtPurchaseDetail.getId() != null) {
|
||||
mtPurchaseDetailsEdit.add(mtPurchaseDetail);
|
||||
}else {
|
||||
mtPurchaseDetailsIns.add(mtPurchaseDetail);
|
||||
}
|
||||
}
|
||||
if (mtPurchaseDetailsIns.size()>0) {
|
||||
mtPurchaseDetailsDao.insertBatch(mtPurchaseDetailsIns);
|
||||
}
|
||||
if (mtPurchaseDetailsEdit.size()>0) {
|
||||
mtPurchaseDetailsDao.editBatch(mtPurchaseDetailsEdit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (mtPurchaseDetailsIns.size()>0) {
|
||||
mtPurchaseDetailsDao.insertBatch(mtPurchaseDetailsIns);
|
||||
}
|
||||
if (mtPurchaseDetailsEdit.size()>0) {
|
||||
mtPurchaseDetailsDao.editBatch(mtPurchaseDetailsEdit);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,29 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.Supplier;
|
||||
import com.fuint.business.convenienceSore.mapper.MtPurchaseDetailsMapper;
|
||||
import com.fuint.business.convenienceSore.mapper.MtPurchaseMapper;
|
||||
import com.fuint.business.convenienceSore.service.MtPurchaseService;
|
||||
import com.fuint.business.convenienceSore.service.SupplierService;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTracking;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品进货表(MtPurchase)表服务实现类
|
||||
@ -20,6 +35,13 @@ import javax.annotation.Resource;
|
||||
public class MtPurchaseServiceImpl implements MtPurchaseService {
|
||||
@Resource
|
||||
private MtPurchaseMapper mtPurchaseDao;
|
||||
@Resource
|
||||
private MtPurchaseDetailsMapper detailsMapper;
|
||||
@Resource
|
||||
private SupplierService supplierService;
|
||||
@Resource
|
||||
private ILJStaffService iljStaffService;
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
@ -47,7 +69,39 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
|
||||
IPage<MtPurchase> mtPurchaseIPage = mtPurchaseDao.queryAllByLimit(page, mtPurchase);
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
@Override
|
||||
public IPage<MtPurchaseVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtPurchaseDto mtPurchase) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
mtPurchase.setStoreId(nowAccountInfo.getStoreId());
|
||||
IPage<MtPurchaseVO> mtPurchaseIPage = mtPurchaseDao.getListByPage(page, mtPurchase);
|
||||
|
||||
for (MtPurchaseVO record : mtPurchaseIPage.getRecords()) {
|
||||
// 根据订单查询所有的供应商信息
|
||||
List<MtPurchaseVO> purcaseList = mtPurchaseDao.getPurcaseList(record.getId());
|
||||
record.setSupplierName(assemblyData(purcaseList));
|
||||
}
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
|
||||
|
||||
private String assemblyData(List<MtPurchaseVO> purcaseList) {
|
||||
if (purcaseList.size()>0) {
|
||||
int index = 0;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (MtPurchaseVO mtPurchaseVO : purcaseList) {
|
||||
if (!stringBuilder.toString().contains(mtPurchaseVO.getSupplierName())) {
|
||||
if (index == 0) {
|
||||
stringBuilder.append(mtPurchaseVO.getSupplierName());
|
||||
}else {
|
||||
stringBuilder.append("/").append(mtPurchaseVO.getSupplierName());
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
return "-";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
@ -57,6 +111,10 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
|
||||
*/
|
||||
@Override
|
||||
public MtPurchase insert(MtPurchase mtPurchase) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
mtPurchase.setStoreId(nowAccountInfo.getStoreId());
|
||||
mtPurchase.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||
mtPurchase.setApprovalStatus("await");
|
||||
this.mtPurchaseDao.insert(mtPurchase);
|
||||
return mtPurchase;
|
||||
}
|
||||
@ -69,6 +127,8 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
|
||||
*/
|
||||
@Override
|
||||
public MtPurchase update(MtPurchase mtPurchase) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// mtPurchase.up
|
||||
this.mtPurchaseDao.update(mtPurchase);
|
||||
return this.queryById(mtPurchase.getId());
|
||||
}
|
||||
@ -83,4 +143,69 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.mtPurchaseDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean audit(Integer id) {
|
||||
String oilIntake = "进货审核";
|
||||
int audit = iljStaffService.auditPrem(oilIntake);
|
||||
if (audit>0) {
|
||||
// 根据id修改状态
|
||||
String status = "ysh";
|
||||
mtPurchaseDao.editStateById(id,status);
|
||||
// 增加审核人
|
||||
boolean edit = edit(id);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean abolition(Integer id) {
|
||||
String oilIntake = "进货废止";
|
||||
int audit = iljStaffService.auditPrem(oilIntake);
|
||||
if (audit>0) {
|
||||
String status = "yzf";
|
||||
mtPurchaseDao.editStateById(id,status);
|
||||
boolean edit = edit(id);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean storage(Integer id) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
String oilIntake = "进货入库";
|
||||
int audit = iljStaffService.auditPrem(oilIntake);
|
||||
if (audit>0) {
|
||||
// 1.查询所有的数据
|
||||
MtPurchaseDetails mtPurchaseDetails = new MtPurchaseDetails();
|
||||
mtPurchaseDetails.setPurchaseId(id);
|
||||
// List<OilInventoryOrderVO> allList = detailsMapper.getAllList2(mtPurchaseDetails);
|
||||
// 2.将数据填充到油罐里面
|
||||
String status = "qrts";
|
||||
|
||||
boolean edit = edit(id);
|
||||
int i = mtPurchaseDao.editStateById(id, status);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 修改审核人
|
||||
public boolean edit(Integer id){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
|
||||
MtPurchase mtPurchase = new MtPurchase();
|
||||
mtPurchase.setApprover(nowAccountInfo.getStaffId().toString());
|
||||
mtPurchase.setId(id);
|
||||
int update = mtPurchaseDao.update(mtPurchase);
|
||||
return update>0;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,133 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturnsDetails;
|
||||
import com.fuint.business.convenienceSore.mapper.MtReturnsDetailsMapper;
|
||||
import com.fuint.business.convenienceSore.service.MtReturnsDetailsService;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseDetailsVO;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsDetailsVO;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进货详情表(MtReturnsDetails)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:44
|
||||
*/
|
||||
@Service("mtReturnsDetailsService")
|
||||
public class MtReturnsDetailsServiceImpl implements MtReturnsDetailsService {
|
||||
@Resource
|
||||
private MtReturnsDetailsMapper mtReturnsDetailsDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturnsDetails queryById(Integer purchaseDetailId) {
|
||||
return this.mtReturnsDetailsDao.queryById(purchaseDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param mtReturnsDetails 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<MtReturnsDetails> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtReturnsDetails mtReturnsDetails) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
mtReturnsDetails.setStoreId(storeId);
|
||||
IPage<MtReturnsDetails> mtPurchaseIPage = mtReturnsDetailsDao.queryAllByLimit(page, mtReturnsDetails);
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<MtReturnsDetailsVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtReturnsDetails mtReturnsDetails) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
mtReturnsDetails.setStoreId(storeId);
|
||||
IPage<MtReturnsDetailsVO> mtPurchaseIPage = mtReturnsDetailsDao.getListByPage(page, mtReturnsDetails);
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturnsDetails insert(MtReturnsDetails mtReturnsDetails) {
|
||||
this.mtReturnsDetailsDao.insert(mtReturnsDetails);
|
||||
return mtReturnsDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理
|
||||
* @param mtPurchaseDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean batchProcessing(List<MtReturnsDetails> mtReturnsDetails) {
|
||||
List<MtReturnsDetails> mtReturnsDetailsIns = new ArrayList<>();
|
||||
List<MtReturnsDetails> mtReturnsDetailsEdit = new ArrayList<>();
|
||||
|
||||
AccountInfo accountInfoByToken = TokenUtil.getNowAccountInfo();
|
||||
|
||||
if (mtReturnsDetails.size() > 0) {
|
||||
for (MtReturnsDetails mtReturnsDetail : mtReturnsDetails) {
|
||||
mtReturnsDetail.setStoreId(accountInfoByToken.getStoreId());
|
||||
mtReturnsDetail.setCreateBy(accountInfoByToken.getStaffId().toString());
|
||||
if (mtReturnsDetail.getId() != null) {
|
||||
mtReturnsDetailsEdit.add(mtReturnsDetail);
|
||||
}else {
|
||||
mtReturnsDetailsIns.add(mtReturnsDetail);
|
||||
}
|
||||
}
|
||||
if (mtReturnsDetailsIns.size()>0) {
|
||||
mtReturnsDetailsDao.insertBatch(mtReturnsDetailsIns);
|
||||
}
|
||||
if (mtReturnsDetailsEdit.size()>0) {
|
||||
mtReturnsDetailsDao.editBatch(mtReturnsDetailsEdit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturnsDetails 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturnsDetails update(MtReturnsDetails mtReturnsDetails) {
|
||||
this.mtReturnsDetailsDao.update(mtReturnsDetails);
|
||||
return this.queryById(mtReturnsDetails.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param purchaseDetailId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer purchaseDetailId) {
|
||||
return this.mtReturnsDetailsDao.deleteById(purchaseDetailId) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.fuint.business.convenienceSore.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.dto.MtReturnsDto;
|
||||
import com.fuint.business.convenienceSore.entity.MtReturns;
|
||||
import com.fuint.business.convenienceSore.mapper.MtPurchaseMapper;
|
||||
import com.fuint.business.convenienceSore.mapper.MtReturnsMapper;
|
||||
import com.fuint.business.convenienceSore.service.MtReturnsService;
|
||||
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
|
||||
import com.fuint.business.convenienceSore.vo.MtReturnsVO;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退货表(MtReturns)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-27 14:40:17
|
||||
*/
|
||||
@Service("mtReturnsService")
|
||||
public class MtReturnsServiceImpl implements MtReturnsService {
|
||||
@Resource
|
||||
private MtReturnsMapper mtReturnsDao;
|
||||
|
||||
@Resource
|
||||
private MtPurchaseMapper mtPurchaseDao;
|
||||
|
||||
@Resource
|
||||
private ILJStaffService iljStaffService;
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturns queryById(Integer id) {
|
||||
return this.mtReturnsDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param mtReturns 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<MtReturnsVO> queryByPage(Page page, MtReturnsDto mtReturns) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
mtReturns.setStoreId(storeId);
|
||||
IPage<MtReturnsVO> mtPurchaseIPage = mtReturnsDao.getListByPage(page, mtReturns);
|
||||
|
||||
for (MtReturnsVO record : mtPurchaseIPage.getRecords()) {
|
||||
// 根据订单查询所有的供应商信息
|
||||
List<MtPurchaseVO> returnsList = mtPurchaseDao.getPurcaseList(record.getId());
|
||||
record.setSupplierName(assemblyData(returnsList));
|
||||
}
|
||||
|
||||
return mtPurchaseIPage;
|
||||
}
|
||||
|
||||
|
||||
private String assemblyData(List<MtPurchaseVO> returnsList) {
|
||||
if (returnsList.size()>0) {
|
||||
int index = 0;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (MtPurchaseVO mtPurchaseVO : returnsList) {
|
||||
if (!stringBuilder.toString().contains(mtPurchaseVO.getSupplierName())) {
|
||||
if (index == 0) {
|
||||
stringBuilder.append(mtPurchaseVO.getSupplierName());
|
||||
}else {
|
||||
stringBuilder.append("/").append(mtPurchaseVO.getSupplierName());
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
return "-";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturns insert(MtReturns mtReturns) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
mtReturns.setStoreId(nowAccountInfo.getStoreId());
|
||||
mtReturns.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||
this.mtReturnsDao.insert(mtReturns);
|
||||
return mtReturns;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param mtReturns 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MtReturns update(MtReturns mtReturns) {
|
||||
this.mtReturnsDao.update(mtReturns);
|
||||
return this.queryById(mtReturns.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.mtReturnsDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean audit(Integer id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean abolition(Integer id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storage(Integer id) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.fuint.business.convenienceSore.vo;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.MtPurchase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MtPurchaseVO extends MtPurchase {
|
||||
private String createByName;
|
||||
private String approverName;
|
||||
private String supplierName;
|
||||
private Integer detailsId;
|
||||
private Integer supplierId;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.fuint.business.convenienceSore.vo;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.MtReturnsDetails;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MtReturnsDetailsVO extends MtReturnsDetails {
|
||||
private String commodityName; // 商品名称·
|
||||
private String unit; // 商品单位·
|
||||
private Integer supplierId; // 供应商
|
||||
private Integer cvsGoodId; // 分类
|
||||
private Integer stock; // 分类
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.fuint.business.convenienceSore.vo;
|
||||
|
||||
import com.fuint.business.convenienceSore.entity.MtReturns;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MtReturnsVO extends MtReturns {
|
||||
private String createByName;
|
||||
private String approverName;
|
||||
private String supplierName;
|
||||
private Integer detailsId;
|
||||
private Integer supplierId;
|
||||
}
|
Loading…
Reference in New Issue
Block a user