商品货损

This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-30 18:09:11 +08:00
parent 5e06f4582f
commit 189d0533ee
33 changed files with 1835 additions and 59 deletions

View File

@ -134,7 +134,7 @@ export const constantRoutes = [
redirect: 'noredirect',
children: [
{
path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus/:orderNumber',
path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus/:PorderNumber',
component: () => import('@/views/convenienceStore/purchase/details'),
name: 'purchase-details',
props: true, // 启用路由参数作为组件的props
@ -150,7 +150,7 @@ export const constantRoutes = [
redirect: 'noredirect',
children: [
{
path: '/returns/details/:PreturnsId/:PorderDate/:PapprovalStatus/:orderNumber',
path: '/returns/details/:PreturnsId/:PorderDate/:PapprovalStatus/:PorderNumber',
component: () => import('@/views/convenienceStore/returns/details'),
name: 'returns-details',
props: true, // 启用路由参数作为组件的props
@ -158,6 +158,38 @@ export const constantRoutes = [
},
]
},
{
path: '/damage',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: '/damage/details/:PdamageId/:PorderDate/:PapprovalStatus/:PorderNumber',
component: () => import('@/views/convenienceStore/damage/details'),
name: 'damage-details',
props: true, // 启用路由参数作为组件的props
meta: { title: '货损详情', icon: 'user' }
},
]
},
{
path: '/inventory',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: '/inventory/details/:PinventoryId/:PorderDate/:PapprovalStatus/:PorderNumber/:PcreataByName',
component: () => import('@/views/convenienceStore/inventory/details'),
name: 'inventory-details',
props: true, // 启用路由参数作为组件的props
meta: { title: '退货详情', icon: 'user' }
},
]
},
]
// 动态路由,基于用户权限动态去加载

View File

@ -104,7 +104,7 @@
<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">
<el-table-column v-if="state =='await' || state=='ysh'" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"

View File

