Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian 4 лет назад
Родитель
Сommit
5c5d504ab7
32 измененных файлов с 1304 добавлено и 214 удалено
  1. 95 142
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsDesc.java
  2. 83 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsFiles.java
  3. 94 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsPrice.java
  4. 62 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/ContainerTypeVO.java
  5. 61 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/PortTypeVO.java
  6. 47 21
      blade-service/blade-client/src/main/java/org/springblade/client/container/controller/ContainerController.java
  7. 7 1
      blade-service/blade-client/src/main/java/org/springblade/client/container/mapper/BasicContainerDescMapper.java
  8. 36 2
      blade-service/blade-client/src/main/java/org/springblade/client/container/mapper/BasicContainerDescMapper.xml
  9. 8 1
      blade-service/blade-client/src/main/java/org/springblade/client/container/service/BasicContainerDescService.java
  10. 76 8
      blade-service/blade-client/src/main/java/org/springblade/client/container/service/imp/BasicContainerDescServiceImpl.java
  11. 94 7
      blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescController.java
  12. 76 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsFilesController.java
  13. 1 1
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.java
  14. 32 10
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.xml
  15. 23 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsFilesMapper.java
  16. 7 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsFilesMapper.xml
  17. 23 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsPriceMapper.java
  18. 7 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsPriceMapper.xml
  19. 2 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsDescService.java
  20. 35 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsFilesService.java
  21. 34 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsPriceService.java
  22. 119 6
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java
  23. 54 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsFilesServiceImpl.java
  24. 56 0
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsPriceServiceImpl.java
  25. 38 3
      blade-service/blade-client/src/main/java/org/springblade/client/port/controller/PortController.java
  26. 7 1
      blade-service/blade-client/src/main/java/org/springblade/client/port/mapper/BasicPortDescMapper.java
  27. 36 2
      blade-service/blade-client/src/main/java/org/springblade/client/port/mapper/BasicPortDescMapper.xml
  28. 7 1
      blade-service/blade-client/src/main/java/org/springblade/client/port/service/BasicPortDescService.java
  29. 70 5
      blade-service/blade-client/src/main/java/org/springblade/client/port/service/impl/BasicPortDescServiceImpl.java
  30. 6 3
      blade-service/blade-project/src/main/java/org/springblade/project/controller/ProjectController.java
  31. 2 0
      blade-service/blade-project/src/main/java/org/springblade/project/controller/ProjectFilesController.java
  32. 6 0
      blade-service/blade-project/src/main/java/org/springblade/project/service/impl/ServiceProjectServiceImpl.java

+ 95 - 142
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsDesc.java

@@ -17,15 +17,19 @@
 package org.springblade.client.entity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 商品详情表实体类
@@ -39,172 +43,121 @@ import java.util.Date;
 public class GoodsDesc implements Serializable {
 
 	private static final long serialVersionUID = 1L;
-
-	/**
-	 * 主键
-	 */
-	@ApiModelProperty(value = "主键")
+	//主键
+	@TableId
 	private Long id;
-	/**
-	 * 商品编码
-	 */
-	@ApiModelProperty(value = "商品编码")
+	//商品编码
 	private String code;
-	/**
-	 * 商品名称
-	 */
-	@ApiModelProperty(value = "商品名称")
+	//商品名称
 	private String cname;
-	/**
-	 * 规格编码
-	 */
-	@ApiModelProperty(value = "规格编码")
+	//英文名称
+	private String ename;
+	//中文描述
+	private String nameDescription;
+	//英文描述
+	private String cnameDescription;
+	//规格编码
 	private String typeno;
-	/**
-	 * 品牌
-	 */
-	@ApiModelProperty(value = "品牌")
+	//英文规格
+	private String etypeno;
+	//海关编码
+	private String customCode;
+	//海关中文
+	private String customName;
+	//海关英文
+	private String customEname;
+	//退税率
+	private BigDecimal customRate;
+	//轮胎条数
+	private String unit;
+	//品牌
 	private String brand;
-	/**
-	 * 花纹
-	 */
-	@ApiModelProperty(value = "花纹")
+	//花纹
 	private String brandItem;
-	/**
-	 * 规格尺寸
-	 */
-	@ApiModelProperty(value = "规格尺寸")
+	//规格尺寸
 	private String specs;
-	/**
-	 * 产品类别
-	 */
-	@ApiModelProperty(value = "产品类别")
+	//产品类别
 	private String category;
-	/**
-	 * 产品类型
-	 */
-	@ApiModelProperty(value = "产品类型")
-	private Long type;
-	/**
-	 * 供应商
-	 */
-	@ApiModelProperty(value = "供应商")
+	//产品分类
+	private String categoryitem;
+	//备注(收费指示)
 	private String providers;
-	/**
-	 * 计量单位
-	 */
-	@ApiModelProperty(value = "计量单位")
-	private String unit;
-	/**
-	 * 包装单位
-	 */
-	@ApiModelProperty(value = "包装单位")
+	//长度单位
+	private String lengthUnit;
+	//重量单位
+	private String weightUnit;
+	//包装单位
 	private String packgeunit;
-	/**
-	 * 图片
-	 */
-	@ApiModelProperty(value = "图片")
+	//每箱尺寸
+	private BigDecimal cntrSize;
+	//每个体积
+	private BigDecimal singleVolumn;
+	//每个毛重
+	private BigDecimal singleGrossWeight;
+	//每个净重
+	private BigDecimal singleWeight;
+	//每个箱数
+	private BigDecimal singleCntr;
+	//每箱体积
+	private BigDecimal cntrVolumn;
+	//每箱毛重
+	private BigDecimal cntrGrossWeight;
+	//每箱净重
+	private BigDecimal cntrWeight;
+	//每箱数量
+	private BigDecimal cntrQuantity;
+	//包装描述
+	private String packageDescription;
+	//箱轮胎条数
+	private BigDecimal containerQuantity;
+	//图片
 	private String url;
-	/**
-	 * 备注
-	 */
-	@ApiModelProperty(value = "备注")
+	//质保期
+	private BigDecimal warrantyPeriod;
+	//频率
+	private String rate;
+	//单价
+	private BigDecimal price;
+	//工时
+	private BigDecimal workingHours;
+	//备注(收费指示)
 	private String remarks;
-	/**
-	 * 版本
-	 */
-	@ApiModelProperty(value = "版本")
+	//版本
 	private String version;
-	/**
-	 * 租户id
-	 */
-	@ApiModelProperty(value = "租户id")
+	//租户ID
 	private String tenantId;
-	/**
-	 * 创建人
-	 */
-	@ApiModelProperty(value = "创建人")
+	//修改人
+	private Long updateUser;
+	//创建人
 	private Long createUser;
-	/**
-	 * 创建部门
-	 */
-	@ApiModelProperty(value = "创建部门")
+	//创建部门
 	private Long createDept;
-	/**
-	 * 创建时间
-	 */
-	@ApiModelProperty(value = "创建时间")
+	//创建时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	private Date createTime;
-	/**
-	 * 修改人
-	 */
-	@ApiModelProperty(value = "修改人")
-	private Long updateUser;
-	/**
-	 * 修改时间
-	 */
-	@ApiModelProperty(value = "修改时间")
+	//修改时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	private Date updateTime;
-	/**
-	 * 状态(0 正常 1停用)
-	 */
-	@ApiModelProperty(value = "状态(0 正常 1停用)")
+	//状态(0 正常 1停用)
 	private Integer status;
-	/**
-	 * 是否已删除(0 否 1是)
-	 */
-	//@TableLogic
-	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	//是否已删除(0 否 1是)
+	@TableLogic
 	private Integer isDeleted;
-	/**
-	 * 商品类别
-	 */
-	@ApiModelProperty(value = "商品类别")
-	@TableField(exist = false)
+	//枚举
+	private Long type;
+
 	private String goodsTypeId;
-	/**
-	 * 商品类别名称
-	 */
-	@ApiModelProperty(value = "商品类别名称")
+
 	@TableField(exist = false)
-	private String goodsTypeName;
-	/**
-	 * 规格型号
-	 */
-	@ApiModelProperty(value = "规格型号")
+	private List<GoodsPrice>  saleGoodsPrice;
+
 	@TableField(exist = false)
-	private String specificationAndModel;
+	private List<GoodsPrice>  buyGoodsPrice;
 
+	@TableField(exist = false)
+	private List<GoodsFiles> filesList;
 
-	/**
-	 * 产品分类
-	 */
-	@ApiModelProperty(value = "产品分类")
-	private String categoryItem;
-	/**
-	 * 轮胎条数
-	 */
-	@ApiModelProperty(value = "轮胎条数")
-	private BigDecimal containerQuantity;
-	/**
-	 * 保质期
-	 */
-	@ApiModelProperty(value = "保质期")
-	private Date warrantyPeriod;
-	/**
-	 * 频率
-	 */
-	@ApiModelProperty(value = "频率")
-	private String rate;
-	/**
-	 * 单价
-	 */
-	@ApiModelProperty(value = "单价")
-	private BigDecimal price;
-	/**
-	 * 工时
-	 */
-	@ApiModelProperty(value = "工时")
-	private BigDecimal workingHours;
 
 }

