From 0069df1c67fbea32498315c34de88d36cf796a73 Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Fri, 23 May 2025 09:04:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(sip):=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=9B=E5=BB=BA=E5=92=8C=E6=9B=B4=E6=96=B0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 AgentInfo、CustomerInfo、DeliveryList、OrderDelivery、OrderInfo、PartnerInfo 和 ProductInfo 表中添加 create_by 和 update_by 字段 - 在相关服务实现类中设置 createBy 和 updateBy 属性 - 在 mapper.xml 文件中更新插入和更新语句,包含新字段 --- .../ruoyi/sip/controller/OrderInfoController.java | 2 ++ .../ruoyi/sip/service/impl/AgentInfoServiceImpl.java | 3 +++ .../sip/service/impl/CustomerInfoServiceImpl.java | 3 +++ .../sip/service/impl/DeliveryListServiceImpl.java | 4 ++++ .../sip/service/impl/OrderDeliveryServiceImpl.java | 4 +++- .../ruoyi/sip/service/impl/OrderInfoServiceImpl.java | 7 +++++++ .../sip/service/impl/PartnerInfoServiceImpl.java | 3 +++ .../sip/service/impl/ProductInfoServiceImpl.java | 3 +++ .../resources/mapper/manage/CustomerInfoMapper.xml | 3 +++ .../resources/mapper/manage/DeliveryListMapper.xml | 4 ++-- .../resources/mapper/manage/OrderDeliveryMapper.xml | 3 +++ .../main/resources/mapper/manage/OrderInfoMapper.xml | 12 ++++++------ .../main/resources/mapper/system/AgentInfoMapper.xml | 3 +++ .../resources/mapper/system/PartnerInfoMapper.xml | 3 +++ .../resources/mapper/system/ProductInfoMapper.xml | 6 +++--- 15 files changed, 51 insertions(+), 12 deletions(-) diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OrderInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OrderInfoController.java index 91bc9d22..b006a992 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OrderInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OrderInfoController.java @@ -12,6 +12,7 @@ import cn.hutool.core.collection.CollUtil; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.sip.domain.*; @@ -225,6 +226,7 @@ public class OrderInfoController extends BaseController && productInfoMap.containsKey(item.getProductCode())) .collect(Collectors.toList()); for (OrderList orderList : orderListList) { + orderList.setCreateBy(ShiroUtils.getUserId().toString()); ProductInfo productInfo = productInfoMap.get(orderList.getProductCode()); if (productInfo != null) { orderList.setProductName(productInfo.getProductName()); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java index 2ffb317b..4cef7f82 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import java.util.List; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ShiroUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.sip.mapper.AgentInfoMapper; @@ -55,6 +56,7 @@ public class AgentInfoServiceImpl implements IAgentInfoService @Override public int insertAgentInfo(AgentInfo agentInfo) { + agentInfo.setCreateBy(ShiroUtils.getUserId().toString()); int i = agentInfoMapper.selectCountByCode(agentInfo); if (i>0){ throw new ServiceException("该编码已存在"); @@ -72,6 +74,7 @@ public class AgentInfoServiceImpl implements IAgentInfoService @Override public int updateAgentInfo(AgentInfo agentInfo) { + agentInfo.setUpdateBy(ShiroUtils.getUserId().toString()); int i = agentInfoMapper.selectCountByCode(agentInfo); if (i>0){ throw new ServiceException("该编码已存在"); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java index 98bc23d1..57142baa 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import java.util.List; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.sip.domain.CustomerInfo; import com.ruoyi.sip.mapper.CustomerInfoMapper; import com.ruoyi.sip.service.ICustomerInfoService; @@ -56,6 +57,7 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService @Override public int insertCustomerInfo(CustomerInfo customerInfo) { + customerInfo.setCreateBy(ShiroUtils.getUserId().toString()); int i = customerInfoMapper.selectCountByCode(customerInfo); if (i > 0){ throw new ServiceException("客户编码已存在"); @@ -72,6 +74,7 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService @Override public int updateCustomerInfo(CustomerInfo customerInfo) { + customerInfo.setUpdateBy(ShiroUtils.getUserId().toString()); int i = customerInfoMapper.selectCountByCode(customerInfo); if (i > 0){ throw new ServiceException("客户编码已存在"); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java index 4abb2ced..fd928f02 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.sip.domain.OrderList; import com.ruoyi.sip.domain.ProductInfo; @@ -72,6 +73,7 @@ public class DeliveryListServiceImpl implements IDeliveryListService { */ @Override public int insertDeliveryList(DeliveryList deliveryList) { + deliveryList.setCreateBy(ShiroUtils.getUserId().toString()); return deliveryListMapper.insertDeliveryList(deliveryList); } @@ -83,6 +85,7 @@ public class DeliveryListServiceImpl implements IDeliveryListService { */ @Override public int updateDeliveryList(DeliveryList deliveryList) { + deliveryList.setUpdateBy(ShiroUtils.getUserId().toString()); return deliveryListMapper.updateDeliveryList(deliveryList); } @@ -126,6 +129,7 @@ public class DeliveryListServiceImpl implements IDeliveryListService { for (DeliveryList list : deliveryList) { list.setDeliveryId(deliveryId); + list.setCreateBy(ShiroUtils.getUserId().toString()); } List deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList); if (!deliveryLists.isEmpty()){ diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderDeliveryServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderDeliveryServiceImpl.java index 9f1acc3e..2dea7abe 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderDeliveryServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderDeliveryServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.sip.domain.CodeGenTable; import com.ruoyi.sip.service.ICodeGenTableService; import com.ruoyi.sip.utils.CodeGeneratorUtil; @@ -60,7 +61,7 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService @Override public int insertOrderDelivery(OrderDelivery orderDelivery) { - + orderDelivery.setCreateBy(ShiroUtils.getUserId().toString()); String deliveryCode =codeGenTableService.generateCode(CodeGenTable.TableNameEnum.ORDER_DELIVERY.getName()); orderDelivery.setDeliveryCode(deliveryCode); return orderDeliveryMapper.insertOrderDelivery(orderDelivery); @@ -75,6 +76,7 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService @Override public int updateOrderDelivery(OrderDelivery orderDelivery) { + orderDelivery.setUpdateBy(ShiroUtils.getUserId().toString()); return orderDeliveryMapper.updateOrderDelivery(orderDelivery); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java index 8e427c1a..02644b6e 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java @@ -9,6 +9,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Dict; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.sip.domain.*; import com.ruoyi.sip.dto.ApiDataQueryDto; import com.ruoyi.sip.service.IAgentInfoService; @@ -75,6 +76,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService @Override public int insertOrderInfo(OrderInfo orderInfo) { + orderInfo.setCreateBy(ShiroUtils.getUserId().toString()); int rows = orderInfoMapper.insertOrderInfo(orderInfo); insertOrderList(orderInfo); return rows; @@ -112,8 +114,12 @@ public class OrderInfoServiceImpl implements IOrderInfoService // } // orderInfoMapper.deleteOrderListByOrderId(orderInfo.getId()); // insertOrderList(orderInfo); + orderInfo.setUpdateBy(ShiroUtils.getUserId().toString()); List orderListList = orderInfo.getOrderListList(); if (orderListList!=null && !orderListList.isEmpty()){ + for (OrderList orderList : orderListList) { + orderList.setUpdateBy(ShiroUtils.getUserId().toString()); + } orderInfoMapper.updateListBatch(orderListList); } return orderInfoMapper.updateOrderInfo(orderInfo); @@ -129,6 +135,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService @Override public int deleteOrderInfoByIds(String ids) { + orderInfoMapper.deleteOrderListByOrderIds(Convert.toStrArray(ids)); return orderInfoMapper.deleteOrderInfoByIds(Convert.toStrArray(ids)); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java index cf0a8ad9..6a3966f7 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import java.util.List; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ShiroUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.sip.mapper.PartnerInfoMapper; @@ -55,6 +56,7 @@ public class PartnerInfoServiceImpl implements IPartnerInfoService @Override public int insertPartnerInfo(PartnerInfo partnerInfo) { + partnerInfo.setCreateBy(ShiroUtils.getUserId().toString()); int i = partnerInfoMapper.selectCountByCode(partnerInfo); if (i>0){ throw new ServiceException("该编码已存在"); @@ -71,6 +73,7 @@ public class PartnerInfoServiceImpl implements IPartnerInfoService @Override public int updatePartnerInfo(PartnerInfo partnerInfo) { + partnerInfo.setUpdateBy(ShiroUtils.getUserId().toString()); int i = partnerInfoMapper.selectCountByCode(partnerInfo); if (i>0){ throw new ServiceException("该编码已存在"); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java index 937dca29..85af1b9b 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import java.util.List; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.sip.domain.MaintenanceRecordsDto; import org.springframework.beans.factory.annotation.Autowired; @@ -57,6 +58,7 @@ public class ProductInfoServiceImpl implements IProductInfoService @Override public int insertProductInfo(ProductInfo productInfo) { + productInfo.setCreateBy(ShiroUtils.getUserId().toString()); int i = productInfoMapper.selectCountByCode(productInfo); if (i>0){ throw new ServiceException("BOM编码已存在"); @@ -73,6 +75,7 @@ public class ProductInfoServiceImpl implements IProductInfoService @Override public int updateProductInfo(ProductInfo productInfo) { + productInfo.setUpdateBy(ShiroUtils.getUserId().toString()); int i = productInfoMapper.selectCountByCode(productInfo); if (i>0){ throw new ServiceException("BOM编码已存在"); diff --git a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml index 826a711e..5c0c7a44 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml @@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at, delete_at, status, + create_by, #{id}, @@ -103,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateAt}, #{deleteAt}, #{status}, + #{createBy}, @@ -124,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at = #{updateAt}, delete_at = #{deleteAt}, status = #{status}, + update_by = #{updateBy}, where id = #{id} diff --git a/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml index 555b2191..1d6c9398 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml @@ -107,11 +107,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at) + insert into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at,create_by) values - (#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now()) + (#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now(),#{item.createBy}) diff --git a/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml index 279325fa..8de4e1e1 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml @@ -83,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" created_at, updated_at, deleted_at, + create_by, #{orderId}, @@ -100,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createdAt}, #{updatedAt}, #{deletedAt}, + #{createBy}, @@ -121,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" created_at = #{createdAt}, updated_at = #{updatedAt}, deleted_at = #{deletedAt}, + update_by = #{updateBy}, where id = #{id} and status=0 diff --git a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml index 9480dcd0..4193c946 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml @@ -250,7 +250,7 @@ order_date, status, remark, - created_at,updated_at,status + created_at,updated_at,create_by,status #{projectCode}, @@ -270,7 +270,7 @@ #{orderDate}, #{status}, #{remark}, - NOW(),now(),0 + NOW(),now(),#{createBy},0 @@ -294,7 +294,7 @@ order_date = #{orderDate}, status = #{status}, remark = #{remark}, - updated_at = NOW(), + updated_at = NOW(),update_by = #{updateBy} where id = #{id} @@ -314,7 +314,7 @@ discount = #{item.discount}, price = #{item.price}, remark = #{item.remark}, - updated_at = NOW(), + updated_at = NOW(),update_by = #{item.updateBy} where id = #{item.id} @@ -355,10 +355,10 @@ - insert into order_list(id , order_id, product_code, quantity, price, amount,discount,remark, created_at, updated_at) values + insert into order_list(id , order_id, product_code, quantity, price, amount,discount,remark, created_at, updated_at,create_by) values ( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount},#{item.discount}, - #{item.remark}, now(),now()) + #{item.remark}, now(),now(),#{item.createBy}) diff --git a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml index 64626cbc..ea2c8a5d 100644 --- a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml @@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at, delete_at, status, + create_by, #{agentCode}, @@ -79,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateAt}, #{deleteAt}, #{status}, + #{createBy}, @@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at = #{updateAt}, delete_at = #{deleteAt}, status = #{status}, + update_by=#{updateBy}, where id = #{id} diff --git a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml index d35b3210..9c77684c 100644 --- a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml @@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at, delete_at, status, + create_by, #{partnerCode}, @@ -71,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateAt}, #{deleteAt}, #{status}, + #{createBy}, @@ -89,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_at = #{updateAt}, delete_at = #{deleteAt}, status = #{status}, + update_by = #{updateBy}, where id = #{id} diff --git a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml index 97bae91a..0c248913 100644 --- a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml @@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type, value, hz_code, - created_at,status + created_at,status,create_by #{productCode}, @@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{type}, #{value}, #{hzCode}, - NOW(),0 + NOW(),0,#{createBy} @@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" value = #{value}, hz_code = #{hzCode}, created_at = #{createdAt}, - updated_at = NOW(), + updated_at = NOW(),update_by=#{updateBy} deleted_at = #{deletedAt}, where id = #{id}