@ -18,7 +18,7 @@
<el-form-item label="状态" v-model="queryParams.approvalStatus" prop="status">
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" style="150px">
<el-option
v-for="dict in dict.type.oilReturnsdStatus"
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -113,7 +113,7 @@ import {listSupplier} from "@/api/convenienceStore/supplier";
export default {
name: "index",
dicts: ['oilReturnsdStatus'],
dicts: ['oilPurchasedStatus'],
data() {
return {

View File

@ -0,0 +1,100 @@
package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamage;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.business.convenienceSore.service.MtDamageService;
import com.fuint.business.convenienceSore.vo.MtDamageVO;
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;
/**
* 报损表(MtDamage)表控制层
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@RestController
@RequestMapping("/business/convenience/mtDamage")
public class MtDamageController extends BaseController {
/**
* 服务对象
*/
@Resource
private MtDamageService mtDamageService;
/**
* 分页查询
*
* @param mtDamage 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("/queryByPage")
public ResponseObject queryByPage(MtDamage mtDamage,
@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<MtDamage> list = mtDamageService.queryByPage(page,mtDamage);
return getSuccessResult(list);
}
@GetMapping("/getListByPage")
public ResponseObject getListByPage(MtDamage mtDamage,
@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<MtDamageVO> list = mtDamageService.getListByPage(page,mtDamage);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.mtDamageService.queryById(id));
}
/**
* 新增数据
*
* @param mtDamage 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody MtDamage mtDamage) {
return getSuccessResult(this.mtDamageService.insert(mtDamage));
}
/**
* 编辑数据
*
* @param mtDamage 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody MtDamage mtDamage) {
return getSuccessResult(this.mtDamageService.update(mtDamage));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.mtDamageService.deleteById(id));
}
}

View File

@ -0,0 +1,115 @@
package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.service.MtDamageDetailsService;
import com.fuint.business.convenienceSore.vo.MtDamageDetailsVO;
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;
/**
* 报损详情表(MtDamageDetails)表控制层
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@RestController
@RequestMapping("/business/convenience/mtDamageDetails")
public class MtDamageDetailsController extends BaseController {
/**
* 服务对象
*/
@Resource
private MtDamageDetailsService mtDamageDetailsService;
/**
* 分页查询
*
* @param mtDamageDetails 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("/queryByPage")
public ResponseObject queryByPage(MtDamageDetails mtDamageDetails,
@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<MtDamageDetails> list = mtDamageDetailsService.queryByPage(page,mtDamageDetails);
return getSuccessResult(list);
}
@GetMapping("/getListByPage")
public ResponseObject getListByPage(MtDamageDetails mtDamageDetails,
@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<MtDamageDetailsVO> list = mtDamageDetailsService.getListByPage(page,mtDamageDetails);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.mtDamageDetailsService.queryById(id));
}
/**
* 新增数据
*
* @param mtDamageDetails 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(MtDamageDetails mtDamageDetails) {
return getSuccessResult(this.mtDamageDetailsService.insert(mtDamageDetails));
}
/**
* 编辑数据
*
* @param mtDamageDetails 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(MtDamageDetails mtDamageDetails) {
return getSuccessResult(this.mtDamageDetailsService.update(mtDamageDetails));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.mtDamageDetailsService.deleteById(id));
}
/**
* 批量处理数据
*
* @param mtPurchaseDetails 实体
* @return 新增结果
*/
@PostMapping("batchProcessing")
public ResponseObject batchProcessing(@RequestBody List<MtDamageDetails> mtPurchaseDetails) {
return getSuccessResult(this.mtDamageDetailsService.batchProcessing(mtPurchaseDetails));
}
}

View File

@ -2,13 +2,11 @@ package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.service.MtInventoryService;
import com.fuint.business.convenienceSore.vo.MtInventoryVO;
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;
@ -20,7 +18,7 @@ import javax.annotation.Resource;
* @since 2023-10-28 14:45:20
*/
@RestController
@RequestMapping("mtInventory")
@RequestMapping("/business/convenience/mtInventory")
public class MtInventoryController extends BaseController {
/**
* 服务对象
@ -32,7 +30,7 @@ public class MtInventoryController extends BaseController {
* 分页查询
*
* @param mtInventory 筛选条件
* @param pageRequest 分页对象
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("/queryByPage")
@ -44,6 +42,15 @@ public class MtInventoryController extends BaseController {
return getSuccessResult(list);
}
@GetMapping("/getListByPage")
public ResponseObject getListByPage(MtInventory mtInventory,
@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<MtInventoryVO> list = mtInventoryService.getListByPage(page,mtInventory);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*

View File

@ -3,7 +3,9 @@ package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.service.MtInventoryDetailsService;
import com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.data.domain.Page;
@ -12,6 +14,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 盘点详情表(MtInventoryDetails)表控制层
@ -20,7 +23,7 @@ import javax.annotation.Resource;
* @since 2023-10-28 14:45:43
*/
@RestController
@RequestMapping("mtInventoryDetails")
@RequestMapping("/business/convenience/mtInventoryDetails")
public class MtInventoryDetailsController extends BaseController {
/**
* 服务对象
@ -45,6 +48,15 @@ public class MtInventoryDetailsController extends BaseController {
return getSuccessResult(list);
}
@GetMapping("/getListByPage")
public ResponseObject getListByPage(MtInventoryDetails mtInventoryDetails,
@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<MtInventoryDetailsVO> list = mtInventoryDetailsService.getListByPage(page,mtInventoryDetails);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*
@ -89,5 +101,16 @@ public class MtInventoryDetailsController extends BaseController {
return getSuccessResult(this.mtInventoryDetailsService.deleteById(id));
}
/**
* 批量处理数据
*
* @param mtPurchaseDetails 实体
* @return 新增结果
*/
@PostMapping("batchProcessing")
public ResponseObject batchProcessing(@RequestBody List<MtInventoryDetails> mtPurchaseDetails) {
return getSuccessResult(this.mtInventoryDetailsService.batchProcessing(mtPurchaseDetails));
}
}

View File

@ -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;
/**
* 报损表(MtDamage)实体类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Data
public class MtDamage extends BaseEntity {
private static final long serialVersionUID = 143482752837854327L;
/**
* 报损ID主键
*/
private Integer id;
/**
* 业务单号
*/
private String orderNumber;
/**
* 审核状态
*/
private String approvalStatus;
/**
* 制单日期
*/
private Date orderDate;
/**
* 审核人
*/
private String approver;
/**
* 总金额
*/
private Double totalAmount;
/**
* 供应商
*/
private String supplier;
/**
* 报损数量
*/
private Integer damageQuantity;
/**
* 店铺ID
*/
private Integer storeId;
}

View File

@ -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;
/**
* 报损详情表(MtDamageDetails)实体类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Data
public class MtDamageDetails extends BaseEntity {
private static final long serialVersionUID = -46386601710020718L;
/**
* 报损详情ID主键
*/
private Integer id;
/**
* 关联报损ID
*/
private Integer damageId;
/**
* 关联商品ID
*/
private Integer goodsId;
/**
* 报损数量
*/
private Integer damageQuantity;
/**
* 当前加权均进价
*/
private Double weightedAverageCost;
/**
* 小计金额
*/
private Double subtotalAmount;
/**
* 店铺ID
*/
private Integer storeId;
/**
* 入库前库存
*/
private Integer preInboundInventory;
}

View File

@ -18,7 +18,7 @@ public class MtInventory extends BaseEntity {
/**
* 盘点ID主键
*/
private Integer inventoryId;
private Integer id;
/**
* 业务单号
*/
@ -51,6 +51,10 @@ public class MtInventory extends BaseEntity {
* 盘点数量
*/
private Integer inventoryQuantity;
/**
* 盘点数量
*/
private Integer productQuantity;
/**
* 店铺ID
*/

View File

@ -22,7 +22,7 @@ public class MtInventoryDetails extends BaseEntity {
/**
* 商品ID
*/
private Integer productId;
private Integer goodsId;
/**
* 盘点ID
*/

View File

@ -0,0 +1,94 @@
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.MtDamage;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.vo.MtDamageDetailsVO;
import com.fuint.business.convenienceSore.vo.MtDamageVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 报损详情表(MtDamageDetails)表数据库访问层
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
public interface MtDamageDetailsMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtDamageDetails queryById(Integer id);
/**
* 查询指定行数据
*
* @param mtDamageDetails 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
IPage<MtDamageDetails> queryAllByLimit(Page page, @Param("mtDamageDetails") MtDamageDetails mtDamageDetails);
IPage<MtDamageDetailsVO> getListByPage(Page page, @Param("mtDamageDetails") MtDamageDetails mtDamageDetails);
/**
* 统计总行数
*
* @param mtDamageDetails 查询条件
* @return 总行数
*/
long count(MtDamageDetails mtDamageDetails);
/**
* 新增数据
*
* @param mtDamageDetails 实例对象
* @return 影响行数
*/
int insert(MtDamageDetails mtDamageDetails);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<MtDamageDetails> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<MtDamageDetails> entities);
int editBatch(@Param("list") List<MtDamageDetails> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<MtDamageDetails> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<MtDamageDetails> entities);
/**
* 修改数据
*
* @param mtDamageDetails 实例对象
* @return 影响行数
*/
int update(MtDamageDetails mtDamageDetails);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -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.MtDamage;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.vo.MtDamageVO;
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 报损表(MtDamage)表数据库访问层
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
public interface MtDamageMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtDamage queryById(Integer id);
/**
* 查询指定行数据
*
* @param mtDamage 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
IPage<MtDamage> queryAllByLimit(Page page, @Param("mtDamage") MtDamage mtDamage);
IPage<MtDamageVO> getListByPage(Page page, @Param("mtDamage") MtDamage mtDamage);
/**
* 统计总行数
*
* @param mtDamage 查询条件
* @return 总行数
*/
long count(MtDamage mtDamage);
/**
* 新增数据
*
* @param mtDamage 实例对象
* @return 影响行数
*/
int insert(MtDamage mtDamage);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<MtDamage> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<MtDamage> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<MtDamage> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<MtDamage> entities);
/**
* 修改数据
*
* @param mtDamage 实例对象
* @return 影响行数
*/
int update(MtDamage mtDamage);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
List<MtDamageVO> getDamageList(@Param("pId") Integer pId);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -33,6 +34,9 @@ public interface MtInventoryDetailsMapper {
*/
IPage<MtInventoryDetails> queryAllByLimit(Page page, @Param("mtInventoryDetails") MtInventoryDetails mtInventoryDetails);
IPage<MtInventoryDetailsVO> getListByPage(Page page, @Param("mtInventoryDetails") MtInventoryDetails mtInventoryDetails);
/**
* 统计总行数
*
@ -56,6 +60,7 @@ public interface MtInventoryDetailsMapper {
* @return 影响行数
*/
int insertBatch(@Param("entities") List<MtInventoryDetails> entities);
int editBatch(@Param("list") List<MtInventoryDetails> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.vo.MtInventoryVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -32,7 +33,9 @@ public interface MtInventoryMapper {
* @param pageable 分页对象
* @return 对象列表
*/
IPage<MtInventory> queryAllByLimit(Page page, @Param("mtPurchaseDetails") MtInventory mtInventory);
IPage<MtInventory> queryAllByLimit(Page page, @Param("mtInventory") MtInventory mtInventory);
IPage<MtInventoryVO> getListByPage(Page page, @Param("mtInventory") MtInventory mtInventory);
/**
* 统计总行数

View File

@ -90,5 +90,8 @@ public interface MtReturnsMapper {
int editStateById(@Param("id") Integer id,@Param("status") String status);
// List<MtReturnsVO> getMtReturnsList(@Param("pId") Integer pId);
}

View File

@ -0,0 +1,250 @@
<?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.MtDamageDetailsMapper">
<resultMap type="com.fuint.business.convenienceSore.entity.MtDamageDetails" id="MtDamageDetailsMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="damageId" column="damage_id" jdbcType="INTEGER"/>
<result property="goodsId" column="goods_id" jdbcType="INTEGER"/>
<result property="damageQuantity" column="damage_quantity" jdbcType="INTEGER"/>
<result property="weightedAverageCost" column="weighted_average_cost" jdbcType="NUMERIC"/>
<result property="subtotalAmount" column="subtotal_amount" jdbcType="NUMERIC"/>
<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="MtDamageDetailsMap">
select
id, damage_id, goods_id, damage_quantity, weighted_average_cost, subtotal_amount, store_id, create_time, update_time, create_by, update_by
from mt_damage_details
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtDamageDetailsMap">
select
id, damage_id, goods_id, damage_quantity, weighted_average_cost, subtotal_amount, store_id, create_time, update_time, create_by, update_by
from mt_damage_details
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="damageId != null">
and damage_id = #{damageId}
</if>
<if test="goodsId != null">
and goods_id = #{goodsId}
</if>
<if test="damageQuantity != null">
and damage_quantity = #{damageQuantity}
</if>
<if test="weightedAverageCost != null">
and weighted_average_cost = #{weightedAverageCost}
</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="count" resultType="java.lang.Long">
select count(1)
from mt_damage_details
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="damageId != null">
and damage_id = #{damageId}
</if>
<if test="goodsId != null">
and goods_id = #{goodsId}
</if>
<if test="damageQuantity != null">
and damage_quantity = #{damageQuantity}
</if>
<if test="weightedAverageCost != null">
and weighted_average_cost = #{weightedAverageCost}
</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.MtDamageDetailsVO">
select
md.id id,
md.damage_quantity damageQuantity ,
md.weighted_average_cost weightedAverageCost ,
md.subtotal_amount subtotalAmount ,
md.pre_inbound_inventory preInboundInventory ,
mg.name commodityName,
mg.cvs_good_id cvsGoodId,
mg.unit unit,
mg.supplier_id supplierId,
mg.id goodsId,
mg.stock stock
from mt_damage_details md
left join mt_goods mg ON md.goods_id = mg.id
where
md.store_id = #{mtDamageDetails.storeId}
and damage_id = #{mtDamageDetails.damageId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage_details(damage_id, goods_id, damage_quantity, weighted_average_cost, subtotal_amount, store_id, create_time, update_time, create_by, update_by,pre_inbound_inventory)
values (#{damageId}, #{goodsId}, #{damageQuantity}, #{weightedAverageCost}, #{subtotalAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy},#{preInboundInventory})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage_details(damage_id, goods_id, damage_quantity, weighted_average_cost, subtotal_amount, store_id, create_time, update_time, create_by, update_by,pre_inbound_inventory)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.damageId}, #{entity.goodsId}, #{entity.damageQuantity}, #{entity.weightedAverageCost}, #{entity.subtotalAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy},#{entity.preInboundInventory})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage_details(damage_id, goods_id, damage_quantity, weighted_average_cost, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.damageId}, #{entity.goodsId}, #{entity.damageQuantity}, #{entity.weightedAverageCost}, #{entity.subtotalAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
damage_id = values(damage_id),
goods_id = values(goods_id),
damage_quantity = values(damage_quantity),
weighted_average_cost = values(weighted_average_cost),
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_damage_details
<set>
<if test="damageId != null">
damage_id = #{damageId},
</if>
<if test="goodsId != null">
goods_id = #{goodsId},
</if>
<if test="damageQuantity != null">
damage_quantity = #{damageQuantity},
</if>
<if test="weightedAverageCost != null">
weighted_average_cost = #{weightedAverageCost},
</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_damage_details
<set>
<if test="user.damageId != null">
damage_id = #{user.damageId},
</if>
<if test="user.goodsId != null">
goods_id = #{user.goodsId},
</if>
<if test="user.damageQuantity != null">
damage_quantity = #{user.damageQuantity},
</if>
<if test="user.weightedAverageCost != null">
weighted_average_cost = #{user.weightedAverageCost},
</if>
<if test="user.subtotalAmount != null">
subtotal_amount = #{user.subtotalAmount},
</if>
<if test="user.storeId != null">
store_id = #{user.storeId},
</if>
<if test="user.createTime != null">
create_time = #{user.createTime},
</if>
<if test="user.updateTime != null">
update_time = #{user.updateTime},
</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>
</set>
where id = #{user.id}
</foreach>
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from mt_damage_details where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,249 @@
<?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.MtDamageMapper">
<resultMap type="com.fuint.business.convenienceSore.entity.MtDamage" id="MtDamageMap">
<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="supplier" column="supplier" jdbcType="VARCHAR"/>
<result property="damageQuantity" column="damage_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="MtDamageMap">
select
id, order_number, approval_status, order_date, approver, total_amount, supplier, damage_quantity, store_id, create_time, update_time, create_by, update_by
from mt_damage
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtDamageMap">
select
id, order_number, approval_status, order_date, approver, total_amount, supplier, damage_quantity, store_id, create_time, update_time, create_by, update_by
from mt_damage
<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="supplier != null and supplier != ''">
and supplier = #{supplier}
</if>
<if test="damageQuantity != null">
and damage_quantity = #{damageQuantity}
</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="count" resultType="java.lang.Long">
select count(1)
from mt_damage
<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="supplier != null and supplier != ''">
and supplier = #{supplier}
</if>
<if test="damageQuantity != null">
and damage_quantity = #{damageQuantity}
</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>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage(order_number, approval_status, order_date, approver, total_amount, supplier, damage_quantity, store_id, create_time, update_time, create_by, update_by)
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{totalAmount}, #{supplier}, #{damageQuantity}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage(order_number, approval_status, order_date, approver, total_amount, supplier, damage_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.supplier}, #{entity.damageQuantity}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_damage(order_number, approval_status, order_date, approver, total_amount, supplier, damage_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.supplier}, #{entity.damageQuantity}, #{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),
supplier = values(supplier),
damage_quantity = values(damage_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_damage
<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="supplier != null and supplier != ''">
supplier = #{supplier},
</if>
<if test="damageQuantity != null">
damage_quantity = #{damageQuantity},
</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_damage where id = #{id}
</delete>
<select id="getDamageList" resultType="com.fuint.business.convenienceSore.vo.MtDamageVO">
select
mpd.id detailsId,
s.id supplierId,
s.name supplierName
from mt_damage_details mpd
left join mt_goods mg ON mg.id = mpd.goods_id
left join supplier s ON mg.supplier_id = s.id
where mpd.id = #{pId}
</select>
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtDamageVO">
SELECT
mp.id id,
mp.order_number orderNumber,
mp.total_amount totalAmount,
mp.damage_quantity damageQuantity,
mp.approval_status approvalStatus,
mp.order_date orderDate,
ms1.real_name createByName,
ms2.real_name approverName,
mp.create_time createTime
FROM
mt_damage mp
LEFT JOIN mt_damage_details mpd ON mp.id = mpd.damage_id
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
where
mp.store_id = #{mtDamage.storeId}
<if test="mtDamage.approvalStatus != null and mtDamage.approvalStatus != ''">
and approval_status = #{mtDamage.approvalStatus}
</if>
<if test="mtDamage.orderNumber != null and mtDamage.orderNumber != ''">
and order_number LIKE CONCAT('%', #{mtDamage.orderNumber}, '%')
</if>
<if test="mtReturns.supplierId != null">
and mp.store_id = #{mtReturns.storeId}
</if>
group by mp.id
</select>
</mapper>

View File

@ -4,7 +4,7 @@
<resultMap type="com.fuint.business.convenienceSore.entity.MtInventoryDetails" id="MtInventoryDetailsMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="productId" column="product_id" jdbcType="INTEGER"/>
<result property="goodsId" column="goods_id" jdbcType="INTEGER"/>
<result property="inventoryId" column="inventory_id" jdbcType="INTEGER"/>
<result property="purchasePrice" column="purchase_price" jdbcType="NUMERIC"/>
<result property="stock" column="stock" jdbcType="INTEGER"/>
@ -21,7 +21,7 @@
<!--查询单个-->
<select id="queryById" resultMap="MtInventoryDetailsMap">
select
id, product_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
id, goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
from mt_inventory_details
where id = #{id}
</select>
@ -29,14 +29,14 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtInventoryDetailsMap">
select
id, product_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
id, goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
from mt_inventory_details
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="productId != null">
and product_id = #{productId}
<if test="goodsId != null">
and goods_id = #{goodsId}
</if>
<if test="inventoryId != null">
and inventory_id = #{inventoryId}
@ -82,8 +82,8 @@
<if test="id != null">
and id = #{id}
</if>
<if test="productId != null">
and product_id = #{productId}
<if test="goodsId != null">
and goods_id = #{goodsId}
</if>
<if test="inventoryId != null">
and inventory_id = #{inventoryId}
@ -120,29 +120,73 @@
</if>
</where>
</select>
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO">
select
md.id id,
md.profit_loss_amount profitLossAmount,
md.inventory_discrepancy inventoryDiscrepancy,
md.inventory_quantity inventoryQuantity,
md.purchase_price purchasePrice,
mg.name commodityName,
mg.goods_no goodsNo,
mg.cvs_good_id cvsGoodId,
mg.unit unit,
mg.supplier_id supplierId,
mg.id goodsId,
md.stock stock
from mt_inventory_details md
left join mt_goods mg ON md.goods_id = mg.id
<where>
inventory_id = #{mtInventoryDetails.inventoryId}
<if test="mtInventoryDetails.id != null">
and id = #{mtInventoryDetails.id}
</if>
<if test="mtInventoryDetails.goodsId != null">
and goods_id = #{mtInventoryDetails.goodsId}
</if>
<if test="mtInventoryDetails.purchasePrice != null">
and purchase_price = #{mtInventoryDetails.purchasePrice}
</if>
<if test="mtInventoryDetails.storeId != null">
and md.store_id = #{mtInventoryDetails.storeId}
</if>
<if test="mtInventoryDetails.createTime != null">
and mdcreate_time = #{mtInventoryDetails.createTime}
</if>
<if test="mtInventoryDetails.updateTime != null">
and md.update_time = #{mtInventoryDetails.updateTime}
</if>
<if test="mtInventoryDetails.createBy != null">
and md.create_by = #{mtInventoryDetails.createBy}
</if>
<if test="mtInventoryDetails.updateBy != null">
and md.update_by = #{mtInventoryDetails.updateBy}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory_details(product_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values (#{productId}, #{inventoryId}, #{purchasePrice}, #{stock}, #{profitLossAmount}, #{inventoryDiscrepancy}, #{inventoryQuantity}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
insert into mt_inventory_details(goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values (#{goodsId}, #{inventoryId}, #{purchasePrice}, #{stock}, #{profitLossAmount}, #{inventoryDiscrepancy}, #{inventoryQuantity}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory_details(product_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
insert into mt_inventory_details(goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.productId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.goodsId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId},NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory_details(product_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
insert into mt_inventory_details(goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.productId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.goodsId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
product_id = values(product_id),
goods_id = values(goods_id),
inventory_id = values(inventory_id),
purchase_price = values(purchase_price),
stock = values(stock),
@ -160,8 +204,8 @@
<update id="update">
update mt_inventory_details
<set>
<if test="productId != null">
product_id = #{productId},
<if test="goodsId != null">
goods_id = #{goodsId},
</if>
<if test="inventoryId != null">
inventory_id = #{inventoryId},
@ -199,6 +243,51 @@
</set>
where id = #{id}
</update>
<update id="editBatch">
<foreach collection="list" item="user" separator=";">
update mt_inventory_details
<set>
<if test="user.goodsId != null">
goods_id = #{user.goodsId},
</if>
<if test="user.inventoryId != null">
inventory_id = #{user.inventoryId},
</if>
<if test="user.purchasePrice != null">
purchase_price = #{user.purchasePrice},
</if>
<if test="user.stock != null">
stock = #{user.stock},
</if>
<if test="user.profitLossAmount != null">
profit_loss_amount = #{user.profitLossAmount},
</if>
<if test="user.inventoryDiscrepancy != null">
inventory_discrepancy = #{user.inventoryDiscrepancy},
</if>
<if test="user.inventoryQuantity != null">
inventory_quantity = #{user.inventoryQuantity},
</if>
<if test="user.storeId != null">
store_id = #{user.storeId},
</if>
<if test="user.createTime != null">
create_time = #{user.createTime},
</if>
<if test="user.updateTime != null">
update_time = #{user.updateTime},
</if>
<if test="user.createBy != null">
create_by = #{user.createBy},
</if>
<if test="user.updateBy != null">
update_by = #{user.updateBy},
</if>
</set>
where id = #{user.id}
</foreach>
</update>
<!--通过主键删除-->
<delete id="deleteById">

View File

@ -3,7 +3,7 @@
<mapper namespace="com.fuint.business.convenienceSore.mapper.MtInventoryMapper">
<resultMap type="com.fuint.business.convenienceSore.entity.MtInventory" id="MtInventoryMap">
<result property="inventoryId" column="inventory_id" jdbcType="INTEGER"/>
<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"/>
@ -22,19 +22,19 @@
<!--查询单个-->
<select id="queryById" resultMap="MtInventoryMap">
select
inventory_id, order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
id, order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
from mt_inventory
where inventory_id = #{inventoryId}
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtInventoryMap">
select
inventory_id, order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
id, order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by
from mt_inventory
<where>
<if test="inventoryId != null">
and inventory_id = #{inventoryId}
<if test="id != null">
and id = #{id}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
@ -83,8 +83,8 @@
select count(1)
from mt_inventory
<where>
<if test="inventoryId != null">
and inventory_id = #{inventoryId}
<if test="id != null">
and id = #{id}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
@ -127,14 +127,80 @@
</if>
</where>
</select>
<select id="getListByPage" resultType="com.fuint.business.convenienceSore.vo.MtInventoryVO">
select
mp.id id,
mp.order_number orderNumber,
mp.approval_status approvalStatus,
mp.order_date orderDate,
mp.approver,
mp.confirmer,
mp.profit_loss_amount AS profitLossAmount,
mp.inventory_discrepancy AS inventoryDiscrepancy,
mp.inventory_quantity AS inventoryQuantity,
mp.store_id AS storeId,
mp.create_time AS createTime,
mp.update_time AS updateTime,
mp.create_by createBy,
ms1.real_name createByName,
ms2.real_name approverName,
ms3.real_name confirmerName
from mt_inventory mp
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
LEFT JOIN mt_staff ms3 ON mp.confirmer = ms3.id
<where>
mp.store_id = #{mtInventory.storeId}
<if test="mtInventory.id != null">
and id = #{mtInventory.id}
</if>
<if test="mtInventory.orderNumber != null and mtInventory.orderNumber != ''">
and order_number = #{mtInventory.orderNumber}
</if>
<if test="mtInventory.approvalStatus != null and mtInventory.approvalStatus != ''">
and approval_status = #{mtInventory.approvalStatus}
</if>
<if test="mtInventory.orderDate != null">
and order_date = #{mtInventory.orderDate}
</if>
<if test="mtInventory.approver != null and mtInventory.approver != ''">
and approver = #{mtInventory.approver}
</if>
<if test="mtInventory.confirmer != null and mtInventory.confirmer != ''">
and confirmer = #{mtInventory.confirmer}
</if>
<if test="mtInventory.profitLossAmount != null">
and profit_loss_amount = #{mtInventory.profitLossAmount}
</if>
<if test="mtInventory.inventoryDiscrepancy != null">
and inventory_discrepancy = #{mtInventory.inventoryDiscrepancy}
</if>
<if test="mtInventory.inventoryQuantity != null">
and inventory_quantity = #{mtInventory.inventoryQuantity}
</if>
<if test="mtInventory.createTime != null">
and create_time = #{mtInventory.createTime}
</if>
<if test="mtInventory.updateTime != null">
and update_time = #{mtInventory.updateTime}
</if>
<if test="mtInventory.createBy != null">
and create_by = #{mtInventory.createBy}
</if>
<if test="mtInventory.updateBy != null">
and update_by = #{mtInventory.updateBy}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="inventoryId" useGeneratedKeys="true">
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory(order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{confirmer}, #{profitLossAmount}, #{inventoryDiscrepancy}, #{inventoryQuantity}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{confirmer}, #{profitLossAmount}, #{inventoryDiscrepancy}, #{inventoryQuantity}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="inventoryId" useGeneratedKeys="true">
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory(order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
@ -142,7 +208,7 @@
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="inventoryId" useGeneratedKeys="true">
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory(order_number, approval_status, order_date, approver, confirmer, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
@ -192,6 +258,9 @@
<if test="inventoryQuantity != null">
inventory_quantity = #{inventoryQuantity},
</if>
<if test="productQuantity != null">
product_quantity = #{productQuantity},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
@ -208,12 +277,12 @@
update_by = #{updateBy},
</if>
</set>
where inventory_id = #{inventoryId}
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from mt_inventory where inventory_id = #{inventoryId}
delete from mt_inventory where id = #{id}
</delete>
</mapper>

View File

@ -138,15 +138,14 @@
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
<where>
mp.store_id = #{mtReturns.storeId}
<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>

View File

@ -0,0 +1,66 @@
package com.fuint.business.convenienceSore.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.vo.MtDamageDetailsVO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* 报损详情表(MtDamageDetails)表服务接口
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
public interface MtDamageDetailsService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtDamageDetails queryById(Integer id);
/**
* 分页查询
*
* @param mtDamageDetails 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<MtDamageDetails> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamageDetails mtDamageDetails);
IPage<MtDamageDetailsVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamageDetails mtDamageDetails);
/**
* 新增数据
*
* @param mtDamageDetails 实例对象
* @return 实例对象
*/
MtDamageDetails insert(MtDamageDetails mtDamageDetails);
/**
* 修改数据
*
* @param mtDamageDetails 实例对象
* @return 实例对象
*/
MtDamageDetails update(MtDamageDetails mtDamageDetails);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
boolean batchProcessing(List<MtDamageDetails> mtPurchaseDetails);
}

View File

@ -0,0 +1,62 @@
package com.fuint.business.convenienceSore.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamage;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.vo.MtDamageVO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
/**
* 报损表(MtDamage)表服务接口
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
public interface MtDamageService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtDamage queryById(Integer id);
/**
* 分页查询
*
* @param mtDamage 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
IPage<MtDamage> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamage mtDamage);
IPage<MtDamageVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamage mtDamage);
/**
* 新增数据
*
* @param mtDamage 实例对象
* @return 实例对象
*/
MtDamage insert(MtDamage mtDamage);
/**
* 修改数据
*
* @param mtDamage 实例对象
* @return 实例对象
*/
MtDamage update(MtDamage mtDamage);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -3,6 +3,10 @@ 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.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO;
import java.util.List;
/**
@ -30,6 +34,8 @@ public interface MtInventoryDetailsService {
*/
IPage<MtInventoryDetails> queryByPage(Page page, MtInventoryDetails mtInventoryDetails);
IPage<MtInventoryDetailsVO> getListByPage(Page page, MtInventoryDetails mtInventoryDetails);
/**
* 新增数据
*
@ -54,4 +60,6 @@ public interface MtInventoryDetailsService {
*/
boolean deleteById(Integer id);
boolean batchProcessing(List<MtInventoryDetails> mtPurchaseDetails);
}

View File

@ -1,10 +1,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.entity.MtInventory;
import com.fuint.business.convenienceSore.entity.MtPurchase;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import com.fuint.business.convenienceSore.vo.MtInventoryVO;
/**
* 商品盘点表(MtInventory)表服务接口
@ -29,7 +28,9 @@ public interface MtInventoryService {
* @param page 分页对象
* @return 查询结果
*/
IPage<MtInventory> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtInventory mtInventory);
IPage<MtInventory> queryByPage(Page page, MtInventory mtInventory);
IPage<MtInventoryVO> getListByPage(Page page, MtInventory mtInventory);
/**
* 新增数据

View File

@ -0,0 +1,134 @@
package com.fuint.business.convenienceSore.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.mapper.MtDamageDetailsMapper;
import com.fuint.business.convenienceSore.service.MtDamageDetailsService;
import com.fuint.business.convenienceSore.vo.MtDamageDetailsVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 报损详情表(MtDamageDetails)表服务实现类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Service("mtDamageDetailsService")
public class MtDamageDetailsServiceImpl implements MtDamageDetailsService {
@Resource
private MtDamageDetailsMapper mtDamageDetailsDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public MtDamageDetails queryById(Integer id) {
return this.mtDamageDetailsDao.queryById(id);
}
/**
* 分页查询
*
* @param mtDamageDetails 筛选条件
* @param page
* 分页对象
* @return 查询结果
*/
@Override
public IPage<MtDamageDetails> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamageDetails mtDamageDetails) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtDamageDetails.setStoreId(storeId);
IPage<MtDamageDetails> MtInventoryDetailsIPage = mtDamageDetailsDao.queryAllByLimit(page, mtDamageDetails);
return MtInventoryDetailsIPage;
}
@Override
public IPage<MtDamageDetailsVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamageDetails mtDamageDetails) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtDamageDetails.setStoreId(storeId);
IPage<MtDamageDetailsVO> MtInventoryDetailsIPage = mtDamageDetailsDao.getListByPage(page, mtDamageDetails);
return MtInventoryDetailsIPage;
}
/**
* 新增数据
*
* @param mtDamageDetails 实例对象
* @return 实例对象
*/
@Override
public MtDamageDetails insert(MtDamageDetails mtDamageDetails) {
this.mtDamageDetailsDao.insert(mtDamageDetails);
return mtDamageDetails;
}
/**
* 修改数据
*
* @param mtDamageDetails 实例对象
* @return 实例对象
*/
@Override
public MtDamageDetails update(MtDamageDetails mtDamageDetails) {
this.mtDamageDetailsDao.update(mtDamageDetails);
return this.queryById(mtDamageDetails.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.mtDamageDetailsDao.deleteById(id) > 0;
}
/**
* 批量处理
* @param
* @return
*/
@Override
public boolean batchProcessing(List<MtDamageDetails> mtDamageDetails) {
List<MtDamageDetails> mtDamageDetailsIns = new ArrayList<>();
List<MtDamageDetails> mtDamageDetailsEdit = new ArrayList<>();
AccountInfo accountInfoByToken = TokenUtil.getNowAccountInfo();
if (mtDamageDetails.size() > 0) {
for (MtDamageDetails mtDamageDetails1 : mtDamageDetails) {
mtDamageDetails1.setStoreId(accountInfoByToken.getStoreId());
mtDamageDetails1.setCreateBy(accountInfoByToken.getStaffId().toString());
if (mtDamageDetails1.getId() != null) {
mtDamageDetailsEdit.add(mtDamageDetails1);
}else {
mtDamageDetailsIns.add(mtDamageDetails1);
}
}
if (mtDamageDetailsIns.size()>0) {
mtDamageDetailsDao.insertBatch(mtDamageDetailsIns);
}
if (mtDamageDetailsEdit.size()>0) {
mtDamageDetailsDao.editBatch(mtDamageDetailsEdit);
}
return true;
}
return false;
}
}