+ 83 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsFiles.java

@@ -0,0 +1,83 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品详情表实体类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+@Data
+@TableName("basic_goods_files")
+@ApiModel(value = "GoodsFiles对象", description = "商品上传表")
+public class GoodsFiles implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	//主键
+	@TableId
+	private Long id;
+	//主表id
+	private Long pid;
+    //排序
+	private int sort;
+	//文件名
+	private String fileName;
+	//文件地址
+	private String url;
+    //备注
+	private String remarks;
+    //版本
+	private String version;
+    //租户
+	private String tenantId;
+
+	private Long updateUser;
+	//创建人
+	private Long createUser;
+	//创建部门
+	private Long createDept;
+	//创建时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date createTime;
+	//修改时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date updateTime;
+	//状态(0 正常 1停用)
+	private Integer status;
+	//是否已删除(0 否 1是)
+	@TableLogic
+	private Integer isDeleted;
+
+
+
+
+}

+ 94 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsPrice.java

@@ -0,0 +1,94 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品详情表实体类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+@Data
+@TableName("basic_goods_price")
+@ApiModel(value = "GoodsDesc对象", description = "商品详情表")
+public class GoodsPrice implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	//主键
+	@TableId
+	private Long id;
+	//商品编码
+	private Long pid;
+	//单据类型
+	private String billType;
+	//供应商
+	private Long corpId;
+    //币别
+	private String currency;
+    //单价
+	private BigDecimal price;
+    //是否含税
+	private int ifTax;
+	//中文描述
+	private BigDecimal taxRate;
+	//单位
+	private String unit;
+	//备注
+	private String remarks;
+	//版本
+	private String version;
+	//租户
+	private String tenantId;
+	//海关中文
+	private Long updateUser;
+	//创建人
+	private Long createUser;
+	//创建部门
+	private Long createDept;
+	//创建时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date createTime;
+	//修改时间
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date updateTime;
+	//状态(0 正常 1停用)
+	private Integer status;
+	//是否已删除(0 否 1是)
+	@TableLogic
+	private Integer isDeleted;
+
+    //供应商
+	private String corpName;
+
+
+
+}

+ 62 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/ContainerTypeVO.java

