物料基本信息管理修改

This commit is contained in:
liuhanqing
2025-09-11 16:15:55 +08:00
parent fd797fe91d
commit e98b7969c7
8 changed files with 336 additions and 421 deletions

View File

@@ -1,25 +1,31 @@
package com.ruoyi.bas.BasProduct.controller;
import cn.hutool.core.util.IdUtil;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import com.ruoyi.bas.BasProduct.service.IBasProductService;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import com.ruoyi.bas.BasProduct.service.IBasProductService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.page.TableDataInfo;
import java.util.List;
/**
* 物料管理Controller
*
* @author ruoyi
* @date 2025-05-20
* 物料信息Controller
*
* @author gw
* @date 2025-09-11
*/
@RestController
@RequestMapping("/bas/BasProduct")
@@ -29,7 +35,7 @@ public class BasProductController extends BaseController
private IBasProductService basProductService;
/**
* 查询物料管理列表
* 查询物料信息列表
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:list')")
@GetMapping("/list")
@@ -41,20 +47,20 @@ public class BasProductController extends BaseController
}
/**
* 导出物料管理列表
* 导出物料信息列表
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:export')")
@Log(title = "物料管理", businessType = BusinessType.EXPORT)
@Log(title = "物料信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasProduct basProduct)
{
List<BasProduct> list = basProductService.selectBasProductList(basProduct);
ExcelUtil<BasProduct> util = new ExcelUtil<BasProduct>(BasProduct.class);
util.exportExcel(response, list, "物料管理数据");
util.exportExcel(response, list, "物料信息数据");
}
/**
* 获取物料管理详细信息
* 获取物料信息详细信息
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:query')")
@GetMapping(value = "/{productGuid}")
@@ -64,23 +70,21 @@ public class BasProductController extends BaseController
}
/**
* 新增物料管理
* 新增物料信息
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:add')")
@Log(title = "物料管理", businessType = BusinessType.INSERT)
@Log(title = "物料信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasProduct basProduct)
{
// 使用雪花算法生成ID并转为字符串
basProduct.setProductGuid(String.valueOf(IdUtil.getSnowflake().nextId()));
return toAjax(basProductService.insertBasProduct(basProduct));
}
/**
* 修改物料管理
* 修改物料信息
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:edit')")
@Log(title = "物料管理", businessType = BusinessType.UPDATE)
@Log(title = "物料信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasProduct basProduct)
{
@@ -88,10 +92,10 @@ public class BasProductController extends BaseController
}
/**
* 删除物料管理
* 删除物料信息
*/
@PreAuthorize("@ss.hasPermi('bas:BasProduct:remove')")
@Log(title = "物料管理", businessType = BusinessType.DELETE)
@Log(title = "物料信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{productGuids}")
public AjaxResult remove(@PathVariable String[] productGuids)
{

View File

@@ -1,18 +1,22 @@
package com.ruoyi.bas.BasProduct.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 物料管理对象 bas_product
* 物料信息对象 bas_product
*
* @author ruoyi
* @date 2025-05-20
* @author gw
* @date 2025-09-11
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BasProduct extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -21,85 +25,66 @@ public class BasProduct extends BaseEntity
private String productGuid;
/** 物料编码 */
@Excel(name = "${bas.Product.productId}")
@Excel(name = "物料编码")
private String productId;
/** 物料名称 */
@Excel(name = "${bas.Product.productName}")
@Excel(name = "物料名称")
private String productName;
/** 英文描述 */
@Excel(name = "${bas.Product.spare1}")
private String spare1;
/** 单位 */
@Excel(name = "${bas.Product.unit}")
private String unit;
/** 单件净重KG */
@Excel(name = "${bas.Product.spare2}")
private String spare2;
/** 长MM */
@Excel(name = "${bas.Product.spare5}")
private String spare5;
/** 宽MM */
@Excel(name = "${bas.Product.spare6}")
private String spare6;
/** 高MM */
@Excel(name = "${bas.Product.spare7}")
private String spare7;
/** 体积m³ */
@Excel(name = "${bas.Product.spare8}")
private String spare8;
/** 价格 */
@Excel(name = "${bas.Product.price}")
private String price;
/** 描述 */
@Excel(name = "${bas.Product.remark}")
private String remark;
/** 父节点id */
// @Excel(name = "${bas.Product.parentId}")
private String parentId;
/** 品牌 */
// @Excel(name = "${bas.Product.cargoNo}")
private String cargoNo;
/** 规格 */
// @Excel(name = "${bas.Product.spec}")
private String spec;
/** 备用字段3 */
// @Excel(name = "${bas.Product.spare3}")
private String spare3;
/** 备用字段4 */
// @Excel(name = "${bas.Product.spare4}")
/** 序列号 */
@Excel(name = "序列号")
private String spare4;
/** 相位 */
@Excel(name = "相位")
private String spare7;
/** 备用字段6 */
// @Excel(name = "${bas.Product.spare9}")
/** 型号 */
@Excel(name = "型号")
private String spare1;
/** 净重 */
@Excel(name = "净重")
private String spare2;
/** 毛重 */
@Excel(name = "毛重")
private String spare8;
/** 颜色 */
@Excel(name = "颜色")
private String spare3;
/** 电压 */
@Excel(name = "电压")
private String spare5;
/** 功率 */
@Excel(name = "功率")
private String spare6;
/** $column.columnComment */
private String parentId;
/** $column.columnComment */
private String price;
/** $column.columnComment */
private String cargoNo;
/** $column.columnComment */
private String unit;
/** $column.columnComment */
private String spec;
/** $column.columnComment */
private String spare9;
/**
* 数量
*/
private String quantity;
/**
* 批号
*/
private String lotNo;
private String totalNetWeight;
private String netWeight;
private String grossWeight;
}