View File

@ -0,0 +1,134 @@
package com.fuint.business.convenienceSore.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtDamage;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.mapper.MtDamageMapper;
import com.fuint.business.convenienceSore.mapper.MtPurchaseMapper;
import com.fuint.business.convenienceSore.service.MtDamageService;
import com.fuint.business.convenienceSore.vo.MtDamageVO;
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
import com.fuint.business.convenienceSore.vo.MtReturnsVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.List;
/**
* 报损表(MtDamage)表服务实现类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Service("mtDamageService")
public class MtDamageServiceImpl implements MtDamageService {
@Resource
private MtDamageMapper mtDamageDao;
@Resource
private MtPurchaseMapper mtPurchaseDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public MtDamage queryById(Integer id) {
return this.mtDamageDao.queryById(id);
}
/**
* 分页查询
*
* @param mtDamage 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<MtDamage> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamage mtDamage) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtDamage.setStoreId(storeId);
IPage<MtDamage> MtInventoryDetailsIPage = mtDamageDao.queryAllByLimit(page, mtDamage);
return MtInventoryDetailsIPage;
}
@Override
public IPage<MtDamageVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtDamage mtDamage) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtDamage.setStoreId(storeId);
IPage<MtDamageVO> MtInventoryDetailsIPage = mtDamageDao.getListByPage(page, mtDamage);
for (MtDamageVO record : MtInventoryDetailsIPage.getRecords()) {
// 根据订单查询所有的供应商信息
List<MtDamageVO> returnsList = mtDamageDao.getDamageList(record.getId());
record.setSupplierName(assemblyData(returnsList));
}
return MtInventoryDetailsIPage;
}
private String assemblyData(List<MtDamageVO> returnsList) {
if (returnsList.size()>0) {
int index = 0;
StringBuilder stringBuilder = new StringBuilder();
for (MtDamageVO mtDamageVO : returnsList) {
if (!stringBuilder.toString().contains(mtDamageVO.getSupplierName())) {
if (index == 0) {
stringBuilder.append(mtDamageVO.getSupplierName());
}else {
stringBuilder.append("/").append(mtDamageVO.getSupplierName());
}
}
index++;
}
return stringBuilder.toString();
}
return "-";
}
/**
* 新增数据
*
* @param mtDamage 实例对象
* @return 实例对象
*/
@Override
public MtDamage insert(MtDamage mtDamage) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
mtDamage.setStoreId(nowAccountInfo.getStoreId());
mtDamage.setCreateBy(nowAccountInfo.getStaffId().toString());
this.mtDamageDao.insert(mtDamage);
return mtDamage;
}
/**
* 修改数据
*
* @param mtDamage 实例对象
* @return 实例对象
*/
@Override
public MtDamage update(MtDamage mtDamage) {
this.mtDamageDao.update(mtDamage);
return this.queryById(mtDamage.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.mtDamageDao.deleteById(id) > 0;
}
}