@@ -0,0 +1,62 @@
+package org.springblade.client.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.client.entity.BasicContainerType;
+import org.springblade.client.entity.BasicPortType;
+import org.springblade.core.tool.node.INode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PortTypeVO对象", description = "港口类别表")
+public class ContainerTypeVO extends BasicContainerType implements INode<ContainerTypeVO>
+{
+
+	/**
+	 * 父级中文名
+	 */
+	@ApiModelProperty(value = "父级名称")
+	private String parentName;
+	/**
+	 * 创建人中文名
+	 */
+	@ApiModelProperty(value = "创建人中文名")
+	private String createUserName;
+	/**
+	 * 修改人中文名
+	 */
+	@ApiModelProperty(value = "修改人中文名")
+	private String updateUserName;
+	/**
+	 * 状态中文名
+	 */
+	@ApiModelProperty(value = "状态中文名")
+	private String statusName;
+	/**
+	 * 子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private List<ContainerTypeVO> children;
+	/**
+	 * 是否有子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private Boolean hasChildren;
+	@Override
+	public List<ContainerTypeVO> getChildren() {
+		if (this.children == null) {
+			this.children = new ArrayList<>();
+		}
+		return this.children;
+	}
+
+
+
+
+}

+ 61 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/PortTypeVO.java

@@ -0,0 +1,61 @@
+package org.springblade.client.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.client.entity.BasicPortType;
+import org.springblade.core.tool.node.INode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PortTypeVO对象", description = "港口类别表")
+public class PortTypeVO extends BasicPortType implements INode<PortTypeVO>
+{
+
+	/**
+	 * 父级中文名
+	 */
+	@ApiModelProperty(value = "父级名称")
+	private String parentName;
+	/**
+	 * 创建人中文名
+	 */
+	@ApiModelProperty(value = "创建人中文名")
+	private String createUserName;
+	/**
+	 * 修改人中文名
+	 */
+	@ApiModelProperty(value = "修改人中文名")
+	private String updateUserName;
+	/**
+	 * 状态中文名
+	 */
+	@ApiModelProperty(value = "状态中文名")
+	private String statusName;
+	/**
+	 * 子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private List<PortTypeVO> children;
+	/**
+	 * 是否有子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private Boolean hasChildren;
+	@Override
+	public List<PortTypeVO> getChildren() {
+		if (this.children == null) {
+			this.children = new ArrayList<>();
+		}
+		return this.children;
+	}
+
+
+
+
+}

+ 47 - 21
blade-service/blade-client/src/main/java/org/springblade/client/container/controller/ContainerController.java

@@ -3,6 +3,8 @@ package org.springblade.client.container.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.client.container.service.BasicContainerDescService;
 import org.springblade.client.container.service.BasicContainerTypeService;
@@ -15,6 +17,10 @@ import org.springblade.client.entity.BasicPortType;
 import org.springblade.client.port.service.BasicPortDescService;
 import org.springblade.client.port.service.BasicPortTypeDescService;
 import org.springblade.client.port.service.BasicPortTypeService;
+import org.springblade.client.vo.ContainerTypeVO;
+import org.springblade.client.vo.PortTypeVO;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
@@ -55,6 +61,7 @@ public class ContainerController
 	{
 		LambdaQueryWrapper<BasicContainerType> typeLambdaQueryWrapper=new LambdaQueryWrapper<>();
 		typeLambdaQueryWrapper
+			.eq(BasicContainerType::getTenantId,AuthUtil.getTenantId())
 			.eq(parentId!=null,BasicContainerType::getParentId,parentId)
 			.orderByDesc(BasicContainerType::getCreateTime);
 		Page<BasicContainerType> page=new Page<>(current,size);
@@ -72,27 +79,12 @@ public class ContainerController
 		return R.data(iPage);
 	}
 
-	@GetMapping("getContainerTypeList")
-	public List<BasicContainerType> getContainerTypeList( @RequestParam(name = "pid", required = false) Long pid)
-	{
-		LambdaQueryWrapper<BasicContainerType> lambdaQueryWrapper=new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(pid!=null,BasicContainerType::getParentId,pid);
-		List<BasicContainerType> typeList = basicContainerTypeService.list(lambdaQueryWrapper);
-		if(!CollectionUtils.isEmpty(typeList))
-		{
-			typeList.forEach(e->{
-				LambdaQueryWrapper<BasicContainerType> basicPortTypeLambdaQueryWrapper=new LambdaQueryWrapper<>();
-				basicPortTypeLambdaQueryWrapper.eq(BasicContainerType::getParentId,e.getId());
-				int count = basicContainerTypeService.count(basicPortTypeLambdaQueryWrapper);
-				e.setHasChildren(count>0?true:false);
-			});
-		}
-		return typeList;
-	}
+
 
 	@PostMapping("type/add")
 	public R typeList(@RequestBody BasicContainerType containerType )
 	{
+		containerType.setTenantId(AuthUtil.getTenantId());
 		containerType.setCreateTime(new Date());
 		containerType.setCreateUser(SecureUtil.getUserId());
 		containerType.setCreateUserName(SecureUtil.getUser().getRoleName());
@@ -113,6 +105,13 @@ public class ContainerController
 	@DeleteMapping("type/delet")
 	public R  typeDelet(@RequestParam(name = "id", required = true) Long id)
 	{
+		LambdaQueryWrapper<BasicContainerType> typeLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		typeLambdaQueryWrapper.eq(BasicContainerType::getParentId,id);
+		int count=basicContainerTypeService.count(typeLambdaQueryWrapper);
+		if(count>0)
+		{
+			throw new RuntimeException("存在子项无法删除");
+		}
 		List<Long> ids= Arrays.asList(id);
 		basicContainerTypeService.deleteLogic(ids);
 		return R.success("操作成功");
@@ -125,16 +124,17 @@ public class ContainerController
 				  @RequestParam(name = "size", defaultValue = "10") Integer size,
 				  @RequestParam(name = "name", required = false) String name,
 				  @RequestParam(name = "code", required = false) String code,
+				  @RequestParam(name = "typeId", required = false) Long typeId,
 				  @RequestParam(name = "status", required = false) String status)
 	{
 		Page<BasicContainerDescDTO> page=new Page<>(current,size);
-		IPage<BasicContainerDescDTO> iPage = basicContainerDescService.listBasicContainerDesc(page, name, code, status);
+		IPage<BasicContainerDescDTO> iPage = basicContainerDescService.listBasicContainerDesc(page, name, code, status,typeId,AuthUtil.getTenantId());
 		return R.data(iPage);
 	}
 
 	@PostMapping("add")
 	public R add (@RequestBody BasicContainerDescDTO dto)
-	{
+	{   dto.setTenantId(AuthUtil.getTenantId());
 		dto.setCreateTime(new Date());
 		dto.setCreateUser(SecureUtil.getUserId());
 		dto.setCreateUserName(SecureUtil.getUser().getRoleName());
@@ -143,12 +143,12 @@ public class ContainerController
 	}
 
 	@PutMapping("edit")
-	public R edit( @RequestBody BasicContainerDesc body )
+	public R edit( @RequestBody BasicContainerDescDTO body )
 	{
 		body.setUpdateTime(new Date());
 		body.setUpdateUser(SecureUtil.getUserId());
 		body.setUpdateUserName(SecureUtil.getUser().getRoleName());
-		basicContainerDescService.updateById(body);
+		basicContainerDescService.updateBasicPortDesc(body);
 		return R.success("操作成功");
 	}
 
@@ -160,5 +160,31 @@ public class ContainerController
 		return R.success("操作成功");
 	}
 
+	@GetMapping("/type/tree")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "树形结构", notes = "树形结构")
+	public R<List<ContainerTypeVO>> tree(String tenantId, BladeUser bladeUser) {
+		List<ContainerTypeVO> ContainerTypeVO = basicContainerDescService.tree(AuthUtil.getTenantId());
+		return R.data(ContainerTypeVO);
+	}
+
+	@GetMapping("getContainerTypeList")
+	public List<BasicContainerType> getPortTypeList( @RequestParam(name = "pid", required = false) Long pid)
+	{
+		LambdaQueryWrapper<BasicContainerType> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(pid!=null,BasicContainerType::getParentId,pid);
+		lambdaQueryWrapper.eq(BasicContainerType::getTenantId,AuthUtil.getTenantId());
+		List<BasicContainerType> typeList = basicContainerTypeService.list(lambdaQueryWrapper);
+		if(!CollectionUtils.isEmpty(typeList))
+		{
+			typeList.forEach(e->{
+				LambdaQueryWrapper<BasicContainerType> basicPortTypeLambdaQueryWrapper=new LambdaQueryWrapper<>();
+				basicPortTypeLambdaQueryWrapper.eq(BasicContainerType::getParentId,e.getId());
+				int count = basicContainerTypeService.count(basicPortTypeLambdaQueryWrapper);
+				e.setHasChildren(count>0?true:false);
+			});
+		}
+		return typeList;
+	}
 
 }

+ 7 - 1
blade-service/blade-client/src/main/java/org/springblade/client/container/mapper/BasicContainerDescMapper.java

@@ -8,6 +8,10 @@ import org.springblade.client.dto.BasicContainerDescDTO;
 import org.springblade.client.entity.BasicContainerDesc;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.springblade.client.vo.ContainerTypeVO;
+import org.springblade.client.vo.PortTypeVO;
+
+import java.util.List;
 
 /**
  *
@@ -19,5 +23,7 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface BasicContainerDescMapper extends BaseMapper<BasicContainerDesc>
 {
-      IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page,@Param("containerName") String containerName,@Param("code") String code,@Param("status") String status);
+      IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page,@Param("containerName") String containerName,@Param("code") String code,@Param("status") String status,@Param("typeId") Long typeId,@Param("tenantId") String tenantId);
+
+	  List<ContainerTypeVO> tree(@Param("tenantId") String tenantId);
 }

+ 36 - 2
blade-service/blade-client/src/main/java/org/springblade/client/container/mapper/BasicContainerDescMapper.xml

@@ -3,6 +3,16 @@
 
 <mapper namespace="org.springblade.client.container.mapper.BasicContainerDescMapper">
 
+    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
+        <id column="id" property="id"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="title" property="title"/>
+        <result column="value" property="value"/>
+        <result column="key" property="key"/>
+        <result column="has_children" property="hasChildren"/>
+    </resultMap>
+
+
     <select id="listBasicContainerDesc" resultType="org.springblade.client.dto.BasicContainerDescDTO">
         SELECT
         b.id as id,
@@ -23,21 +33,27 @@
         b.update_user_name as updateUserName,
         b.create_user_name as createUserName,
         b.`status` as `status`,
-        a.`name` as typeName
+        a.`name` as typeName,
+        a.id as typeId
         FROM
         basic_container_type a,
         basic_container_desc b,
         basic_container_type_desc c
         WHERE
-        a.id = c.container_type_id
+        b.tenant_id=#{tenantId}
+        and a.id = c.container_type_id
         AND b.id = c.container_id
         and b.is_deleted=0
+        and c.is_deleted=0
         <if test="containerName != null and containerName != ''">
             AND b.`name` LIKE CONCAT('%',#{containerName,jdbcType=VARCHAR},'%')
         </if>
         <if test="code != null and code != ''">
             AND b.`code`=#{code}
         </if>
+        <if test="typeId != null">
+            AND a.id=#{typeId}
+        </if>
         <if test="status != null and status != ''">
             AND b.status in
             (
@@ -50,4 +66,22 @@
 
     </select>
 
+
+    <select id="tree" resultMap="treeNodeResultMap">
+        SELECT
+        id,
+        parent_id,
+        name AS title,
+        id AS "value",
+        id AS "key"
+        FROM
+        basic_container_type
+        WHERE
+        is_deleted = 0
+        and status = 0
+        <if test="tenantId!=null and tenantId!=''">
+            and tenant_id = #{tenantId}
+        </if>
+        ORDER BY sort
+    </select>
 </mapper>

+ 8 - 1
blade-service/blade-client/src/main/java/org/springblade/client/container/service/BasicContainerDescService.java

@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.client.dto.BasicContainerDescDTO;
+import org.springblade.client.dto.BasicPortDescDTO;
 import org.springblade.client.entity.BasicContainerDesc;
+import org.springblade.client.vo.ContainerTypeVO;
+import org.springblade.client.vo.PortTypeVO;
 import org.springblade.core.mp.base.BaseService;
 
 import java.util.List;
@@ -21,7 +24,11 @@ import java.util.Map;
  */
 public interface BasicContainerDescService extends BaseService<BasicContainerDesc>
 {
-	IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page,String containerName, String code, String status);
+	IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page,String containerName, String code, String status,Long typeId,String tenantId);
 
 	void addBasicContainerDesc(BasicContainerDescDTO dto);
+
+	List<ContainerTypeVO> tree(String tenantId);
+
+	void updateBasicPortDesc(BasicContainerDescDTO dto);
 }

+ 76 - 8
blade-service/blade-client/src/main/java/org/springblade/client/container/service/imp/BasicContainerDescServiceImpl.java

@@ -1,6 +1,9 @@
 package org.springblade.client.container.service.imp;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springblade.client.container.mapper.BasicContainerDescMapper;
 import org.springblade.client.container.mapper.BasicContainerTypeDescMapper;
@@ -8,11 +11,13 @@ import org.springblade.client.container.mapper.BasicContainerTypeMapper;
 import org.springblade.client.container.service.BasicContainerDescService;
 import org.springblade.client.container.service.BasicContainerTypeService;
 import org.springblade.client.dto.BasicContainerDescDTO;
-import org.springblade.client.entity.BasicContainerDesc;
-import org.springblade.client.entity.BasicContainerType;
-import org.springblade.client.entity.BasicContainerTypeDesc;
+import org.springblade.client.entity.*;
+import org.springblade.client.vo.ContainerTypeVO;
+import org.springblade.client.vo.PortTypeVO;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,9 +27,7 @@ import javax.validation.constraints.NotBlank;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-
-
-
+import java.util.stream.Collectors;
 
 
 @Service
@@ -36,8 +39,8 @@ public class BasicContainerDescServiceImpl extends BaseServiceImpl<BasicContaine
 	private BasicContainerTypeDescMapper basicContainerTypeDescMapper;
 
 	@Override