View File

@@ -1,74 +1,61 @@
package com.ruoyi.bas.BasProduct.mapper;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
/**
* 物料管理Mapper接口
*
* @author ruoyi
* @date 2025-05-20
* 物料信息Mapper接口
*
* @author gw
* @date 2025-09-11
*/
public interface BasProductMapper
public interface BasProductMapper
{
/**
* 查询物料管理
*
* @param productGuid 物料管理主键
* @return 物料管理
* 查询物料信息
*
* @param productGuid 物料信息主键
* @return 物料信息
*/
public BasProduct selectBasProductByProductGuid(String productGuid);
/**
* 查询物料管理列表
*
* @param basProduct 物料管理
* @return 物料管理集合
* 查询物料信息列表
*
* @param basProduct 物料信息
* @return 物料信息集合
*/
public List<BasProduct> selectBasProductList(BasProduct basProduct);
/**
* 新增物料管理
*
* @param basProduct 物料管理
* 新增物料信息
*
* @param basProduct 物料信息
* @return 结果
*/
public int insertBasProduct(BasProduct basProduct);
/**
* 修改物料管理
*
* @param basProduct 物料管理
* 修改物料信息
*
* @param basProduct 物料信息
* @return 结果
*/
public int updateBasProduct(BasProduct basProduct);
/**
* 删除物料管理
*
* @param productGuid 物料管理主键
* 删除物料信息
*
* @param productGuid 物料信息主键
* @return 结果
*/
public int deleteBasProductByProductGuid(String productGuid);
/**
* 批量删除物料管理
*
* 批量删除物料信息
*
* @param productGuids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasProductByProductGuids(String[] productGuids);
/**
* 通过物料id列表批量查询物料信息
* @param collect
* @return
*/
List<BasProduct> selectBasProductListByProductGuids(@Param("productGuids") List<String> collect);
BasProduct selectBasProductByProductId(String productId);
List<BasProduct> selectBasProductListByProductIds(@Param("productIds") List<String> collect);
}

View File

@@ -1,73 +1,65 @@
package com.ruoyi.bas.BasProduct.service;
import java.util.List;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import java.util.List;
/**
* 物料管理Service接口
*
* @author ruoyi
* @date 2025-05-20
* 物料信息Service接口
*
* @author gw
* @date 2025-09-11
*/
public interface IBasProductService
public interface IBasProductService
{
/**
* 查询物料管理
*
* @param productGuid 物料管理主键
* @return 物料管理
* 查询物料信息
*
* @param productGuid 物料信息主键
* @return 物料信息
*/
public BasProduct selectBasProductByProductGuid(String productGuid);
public BasProduct selectBasProductByProductId(String productId);
/**
* 查询物料管理列表
*
* @param basProduct 物料管理
* @return 物料管理集合
* 查询物料信息列表
*
* @param basProduct 物料信息
* @return 物料信息集合
*/
public List<BasProduct> selectBasProductList(BasProduct basProduct);
/**
* 新增物料管理
*
* @param basProduct 物料管理
* 新增物料信息
*
* @param basProduct 物料信息
* @return 结果
*/
public int insertBasProduct(BasProduct basProduct);
/**
* 修改物料管理
*
* @param basProduct 物料管理
* 修改物料信息
*
* @param basProduct 物料信息
* @return 结果
*/
public int updateBasProduct(BasProduct basProduct);
/**
* 批量删除物料管理
*
* @param productGuids 需要删除的物料管理主键集合
* 批量删除物料信息
*
* @param productGuids 需要删除的物料信息主键集合
* @return 结果
*/
public int deleteBasProductByProductGuids(String[] productGuids);
/**
* 删除物料管理信息
*
* @param productGuid 物料管理主键
* 删除物料信息信息
*
* @param productGuid 物料信息主键
* @return 结果
*/
public int deleteBasProductByProductGuid(String productGuid);
/**
* 通过物料id列表查询物料信息
* @param collect
* @return
*/
List<BasProduct> selectBasProductListByProductGuids(List<String> collect);
BasProduct selectBasProductByProductId(String productId);
List<BasProduct> selectBasProductListByProductIds(List<String> collect);
}