View File

@ -1,18 +1,19 @@
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.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.mapper.MtInventoryDetailsMapper;
import com.fuint.business.convenienceSore.service.MtInventoryDetailsService;
import com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 盘点详情表(MtInventoryDetails)表服务实现类
@ -52,6 +53,15 @@ public class MtInventoryDetailsServiceImpl implements MtInventoryDetailsService
return MtInventoryDetailsIPage;
}
@Override
public IPage<MtInventoryDetailsVO> getListByPage(Page page, MtInventoryDetails mtInventoryDetails) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtInventoryDetails.setStoreId(storeId);
IPage<MtInventoryDetailsVO> MtInventoryDetailsIPage = mtInventoryDetailsDao.getListByPage(page, mtInventoryDetails);
return MtInventoryDetailsIPage;
}
/**
* 新增数据
*
@ -86,4 +96,38 @@ public class MtInventoryDetailsServiceImpl implements MtInventoryDetailsService
public boolean deleteById(Integer id) {
return this.mtInventoryDetailsDao.deleteById(id) > 0;
}
/**
* 批量处理
* @param mtPurchaseDetails
* @return
*/
@Override
public boolean batchProcessing(List<MtInventoryDetails> mtPurchaseDetails) {
List<MtInventoryDetails> mtPurchaseDetailsIns = new ArrayList<>();
List<MtInventoryDetails> mtPurchaseDetailsEdit = new ArrayList<>();
AccountInfo accountInfoByToken = TokenUtil.getNowAccountInfo();
if (mtPurchaseDetails.size() > 0) {
for (MtInventoryDetails 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) {
mtInventoryDetailsDao.insertBatch(mtPurchaseDetailsIns);
}
if (mtPurchaseDetailsEdit.size()>0) {
mtInventoryDetailsDao.editBatch(mtPurchaseDetailsEdit);
}
return true;
}
return false;
}
}