-	public IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page, String containerName, String code, String status) {
-		return basicContainerDescMapper.listBasicContainerDesc(page,containerName,code,status);
+	public IPage<BasicContainerDescDTO> listBasicContainerDesc(Page<BasicContainerDescDTO> page, String containerName, String code, String status,Long typeId,String tenantId) {
+		return basicContainerDescMapper.listBasicContainerDesc(page,containerName,code,status,typeId,tenantId);
 	}
 
 	@Override
@@ -62,4 +65,69 @@ public class BasicContainerDescServiceImpl extends BaseServiceImpl<BasicContaine
 		 middle.setCreateUserName(SecureUtil.getUser().getRoleName());
 		 basicContainerTypeDescMapper.insert(middle);
 	}
+
+	@Override
+	public List<ContainerTypeVO> tree(String tenantId)
+	{
+		if (StringUtils.isBlank(tenantId)) {
+			tenantId = SecureUtil.getTenantId();
+		}
+		return ForestNodeMerger.merge(basicContainerDescMapper.tree(tenantId));
+	}
+
+	@Override
+	public void updateBasicPortDesc(BasicContainerDescDTO dto)
+	{
+		//类型id
+		Long typeId = dto.getTypeId();
+		BasicContainerDesc basicContainerDesc=new BasicContainerDesc();
+		BeanUtils.copyProperties(dto,basicContainerDesc);
+		basicContainerDescMapper.updateById(basicContainerDesc);
+
+		//查询中间关系表, 是否需要解绑
+		LambdaQueryWrapper<BasicContainerTypeDesc> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(BasicContainerTypeDesc::getContainerId,basicContainerDesc.getId());
+		List<BasicContainerTypeDesc> basicContainerTypeDescs = basicContainerTypeDescMapper.selectList(lambdaQueryWrapper);
+
+		//如果存在绑定关系,检查是否需要换绑
+		if(!CollectionUtils.isEmpty(basicContainerTypeDescs))
+		{
+			List<BasicContainerTypeDesc> collect = basicContainerTypeDescs.stream().filter(e -> e.getContainerTypeId() == typeId).collect(Collectors.toList());
+			//如果为空,解绑操作
+			if(CollectionUtils.isEmpty(collect))
+			{
+				basicContainerTypeDescs.forEach(e->{
+					basicContainerTypeDescMapper.deleteById(e.getId());
+				});
+
+				BasicContainerTypeDesc middle=new BasicContainerTypeDesc();
+				middle.setContainerId(basicContainerDesc.getId());
+				middle.setTenantId(AuthUtil.getTenantId());
+				middle.setContainerTypeId(typeId);
+				middle.setCreateTime(new Date());
+				middle.setCreateUser(SecureUtil.getUserId());
+				middle.setCreateUserName(SecureUtil.getUser().getRoleName());
+				basicContainerTypeDescMapper.insert(middle);
+
+
+
+
+			}
+
+		}
+		//如果没有绑定关系,则完成新增
+		else
+		{
+			BasicContainerTypeDesc middle=new BasicContainerTypeDesc();
+			middle.setContainerId(basicContainerDesc.getId());
+			middle.setTenantId(AuthUtil.getTenantId());
+			middle.setContainerTypeId(typeId);
+			middle.setCreateTime(new Date());
+			middle.setCreateUser(SecureUtil.getUserId());
+			middle.setCreateUserName(SecureUtil.getUser().getRoleName());
+			basicContainerTypeDescMapper.insert(middle);
+		}
+
+
+	}
 }

+ 94 - 7
blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescController.java

@@ -17,6 +17,9 @@
 package org.springblade.client.goods.controller;
 
 import com.alibaba.nacos.api.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -25,20 +28,28 @@ import lombok.AllArgsConstructor;
 import javax.validation.Valid;
 
 import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.entity.GoodsPrice;
 import org.springblade.client.entity.GoodsType;
 import org.springblade.client.goods.enums.GoodsTypeEnum;
+import org.springblade.client.goods.service.IGoodsFilesService;
+import org.springblade.client.goods.service.IGoodsPriceService;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.client.vo.GoodsDescVO;
 import org.springblade.client.goods.service.IGoodsDescService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * 商品详情表 控制器
  *
