feat(sip): 添加用户创建和更新记录
- 在 AgentInfo、CustomerInfo、DeliveryList、OrderDelivery、OrderInfo、PartnerInfo 和 ProductInfo 表中添加 create_by 和 update_by 字段 - 在相关服务实现类中设置 createBy 和 updateBy 属性 - 在 mapper.xml 文件中更新插入和更新语句,包含新字段master
parent
2c12a7a7eb
commit
0069df1c67
|
@ -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());
|
||||
|
|
|
@ -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("该编码已存在");
|
||||
|
|
|
@ -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("客户编码已存在");
|
||||
|
|
|
@ -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<DeliveryList> deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList);
|
||||
if (!deliveryLists.isEmpty()){
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<OrderList> 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));
|
||||
}
|
||||
|
|
|
@ -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("该编码已存在");
|
||||
|
|
|
@ -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编码已存在");
|
||||
|
|
|
@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at,</if>
|
||||
<if test="deleteAt != null">delete_at,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null and createBy!=''">create_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
|
@ -103,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">#{updateAt},</if>
|
||||
<if test="deleteAt != null">#{deleteAt},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null and createBy!=''">#{createBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -124,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at = #{updateAt},</if>
|
||||
<if test="deleteAt != null">delete_at = #{deleteAt},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy!=''">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -107,11 +107,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
<insert id="insertBatch">
|
||||
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
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator=",">
|
||||
(#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now())
|
||||
(#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now(),#{item.createBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
<if test="deletedAt != null">deleted_at,</if>
|
||||
<if test="createBy != null and createBy!=''">create_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">#{orderId},</if>
|
||||
|
@ -100,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
<if test="deletedAt != null">#{deletedAt},</if>
|
||||
<if test="createBy != null and createBy!=''">#{createBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -121,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="deletedAt != null">deleted_at = #{deletedAt},</if>
|
||||
<if test="updateBy != null and updateBy!=''">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id} and status=0
|
||||
</update>
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
<if test="orderDate != null">order_date,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
created_at,updated_at,status
|
||||
created_at,updated_at,create_by,status
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="projectCode != null">#{projectCode},</if>
|
||||
|
@ -270,7 +270,7 @@
|
|||
<if test="orderDate != null">#{orderDate},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
NOW(),now(),0
|
||||
NOW(),now(),#{createBy},0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -294,7 +294,7 @@
|
|||
<if test="orderDate != null">order_date = #{orderDate},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
updated_at = NOW(),
|
||||
updated_at = NOW(),update_by = #{updateBy}
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -314,7 +314,7 @@
|
|||
<if test="item.discount != null and item.discount!=''">discount = #{item.discount},</if>
|
||||
<if test="item.price != null and item.price!=''">price = #{item.price},</if>
|
||||
<if test="item.remark != null">remark = #{item.remark},</if>
|
||||
updated_at = NOW(),
|
||||
updated_at = NOW(),update_by = #{item.updateBy}
|
||||
</trim>
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
|
@ -355,10 +355,10 @@
|
|||
</delete>
|
||||
|
||||
<insert id="batchOrderList">
|
||||
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
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount},#{item.discount},
|
||||
#{item.remark}, now(),now())
|
||||
#{item.remark}, now(),now(),#{item.createBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at,</if>
|
||||
<if test="deleteAt != null">delete_at,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null and createBy!=''">create_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="agentCode != null and agentCode != ''">#{agentCode},</if>
|
||||
|
@ -79,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">#{updateAt},</if>
|
||||
<if test="deleteAt != null">#{deleteAt},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null and createBy!=''">#{createBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at = #{updateAt},</if>
|
||||
<if test="deleteAt != null">delete_at = #{deleteAt},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy!=''">update_by=#{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at,</if>
|
||||
<if test="deleteAt != null">delete_at,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null and createBy!=''">create_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="partnerCode != null and partnerCode != ''">#{partnerCode},</if>
|
||||
|
@ -71,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">#{updateAt},</if>
|
||||
<if test="deleteAt != null">#{deleteAt},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null and createBy!=''">#{createBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -89,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateAt != null">update_at = #{updateAt},</if>
|
||||
<if test="deleteAt != null">delete_at = #{deleteAt},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy!=''">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null">type,</if>
|
||||
<if test="value != null">value,</if>
|
||||
<if test="hzCode != null">hz_code,</if>
|
||||
created_at,status
|
||||
created_at,status,create_by
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productCode != null and productCode != ''">#{productCode},</if>
|
||||
|
@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null">#{type},</if>
|
||||
<if test="value != null">#{value},</if>
|
||||
<if test="hzCode != null">#{hzCode},</if>
|
||||
NOW(),0
|
||||
NOW(),0,#{createBy}
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="value != null">value = #{value},</if>
|
||||
<if test="hzCode != null">hz_code = #{hzCode},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
updated_at = NOW(),
|
||||
updated_at = NOW(),update_by=#{updateBy}
|
||||
<if test="deletedAt != null">deleted_at = #{deletedAt},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
|
Loading…
Reference in New Issue