View File

@ -5,6 +5,7 @@ import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.entity.MtInventory;
import com.fuint.business.convenienceSore.mapper.MtInventoryMapper;
import com.fuint.business.convenienceSore.service.MtInventoryService;
import com.fuint.business.convenienceSore.vo.MtInventoryVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
@ -53,6 +54,15 @@ public class MtInventoryServiceImpl implements MtInventoryService {
return MtInventoryIPage;
}
@Override
public IPage<MtInventoryVO> getListByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtInventory mtInventory) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
mtInventory.setStoreId(nowAccountInfo.getStoreId());
// mtInventory.setCreateBy(nowAccountInfo.getStaffId().toString());
IPage<MtInventoryVO> MtInventoryIPage = mtInventoryDao.getListByPage(page, mtInventory);
return MtInventoryIPage;
}
/**
* 新增数据
*
@ -61,6 +71,9 @@ public class MtInventoryServiceImpl implements MtInventoryService {
*/
@Override
public MtInventory insert(MtInventory mtInventory) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
mtInventory.setCreateBy(nowAccountInfo.getStaffId().toString());
mtInventory.setStoreId(nowAccountInfo.getStoreId());
this.mtInventoryDao.insert(mtInventory);
return mtInventory;
}
@ -74,7 +87,7 @@ public class MtInventoryServiceImpl implements MtInventoryService {
@Override
public MtInventory update(MtInventory mtInventory) {
this.mtInventoryDao.update(mtInventory);
return this.queryById(mtInventory.getInventoryId());
return this.queryById(mtInventory.getId());
}
/**

View File

@ -0,0 +1,26 @@
package com.fuint.business.convenienceSore.vo;
import com.fuint.business.convenienceSore.entity.MtDamageDetails;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
/**
* 报损详情表(MtDamageDetails)实体类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Data
public class MtDamageDetailsVO extends MtDamageDetails {
private String commodityName; // 商品名称·
private String unit; // 商品名称·
private Integer supplierId; // 供应商
private Integer cvsGoodId; // 分类
private Integer stock; // 分类
/**
* 业务单号
*/
private String orderNumber;
}