@@ -52,7 +63,10 @@ import org.springblade.core.boot.ctrl.BladeController;
 public class GoodsDescController extends BladeController {
 
 	private final IGoodsDescService goodsDescService;
-
+	@Autowired
+	private IGoodsPriceService goodsPriceService;
+    @Autowired
+	private IGoodsFilesService goodsFilesService;
 	/**
 	 * 详情
 	 */
@@ -72,12 +86,85 @@ public class GoodsDescController extends BladeController {
 	@GetMapping("/list")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入goodsDesc")
-	public R<IPage<GoodsDescVO>> list(GoodsDescVO goodsDesc, Query query) {
-		goodsDesc.setTenantId(AuthUtil.getTenantId());
-		goodsDesc.setIsDeleted(0);
-		goodsDesc.setType(GoodsTypeEnum.GOODS.getType());
-		IPage<GoodsDescVO> pages = goodsDescService.selectGoodsDescPage(Condition.getPage(query),goodsDesc);
-		return R.data(pages);
+		public R<IPage<GoodsDescVO>> list(GoodsDescVO goodsDesc, Query query) {
+			goodsDesc.setTenantId(SecureUtil.getTenantId());
+			goodsDesc.setIsDeleted(0);
+			IPage<GoodsDescVO> pages = goodsDescService.selectGoodsDescPage(Condition.getPage(query),goodsDesc);
+			return R.data(pages);
+		}
+
+
+	@GetMapping("/descList")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入goodsDesc")
+	public R<?> list(@RequestParam(name = "current", defaultValue = "1") Integer current,
+					 @RequestParam(name = "size", defaultValue = "10") Integer size,
+					 @RequestParam(name = "cname", required = false) String cname,
+					 @RequestParam(name = "code", required = false) String code,
+					 @RequestParam(name = "goodsTypeId", required = false) String goodsTypeId
+					 )
+	{
+		LambdaQueryWrapper<GoodsDesc> goodsDescLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		goodsDescLambdaQueryWrapper
+			.eq(!StringUtils.isBlank(goodsTypeId),GoodsDesc::getGoodsTypeId,goodsTypeId)
+			.like(!StringUtils.isBlank(cname),GoodsDesc::getCname,cname)
+			.like(!StringUtils.isBlank(code),GoodsDesc::getCode,code)
+			.eq(GoodsDesc::getTenantId,AuthUtil.getTenantId())
+			.eq(GoodsDesc::getType,0)
+		    .orderByDesc(GoodsDesc::getCreateTime);
+		Page<GoodsDesc> page=new Page<>(current,size);
+		IPage<GoodsDesc> iPage=goodsDescService.page(page,goodsDescLambdaQueryWrapper);
+		return R.data(iPage);
+	}
+
+	@GetMapping("/findById")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入goodsDesc")
+	public R list(@RequestParam(name = "id", required = true) String id)
+	{
+		GoodsDesc goodsDesc = goodsDescService.getById(id);
+		LambdaQueryWrapper<GoodsPrice> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(GoodsPrice::getPid,id);
+		List<GoodsPrice> priceList = goodsPriceService.list(lambdaQueryWrapper);
+
+		LambdaQueryWrapper<GoodsFiles> filesLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		filesLambdaQueryWrapper.eq(GoodsFiles::getPid,id);
+		List<GoodsFiles> filesList = goodsFilesService.list(filesLambdaQueryWrapper);
+		if(!CollectionUtils.isEmpty(priceList))
+		{
+			List<GoodsPrice> sale = priceList.stream().filter(e -> e.getBillType().equals("0")).collect(Collectors.toList());
+			List<GoodsPrice> buy = priceList.stream().filter(e -> e.getBillType().equals("1")).collect(Collectors.toList());
+			goodsDesc.setSaleGoodsPrice(sale);
+			goodsDesc.setBuyGoodsPrice(buy);
+			goodsDesc.setFilesList(filesList);
+		}
+		return R.data(goodsDesc);
+	}
+
+	/**
+	 * 分页 商品详情表
+	 */
+	@PostMapping("/modify")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入goodsDesc")
+	public R<?> modify(@RequestBody GoodsDesc goodsDesc)
+	{
+		goodsDescService.modify(goodsDesc);
+		return R.success("操作成功");
+	}
+
+	@DeleteMapping("delete")
+	public R delete(@RequestParam(name = "id", required = true) String id)
+	{
+		 goodsDescService.removeById(id);
+		return R.success("操作成功");
+	}
+
+	@DeleteMapping("priceDelete")
+	public R priceDelete(@RequestParam(name = "id", required = true) String id)
+	{
+		goodsPriceService.removeById(id);
+		return R.success("操作成功");
 	}
 
 	/**

+ 76 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsFilesController.java

@@ -0,0 +1,76 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.goods.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.entity.GoodsType;
+import org.springblade.client.goods.enums.GoodsTypeEnum;
+import org.springblade.client.goods.service.IGoodsFilesService;
+import org.springblade.client.goods.service.IGoodsTypeService;
+import org.springblade.client.vo.GoodsTypeVO;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 商品类别表 控制器
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/goodsfiles")
+@Api(value = "商品文件表", tags = "商品文件表接口")
+public class GoodsFilesController extends BladeController
+{
+     @Autowired
+	private IGoodsFilesService goodsFilesService;
+
+    @PostMapping("add")
+    public  R add(@RequestBody GoodsFiles goodsFiles)
+	{
+		goodsFilesService.save(goodsFiles);
+		return R.success("操作成功");
+	}
+
+	@DeleteMapping("delete")
+	public R delete(@RequestParam(name = "id", required = true) String id)
+	{
+		goodsFilesService.removeById(id);
+		return R.success("操作成功");
+	}
+
+
+}

+ 1 - 1
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.java

@@ -22,7 +22,7 @@ public interface GoodsDescMapper extends BaseMapper<GoodsDesc> {
 	 * @param goodsDesc
 	 * @return
 	 */
-	List<GoodsDescVO> selectGoodsDescPage(IPage page, @Param("GoodsDesc") GoodsDescVO goodsDesc);
+	List<GoodsDescVO> selectGoodsDescPage(IPage page, @Param("GoodsDesc") GoodsDescVO goodsDesc,@Param("tenantId")String tenantId);
 
 	/**
 	 * 查询商品编码

+ 32 - 10
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.xml

@@ -7,24 +7,44 @@
         <id column="id" property="id"/>
         <result column="code" property="code"/>
         <result column="cname" property="cname"/>
+        <result column="cname" property="cname"/>
+        <result column="name_description" property="nameDescription"/>
+        <result column="cname_description" property="cnameDescription"/>
         <result column="typeno" property="typeno"/>
+        <result column="etypeno" property="etypeno"/>
+        <result column="custom_code" property="customCode"/>
+        <result column="custom_name" property="customName"/>
+        <result column="custom_ename" property="customEname"/>
+        <result column="custom_rate" property="customRate"/>
+        <result column="unit" property="unit"/>
         <result column="brand" property="brand"/>
-        <result column="brand_item" property="brandItem"/>
+        <result column="branditem" property="branditem"/>
         <result column="specs" property="specs"/>
         <result column="category" property="category"/>
-        <result column="category_item" property="categoryItem"/>
+        <result column="categoryitem" property="categoryitem"/>
         <result column="providers" property="providers"/>
-        <result column="unit" property="unit"/>
+        <result column="length_unit" property="lengthUnit"/>
+        <result column="weight_unit" property="weightUnit"/>
         <result column="packgeunit" property="packgeunit"/>
-        <result column="container_quantity" property="containerQuantity"/>
+        <result column="cntr_size" property="cntrSize"/>
+        <result column="single_volumn" property="singleVolumn"/>
+        <result column="single_gross_weight" property="singleGrossWeight"/>
+        <result column="single_weight" property="singleWeight"/>
+        <result column="single_cntr" property="singleCntr"/>
+        <result column="cntr_volumn" property="cntrVolumn"/>
+        <result column="cntr_gross_weight" property="cntrGrossWeight"/>
+        <result column="cntr_weight" property="cntrWeight"/>
+        <result column="cntr_quantity" property="cntrQuantity"/>
+        <result column="package_description" property="packageDescription"/>
+        <result column="Container_quantity" property="containerQuantity"/>
+        <result column="url" property="url"/>
         <result column="warranty_period" property="warrantyPeriod"/>
         <result column="rate" property="rate"/>
-        <result column="type" property="type"/>
-        <result column="price" property="price"/>
-        <result column="working_hours" property="workingHours"/>
-        <result column="url" property="url"/>
+        <result column="Price" property="price"/>
+        <result column="Working_hours" property="workingHours"/>
         <result column="remarks" property="remarks"/>
         <result column="version" property="version"/>
+        <result column="tenant_id" property="tenantId"/>
         <result column="create_user" property="createUser"/>
         <result column="create_dept" property="createDept"/>
         <result column="create_time" property="createTime"/>
@@ -32,6 +52,8 @@
         <result column="update_time" property="updateTime"/>
         <result column="status" property="status"/>
         <result column="is_deleted" property="isDeleted"/>
+        <result column="type" property="type"/>
+        <result column="goods_type_id" property="goodsTypeId"/>
     </resultMap>
 
 
@@ -75,8 +97,8 @@
         <if test="GoodsDesc.packgeunit!=null and GoodsDesc.packgeunit != ''">
             and packgeunit = #{GoodsDesc.packgeunit}
         </if>
-        <if test="GoodsDesc.tenantId!=null and GoodsDesc.tenantId != ''">
-            and tenant_id = #{GoodsDesc.tenantId}
+        <if test="tenantId!=null and tenantId != ''">
+            and tenant_id = #{tenantId}
         </if>
         <if test="GoodsDesc.url!=null and GoodsDesc.url != ''">
             and url = #{GoodsDesc.url}

+ 23 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsFilesMapper.java

@@ -0,0 +1,23 @@
+package org.springblade.client.goods.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.vo.GoodsDescVO;
+
+import java.util.List;
+
+/**
+ * 商品详情表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+public interface GoodsFilesMapper extends BaseMapper<GoodsFiles>
+{
+
+
+
+}

+ 7 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsFilesMapper.xml

@@ -0,0 +1,7 @@
+<?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="org.springblade.client.goods.mapper.GoodsFilesMapper">
+
+
+
+</mapper>

+ 23 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsPriceMapper.java

@@ -0,0 +1,23 @@
+package org.springblade.client.goods.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsPrice;
+import org.springblade.client.vo.GoodsDescVO;
+
+import java.util.List;
+
+/**
+ * 商品详情表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+public interface GoodsPriceMapper extends BaseMapper<GoodsPrice>
+{
+
+
+
+}

+ 7 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsPriceMapper.xml

@@ -0,0 +1,7 @@
+<?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="org.springblade.client.goods.mapper.GoodsPriceMapper">
+
+
+
+</mapper>

+ 2 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsDescService.java

@@ -77,4 +77,6 @@ public interface IGoodsDescService extends IService<GoodsDesc> {
 	 * @return
 	 */
 	GoodsDesc selectGoodsMessage(Long Id);
+
+	void modify(GoodsDesc goodsDesc);
 }

+ 35 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsFilesService.java

@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.goods.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.vo.GoodsDescVO;
+
+/**
+ * 商品详情表 服务类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+public interface IGoodsFilesService extends IService<GoodsFiles>
+{
+
+
+}

+ 34 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/IGoodsPriceService.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.goods.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsPrice;
+import org.springblade.client.vo.GoodsDescVO;
+
+/**
+ * 商品详情表 服务类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+public interface IGoodsPriceService extends IService<GoodsPrice> {
+
+
+}

+ 119 - 6
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java

@@ -24,20 +24,20 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.entity.GoodsPrice;
 import org.springblade.client.entity.GoodsTypeDesc;
-import org.springblade.client.goods.mapper.GoodsDescMapper;
+import org.springblade.client.goods.mapper.*;
 import org.springblade.client.goods.service.IGoodsDescService;
 import org.springblade.client.vo.GoodsDescVO;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * 商品详情表 服务实现类
@@ -50,6 +50,17 @@ import java.util.Objects;
 public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc> implements IGoodsDescService {
 	private GoodsTypeDescServiceImpl goodsTypeDescService;  //商品-商品类别对应表
 	private GoodsTypeServiceImpl goodsTypeService;//商品类别信息
+	@Autowired
+	private GoodsTypeMapper goodsTypeMapper;
+	@Autowired
+	private GoodsDescMapper goodsDescMapper;
+	@Autowired
+	private GoodsPriceMapper goodsPriceMapper;
+	@Autowired
+	private GoodsTypeDescMapper goodsTypeDescMapper;
+	@Autowired
+	private GoodsFilesMapper goodsFilesMapper;
+
 
 	@Override
 	public IPage<GoodsDescVO> selectGoodsDescPage(IPage<GoodsDescVO> page, GoodsDescVO goodsDesc) {
@@ -58,7 +69,7 @@ public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc
 			List<Long> longList = goodsTypeService.goodTypeIdList(goodsDesc.getGoodsTypeId());
 			goodsDesc.setGoodsTypeIdList(longList);
 		}
-		return page.setRecords(baseMapper.selectGoodsDescPage(page, goodsDesc));
+		return page.setRecords(baseMapper.selectGoodsDescPage(page, goodsDesc,AuthUtil.getTenantId()));
 	}
 
 	@Override
@@ -162,4 +173,106 @@ public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc
 		return baseMapper.selectGoodsMessage(Id);
 	}
 
+	@Override
+	@Transactional
+	public void modify(GoodsDesc goodsDesc)
+	{
+		List<GoodsFiles> filesList = goodsDesc.getFilesList();
+		List<GoodsPrice> chilList=new ArrayList<>();
+		if(CollectionUtils.isNotEmpty(goodsDesc.getBuyGoodsPrice()))
+		{
+			chilList.addAll(goodsDesc.getBuyGoodsPrice());
+		}
+		if(CollectionUtils.isNotEmpty(goodsDesc.getSaleGoodsPrice()))
+		{
+			chilList.addAll(goodsDesc.getSaleGoodsPrice());
+		}
+
+
+		Long id = goodsDesc.getId();
+		//代表主表、子表都是新增,
+		if(id==null)
+		{
+			goodsDesc.setTenantId(AuthUtil.getTenantId());
+			goodsDesc.setCreateTime(new Date());
+			goodsDesc.setCreateUser(SecureUtil.getUserId());
+			 goodsDescMapper.insert(goodsDesc);
+			 if(!CollectionUtils.isEmpty(chilList))
+			 {
+				 chilList.forEach(e->{
+					 e.setTenantId(AuthUtil.getTenantId());
+					 e.setPid(goodsDesc.getId());
+					 e.setCreateTime(new Date());
+					 e.setCreateUser(SecureUtil.getUserId());
+					 goodsPriceMapper.insert(e);
+				 });
+			 }
+			//文件上传
+			 if(!CollectionUtils.isEmpty(filesList))
+			 {
+				 filesList.forEach(k->{
+					 k.setTenantId(AuthUtil.getTenantId());
+					 k.setPid(goodsDesc.getId());
+					 k.setCreateTime(new Date());
+					 k.setCreateUser(SecureUtil.getUserId());
+					 goodsFilesMapper.insert(k);
+				 });
+			 }
+
+
+
+		}
+		//主表修改,子表看情况
+		else
+		{
+			goodsDescMapper.updateById(goodsDesc);
+			//价格列表
+			if(CollectionUtils.isNotEmpty(chilList))
+			{
+				chilList.forEach(e->{
+					//新增
+					if(e.getId()==null)
+					{
+						e.setTenantId(AuthUtil.getTenantId());
+						e.setPid(goodsDesc.getId());
+						e.setCreateTime(new Date());
+						e.setCreateUser(SecureUtil.getUserId());
+						goodsPriceMapper.insert(e);
+					}
+					//修改
+					else
+					{
+						e.setUpdateTime(new Date());
+						e.setUpdateUser(SecureUtil.getUserId());
+						goodsPriceMapper.updateById(e);
+					}
+				});
+			}
+
+			//文件列表
+			if(CollectionUtils.isNotEmpty(filesList))
+			{
+				filesList.forEach(k->{
+					//新增
+					if(k.getId()==null)
+					{
+						k.setTenantId(AuthUtil.getTenantId());
+						k.setPid(goodsDesc.getId());
+						k.setCreateTime(new Date());
+						k.setCreateUser(SecureUtil.getUserId());
+						goodsFilesMapper.insert(k);
+					}
+					//修改
+					else
+					{
+						k.setUpdateTime(new Date());
+						k.setUpdateUser(SecureUtil.getUserId());
+						goodsFilesMapper.updateById(k);
+					}
+				});
+			}
+
+		}
+	}
+
 }

+ 54 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsFilesServiceImpl.java

@@ -0,0 +1,54 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.goods.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsFiles;
+import org.springblade.client.entity.GoodsPrice;
+import org.springblade.client.entity.GoodsTypeDesc;
+import org.springblade.client.goods.mapper.*;
+import org.springblade.client.goods.service.IGoodsDescService;
+import org.springblade.client.goods.service.IGoodsFilesService;
+import org.springblade.client.vo.GoodsDescVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+ * 商品详情表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+@Service
+@AllArgsConstructor
+public class GoodsFilesServiceImpl extends ServiceImpl<GoodsFilesMapper, GoodsFiles> implements IGoodsFilesService {
+
+
+}

+ 56 - 0
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsPriceServiceImpl.java

@@ -0,0 +1,56 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.goods.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.client.entity.GoodsDesc;
+import org.springblade.client.entity.GoodsPrice;
+import org.springblade.client.entity.GoodsTypeDesc;
+import org.springblade.client.goods.mapper.GoodsDescMapper;
+import org.springblade.client.goods.mapper.GoodsPriceMapper;
+import org.springblade.client.goods.service.IGoodsDescService;
+import org.springblade.client.goods.service.IGoodsPriceService;
+import org.springblade.client.vo.GoodsDescVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 商品详情表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-09-18
+ */
+@Service
+@AllArgsConstructor
+public class GoodsPriceServiceImpl extends ServiceImpl<GoodsPriceMapper, GoodsPrice> implements IGoodsPriceService {
+
+
+}

+ 38 - 3
blade-service/blade-client/src/main/java/org/springblade/client/port/controller/PortController.java

@@ -4,26 +4,37 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.ApiOperation;
 import io.undertow.attribute.SubstituteEmptyWrapper;
 import lombok.AllArgsConstructor;
+import lombok.Data;
 import oracle.jdbc.proxy.annotation.Post;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.client.container.service.BasicContainerDescService;
 import org.springblade.client.container.service.BasicContainerTypeService;
 import org.springblade.client.dto.BasicPortDescDTO;
+import org.springblade.client.entity.BasicContainerType;
 import org.springblade.client.entity.BasicPortDesc;
 import org.springblade.client.entity.BasicPortType;
+import org.springblade.client.goods.enums.GoodsTypeEnum;
 import org.springblade.client.port.service.BasicPortDescService;
 import org.springblade.client.port.service.BasicPortTypeDescService;
 import org.springblade.client.port.service.BasicPortTypeService;
+import org.springblade.client.vo.GoodsTypeVO;
+import org.springblade.client.vo.PortTypeVO;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -52,16 +63,18 @@ public class PortController
 				  @RequestParam(name = "name", required = false) String name,
 				  @RequestParam(name = "lines", required = false) String lines,
 				  @RequestParam(name = "unCode", required = false) String unCode,
+				  @RequestParam(name = "typeId", required = false) Long typeId,
 				  @RequestParam(name = "status", required = false) String status)
 	{
 		Page<BasicPortDescDTO> page=new Page<>(current,size);
-		IPage<BasicPortDescDTO> iPage = basicPortDescService.listBasicPortDesc(page, name, lines, unCode, status);
+		IPage<BasicPortDescDTO> iPage = basicPortDescService.listBasicPortDesc(page, name, lines, unCode, status,typeId,AuthUtil.getTenantId());
 		return R.data(iPage);
 	}
 
     @PostMapping("add")
 	public R add (@RequestBody BasicPortDescDTO dto)
 	{
+		dto.setTenantId(AuthUtil.getTenantId());
 		dto.setCreateTime(new Date());
 		dto.setCreateUser(SecureUtil.getUserId());
 		dto.setCreateUserName(SecureUtil.getUser().getRoleName());
@@ -70,12 +83,12 @@ public class PortController
 	}
 
 	@PutMapping("edit")
-	public R edit( @RequestBody BasicPortDesc body )
+	public R edit( @RequestBody BasicPortDescDTO body )
 	{
 		body.setUpdateTime(new Date());
 		body.setUpdateUser(SecureUtil.getUserId());
 		body.setUpdateUserName(SecureUtil.getUser().getRoleName());
-		basicPortDescService.updateById(body);
+		basicPortDescService.updateBasicPortDesc(body);
 		return R.success("操作成功");
 	}
 
@@ -90,11 +103,16 @@ public class PortController
 	@GetMapping("type/list")
 	public R typeList(@RequestParam(name = "current", defaultValue = "1") Integer current,
 					  @RequestParam(name = "size", defaultValue = "10") Integer size,
+					  @RequestParam(name = "portName", required = false) String portName ,
+					  @RequestParam(name = "status", required = false) Integer status,
 					  @RequestParam(name = "parentId", required = false) Long parentId)
 
 	{
 		LambdaQueryWrapper<BasicPortType> typeLambdaQueryWrapper=new LambdaQueryWrapper<>();
 		typeLambdaQueryWrapper
+			.eq(BasicPortType::getTenantId,AuthUtil.getTenantId())
+			.like(StringUtils.isNotBlank(portName),BasicPortType::getName,portName)
+			.eq(status!=null,BasicPortType::getStatus,status)
 			.eq(parentId!=null,BasicPortType::getParentId,parentId)
 		    .orderByDesc(BasicPortType::getCreateTime);
 		Page<BasicPortType> page=new Page<>(current,size);
@@ -118,6 +136,7 @@ public class PortController
 	{
 		LambdaQueryWrapper<BasicPortType> lambdaQueryWrapper=new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(pid!=null,BasicPortType::getParentId,pid);
+		lambdaQueryWrapper.eq(BasicPortType::getTenantId,AuthUtil.getTenantId());
 		List<BasicPortType> typeList = basicPortTypeService.list(lambdaQueryWrapper);
 		if(!CollectionUtils.isEmpty(typeList))
 		{
@@ -134,6 +153,7 @@ public class PortController
 	@PostMapping("type/add")
 	public R typeList(@RequestBody BasicPortType portType )
 	{
+		portType.setTenantId(AuthUtil.getTenantId());
 		portType.setCreateTime(new Date());
 		portType.setCreateUser(SecureUtil.getUserId());
 		portType.setCreateUserName(SecureUtil.getUser().getRoleName());
@@ -154,11 +174,26 @@ public class PortController
 	@DeleteMapping("type/delete")
 	public R  typeDelet(@RequestParam(name = "id", required = true) Long id)
 	{
+		LambdaQueryWrapper<BasicPortType> typeLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		typeLambdaQueryWrapper.eq(BasicPortType::getParentId,id);
+		int count=basicPortTypeService.count(typeLambdaQueryWrapper);
+		if(count>0)
+		{
+			throw new RuntimeException("存在子项无法删除");
+		}
+
 		List<Long> ids= Arrays.asList(id);
 		basicPortTypeService.deleteLogic(ids);
 		return R.success("操作成功");
 	}
 
+	@GetMapping("/type/tree")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "树形结构", notes = "树形结构")
+	public R<List<PortTypeVO>> tree(String tenantId, BladeUser bladeUser) {
+		List<PortTypeVO> portTypeVOS = basicPortDescService.tree(AuthUtil.getTenantId());
+		return R.data(portTypeVOS);
+	}
 
 
 

+ 7 - 1
blade-service/blade-client/src/main/java/org/springblade/client/port/mapper/BasicPortDescMapper.java

@@ -8,6 +8,10 @@ import org.springblade.client.dto.BasicPortDescDTO;
 import org.springblade.client.entity.BasicContainerDesc;
 import org.apache.ibatis.annotations.Mapper;
 import org.springblade.client.entity.BasicPortDesc;
+import org.springblade.client.vo.GoodsTypeVO;
+import org.springblade.client.vo.PortTypeVO;
+
+import java.util.List;
 
 /**
  *
@@ -19,5 +23,7 @@ import org.springblade.client.entity.BasicPortDesc;
 @Mapper
 public interface BasicPortDescMapper extends BaseMapper<BasicPortDesc>
 {
-   IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page, @Param("portName") String portName, @Param("lines")String lines,@Param("unCode") String unCode,@Param("status") String status);
+   IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page, @Param("portName") String portName, @Param("lines")String lines,@Param("unCode") String unCode,@Param("status") String status,@Param("typeId") Long typeId,@Param("tenantId") String tenantId);
+
+	List<PortTypeVO> tree(@Param("tenantId") String tenantId);
 }

+ 36 - 2
blade-service/blade-client/src/main/java/org/springblade/client/port/mapper/BasicPortDescMapper.xml

@@ -3,6 +3,15 @@
 
 <mapper namespace="org.springblade.client.port.mapper.BasicPortDescMapper">
 
+    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
+        <id column="id" property="id"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="title" property="title"/>
+        <result column="value" property="value"/>
+        <result column="key" property="key"/>
+        <result column="has_children" property="hasChildren"/>
+    </resultMap>
+
     <select id="listBasicPortDesc" resultType="org.springblade.client.dto.BasicPortDescDTO">
 
     SELECT
@@ -23,15 +32,18 @@
 	b.update_user_name as updateUserName,
 	b.create_user_name as createUserName,
 	b.`status` as `status`,
-	a.`name` as typeName
+	a.`name` as typeName,
+	a.id as typeId
 FROM
 	basic_port_type a,
 	basic_port_desc b,
 	basic_port_type_desc c
 WHERE
-	a.id = c.ports_type_id
+    b.tenant_id=#{tenantId}
+	and a.id = c.ports_type_id
 	AND b.id = c.ports_id
     and b.is_deleted=0
+        and c.is_deleted=0
         <if test="portName != null and portName != ''">
             AND b.`name` LIKE CONCAT('%',#{portName,jdbcType=VARCHAR},'%')
         </if>
@@ -41,6 +53,9 @@ WHERE
         <if test="unCode != null and unCode != ''">
             AND b.un_code=#{unCode}
         </if>
+        <if test="typeId != null">
+            AND a.id=#{typeId}
+        </if>
         <if test="status != null and status != ''">
             AND b.status in
             (
@@ -54,4 +69,23 @@ WHERE
 
     </select>
 
+
+    <select id="tree" resultMap="treeNodeResultMap">
+        SELECT
+        id,
+        parent_id,
+        name AS title,
+        id AS "value",
+        id AS "key"
+        FROM
+        basic_port_type
+        WHERE
+        is_deleted = 0
+        and status = 0
+        <if test="tenantId!=null and tenantId!=''">
+            and tenant_id = #{tenantId}
+        </if>
+        ORDER BY sort
+    </select>
+
 </mapper>

+ 7 - 1
blade-service/blade-client/src/main/java/org/springblade/client/port/service/BasicPortDescService.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springblade.client.dto.BasicPortDescDTO;
 import org.springblade.client.entity.BasicContainerDesc;
 import org.springblade.client.entity.BasicPortDesc;
+import org.springblade.client.vo.GoodsTypeVO;
+import org.springblade.client.vo.PortTypeVO;
 import org.springblade.core.mp.base.BaseService;
 
 import java.util.List;
@@ -21,7 +23,11 @@ import java.util.Map;
  */
 public interface BasicPortDescService extends BaseService<BasicPortDesc>
 {
-    IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page,String portName,String lines,String unCode,String status );
+    IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page,String portName,String lines,String unCode,String status ,Long typeId,String tenantId);
 
     void addBasicPortDesc(BasicPortDescDTO dto);
+
+	List<PortTypeVO> tree(String tenantId);
+
+	void updateBasicPortDesc(BasicPortDescDTO dto);
 }

+ 70 - 5
blade-service/blade-client/src/main/java/org/springblade/client/port/service/impl/BasicPortDescServiceImpl.java

@@ -1,6 +1,9 @@
 package org.springblade.client.port.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springblade.client.container.mapper.BasicContainerDescMapper;
 import org.springblade.client.container.service.BasicContainerDescService;
@@ -13,8 +16,11 @@ import org.springblade.client.port.mapper.BasicPortDescMapper;
 import org.springblade.client.port.mapper.BasicPortTypeDescMapper;
 import org.springblade.client.port.mapper.BasicPortTypeMapper;
 import org.springblade.client.port.service.BasicPortDescService;
+import org.springblade.client.vo.PortTypeVO;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,9 +30,7 @@ import javax.validation.constraints.NotBlank;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-
-
-
+import java.util.stream.Collectors;
 
 
 @Service
@@ -40,9 +44,9 @@ public class BasicPortDescServiceImpl extends BaseServiceImpl<BasicPortDescMappe
    private BasicPortTypeDescMapper basicPortTypeDescMapper;
 
 	@Override
-	public IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page, String portName, String lines, String unCode, String status)
+	public IPage<BasicPortDescDTO> listBasicPortDesc(Page<BasicPortDescDTO> page, String portName, String lines, String unCode, String status,Long typeId,String tenantId)
 	{
-		return	basicPortDescMapper.listBasicPortDesc(page,portName,lines,unCode,status);
+		return	basicPortDescMapper.listBasicPortDesc(page,portName,lines,unCode,status,typeId,tenantId);
 	}
 
 	@Override
@@ -60,6 +64,7 @@ public class BasicPortDescServiceImpl extends BaseServiceImpl<BasicPortDescMappe
 		basicPortDescMapper.insert(basicPortDesc);
 
 		BasicPortTypeDesc middle=new BasicPortTypeDesc();
+		middle.setTenantId(AuthUtil.getTenantId());
 		middle.setPortsId(basicPortDesc.getId());
 		middle.setPortsTypeId(typeId);
 		middle.setCreateTime(new Date());
@@ -69,4 +74,64 @@ public class BasicPortDescServiceImpl extends BaseServiceImpl<BasicPortDescMappe
 
 
 	}