View File

@@ -1,20 +1,17 @@
package com.ruoyi.bas.BasProduct.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import com.ruoyi.bas.BasProduct.mapper.BasProductMapper;
import com.ruoyi.bas.BasProduct.service.IBasProductService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import com.ruoyi.bas.BasProduct.mapper.BasProductMapper;
import com.ruoyi.bas.BasProduct.domain.BasProduct;
import com.ruoyi.bas.BasProduct.service.IBasProductService;
/**
* 物料管理Service业务层处理
* 物料信息Service业务层处理
*
* @author ruoyi
* @date 2025-05-20
* @author gw
* @date 2025-09-11
*/
@Service
public class BasProductServiceImpl implements IBasProductService
@@ -23,10 +20,10 @@ public class BasProductServiceImpl implements IBasProductService
private BasProductMapper basProductMapper;
/**
* 查询物料管理
* 查询物料信息
*
* @param productGuid 物料管理主键
* @return 物料管理
* @param productGuid 物料信息主键
* @return 物料信息
*/
@Override
public BasProduct selectBasProductByProductGuid(String productGuid)
@@ -34,16 +31,11 @@ public class BasProductServiceImpl implements IBasProductService
return basProductMapper.selectBasProductByProductGuid(productGuid);
}
@Override
public BasProduct selectBasProductByProductId(String productId) {
return basProductMapper.selectBasProductByProductId(productId);
}
/**
* 查询物料管理列表
* 查询物料信息列表
*
* @param basProduct 物料管理
* @return 物料管理
* @param basProduct 物料信息
* @return 物料信息
*/
@Override
public List<BasProduct> selectBasProductList(BasProduct basProduct)
@@ -52,9 +44,9 @@ public class BasProductServiceImpl implements IBasProductService
}
/**
* 新增物料管理
* 新增物料信息
*
* @param basProduct 物料管理
* @param basProduct 物料信息
* @return 结果
*/
@Override
@@ -64,9 +56,9 @@ public class BasProductServiceImpl implements IBasProductService
}
/**
* 修改物料管理
* 修改物料信息
*
* @param basProduct 物料管理
* @param basProduct 物料信息
* @return 结果
*/
@Override
@@ -76,9 +68,9 @@ public class BasProductServiceImpl implements IBasProductService
}
/**
* 批量删除物料管理
* 批量删除物料信息
*
* @param productGuids 需要删除的物料管理主键
* @param productGuids 需要删除的物料信息主键
* @return 结果
*/
@Override
@@ -88,9 +80,9 @@ public class BasProductServiceImpl implements IBasProductService
}
/**
* 删除物料管理信息
* 删除物料信息信息
*
* @param productGuid 物料管理主键
* @param productGuid 物料信息主键
* @return 结果
*/
@Override
@@ -98,24 +90,14 @@ public class BasProductServiceImpl implements IBasProductService
{
return basProductMapper.deleteBasProductByProductGuid(productGuid);
}
/**
* 通过物料id列表查询物料信息
* @param collect
* @return
*/
@Override
public List<BasProduct> selectBasProductListByProductGuids(List<String> collect) {
if (CollUtil.isEmpty(collect)){
return new ArrayList<>();
}
return basProductMapper.selectBasProductListByProductGuids(collect);
public BasProduct selectBasProductByProductId(String productId) {
return null;
}
@Override
public List<BasProduct> selectBasProductListByProductIds(List<String> collect) {
if (CollUtil.isEmpty(collect)){
return new ArrayList<>();
}
return basProductMapper.selectBasProductListByProductIds(collect);
return List.of();
}
}