View File

@ -0,0 +1,22 @@
package com.fuint.business.convenienceSore.vo;
import com.fuint.business.convenienceSore.entity.MtDamage;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 报损表(MtDamage)实体类
*
* @author makejava
* @since 2023-10-30 15:14:26
*/
@Data
public class MtDamageVO extends MtDamage {
private String createByName;
private String approverName;
private String supplierName;
private Integer detailsId;
private Integer supplierId;
}

View File

@ -1,4 +1,19 @@
package com.fuint.business.convenienceSore.vo;
public class MtInventoryDetailsVO {
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import lombok.Data;
@Data
public class MtInventoryDetailsVO extends MtInventoryDetails {
private String commodityName; // 商品名称·
private String unit; // 商品名称·
private String goodsNo; // 商品名称·
private Integer supplierId; // 供应商
private Integer cvsGoodId; // 分类
private Integer stock; // 分类
/**
* 业务单号
*/
private String orderNumber;
}

View File

@ -1,4 +1,11 @@
package com.fuint.business.convenienceSore.vo;
public class MtInventoryVO {
import com.fuint.business.convenienceSore.entity.MtInventory;
import lombok.Data;
@Data
public class MtInventoryVO extends MtInventory {
private String createByName;
private String approverName;
private String confirmerName;
}