+
+	@Override
+	public List<PortTypeVO> tree(String tenantId)
+	{
+		if (StringUtils.isBlank(tenantId)) {
+			tenantId = SecureUtil.getTenantId();
+		}
+		return ForestNodeMerger.merge(basicPortDescMapper.tree(tenantId));
+	}
+
+	@Override
+	@Transactional
+	public void updateBasicPortDesc(BasicPortDescDTO dto)
+	{
+		//类型id
+		Long typeId = dto.getTypeId();
+		BasicPortDesc basicPortDesc=new BasicPortDesc();
+		BeanUtils.copyProperties(dto,basicPortDesc);
+		basicPortDescMapper.updateById(basicPortDesc);
+
+		//查询中间关系表, 是否需要解绑
+		LambdaQueryWrapper<BasicPortTypeDesc> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(BasicPortTypeDesc::getPortsId,basicPortDesc.getId());
+		List<BasicPortTypeDesc> basicPortTypeDescs = basicPortTypeDescMapper.selectList(lambdaQueryWrapper);
+		//如果存在绑定关系,检查是否需要换绑
+		if(!CollectionUtils.isEmpty(basicPortTypeDescs))
+		{
+			List<BasicPortTypeDesc> collect = basicPortTypeDescs.stream().filter(e -> e.getPortsTypeId() == typeId).collect(Collectors.toList());
+			//如果为空,解绑操作
+			if(CollectionUtils.isEmpty(collect))
+			{
+				basicPortTypeDescs.forEach(e->{
+					basicPortTypeDescMapper.deleteById(e.getId());
+				});
+				BasicPortTypeDesc middle=new BasicPortTypeDesc();
+				middle.setTenantId(AuthUtil.getTenantId());
+				middle.setPortsId(basicPortDesc.getId());
+				middle.setPortsTypeId(typeId);
+				middle.setCreateTime(new Date());
+				middle.setCreateUser(SecureUtil.getUserId());
+				middle.setCreateUserName(SecureUtil.getUser().getRoleName());
+				basicPortTypeDescMapper.insert(middle);
+			}
+
+		}
+		//如果没有绑定关系,则完成新增
+		else
+		{
+			BasicPortTypeDesc middle=new BasicPortTypeDesc();
+			middle.setTenantId(AuthUtil.getTenantId());
+			middle.setPortsId(basicPortDesc.getId());
+			middle.setPortsTypeId(typeId);
+			middle.setCreateTime(new Date());
+			middle.setCreateUser(SecureUtil.getUserId());
+			middle.setCreateUserName(SecureUtil.getUser().getRoleName());
+			basicPortTypeDescMapper.insert(middle);
+		}
+
+
+	}
 }

