|
|
@@ -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);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|