+ 6 - 3
blade-service/blade-project/src/main/java/org/springblade/project/controller/ProjectController.java

@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.client.feign.ICorpsDescClient;
 import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
@@ -59,6 +60,7 @@ public class ProjectController {
 	{
 		LambdaQueryWrapper<ServiceProject> serviceProjectLambdaQueryWrapper = new LambdaQueryWrapper<>();
 		serviceProjectLambdaQueryWrapper
+			.eq(ServiceProject::getTenantId, AuthUtil.getTenantId())
 			.like(StringUtils.isNotBlank(dutyName), ServiceProject::getDutyName, dutyName)
 			.like(StringUtils.isNotBlank(remark), ServiceProject::getRemark, remark)
 			.like(StringUtils.isNotBlank(corpAttn), ServiceProject::getCorpAttn, corpAttn)
@@ -111,7 +113,7 @@ public class ProjectController {
 	public R edit(@RequestBody ServiceProject serviceProject)
 	{
 		serviceProjectService.modify(serviceProject);
-		return R.success("操作成功");
+		return R.data(serviceProject.getId());
 	}
 
 	@DeleteMapping("delete")
@@ -191,9 +193,10 @@ public class ProjectController {
 
 		  LambdaQueryWrapper<ServiceProjectItem> itemLambdaQueryWrapper=new LambdaQueryWrapper<>();
 		  itemLambdaQueryWrapper
+			  .eq(ServiceProjectItem::getTenantId,AuthUtil.getTenantId())
 			  .like(StringUtils.isNotBlank(pName),ServiceProjectItem::getPName,pName)
-			.	apply(StringUtils.isNotBlank(beginTime),"date_format(begin_time,'%Y-%m-%d') = '"+beginTime+"'")
-			.	apply(StringUtils.isNotBlank(actualDate),"date_format(actual_date,'%Y-%m-%d') = '"+actualDate+"'")
+			  .apply(StringUtils.isNotBlank(beginTime),"date_format(begin_time,'%Y-%m-%d') = '"+beginTime+"'")
+			  .apply(StringUtils.isNotBlank(actualDate),"date_format(actual_date,'%Y-%m-%d') = '"+actualDate+"'")
 			  .eq(ServiceProjectItem::getUserid,SecureUtil.getUserId())
 			  .orderByDesc(ServiceProjectItem::getUpdateTime)
 			  .eq(deptid!=null,ServiceProjectItem::getDeptid,deptid)

+ 2 - 0
blade-service/blade-project/src/main/java/org/springblade/project/controller/ProjectFilesController.java

@@ -1,6 +1,7 @@
 package org.springblade.project.controller;
 
 import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
@@ -27,6 +28,7 @@ public class ProjectFilesController
 	@PostMapping("save")
     public R save(@RequestBody ServiceProjectFiles serviceProjectFiles)
 	{
+		serviceProjectFiles.setTenantId(AuthUtil.getTenantId());
 		serviceProjectFiles.setCreateTime(new Date());
 		serviceProjectFiles.setCreateUser(SecureUtil.getUserId());
 		serviceProjectFiles.setCreateUserName(SecureUtil.getUser().getRoleName());

+ 6 - 0
blade-service/blade-project/src/main/java/org/springblade/project/service/impl/ServiceProjectServiceImpl.java

@@ -6,6 +6,7 @@ import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
 import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.project.entity.ServiceProject;
@@ -59,6 +60,7 @@ public class ServiceProjectServiceImpl extends BaseServiceImpl<ServiceProjectMap
           {
              throw new RuntimeException("已收金额+未收金额≠合同总金额,请确认后提交");
 		  }
+		  serviceProject.setTenantId(AuthUtil.getTenantId());
 		  serviceProject.setCreateTime(new Date());
 		  serviceProject.setCreateUser(SecureUtil.getUserId());
 		  serviceProject.setCreateUserName(SecureUtil.getUser().getRoleName());
@@ -66,6 +68,7 @@ public class ServiceProjectServiceImpl extends BaseServiceImpl<ServiceProjectMap
 		  if(!CollectionUtils.isEmpty(itemList))
 		  {
 			  itemList.forEach(e->{
+			  	e.setTenantId(AuthUtil.getTenantId());
 			  	e.setPId(serviceProject.getId());
                 e.setCreateTime(new Date());
                 e.setCreateUser(SecureUtil.getUserId());
@@ -77,6 +80,7 @@ public class ServiceProjectServiceImpl extends BaseServiceImpl<ServiceProjectMap
 		  if(!CollectionUtils.isEmpty(filesList))
 		  {
 			  filesList.forEach(e->{
+				  e.setTenantId(AuthUtil.getTenantId());
 				  e.setPId(serviceProject.getId());
 				  e.setCreateTime(new Date());
 				  e.setCreateUser(SecureUtil.getUserId());
@@ -114,6 +118,7 @@ public class ServiceProjectServiceImpl extends BaseServiceImpl<ServiceProjectMap
 				  //新增
 				  else
 				  {
+					  ls.setTenantId(AuthUtil.getTenantId());
 				  	  ls.setPId(serviceProject.getId());
 					  ls.setCreateTime(new Date());
 					  ls.setCreateUser(SecureUtil.getUserId());
@@ -139,6 +144,7 @@ public class ServiceProjectServiceImpl extends BaseServiceImpl<ServiceProjectMap
 					  //新增
 					  else
 					  {
+						  ls.setTenantId(AuthUtil.getTenantId());
 						  ls.setPId(serviceProject.getId());
 						  ls.setCreateTime(new Date());
 						  ls.setCreateUser(SecureUtil.getUserId());