物资管理联调
This commit is contained in:
parent
c207c54583
commit
91a3bd2396
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.base.api.domain;
|
package com.bonus.base.api.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -24,14 +25,17 @@ public class MaHouse extends BaseEntity implements Serializable {
|
||||||
* 0不启用,1启用
|
* 0不启用,1启用
|
||||||
*/
|
*/
|
||||||
private String isActive;
|
private String isActive;
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
/**
|
||||||
* 仓库名称
|
* 仓库名称
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "仓库名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ public class SysDeptTree implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 991828482042492876L;
|
private static final long serialVersionUID = 991828482042492876L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级树标识 1代表查询二级树
|
||||||
|
*/
|
||||||
|
private Integer isTree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,16 @@ package com.bonus.base.controller;
|
||||||
import com.bonus.base.api.domain.SysDeptTree;
|
import com.bonus.base.api.domain.SysDeptTree;
|
||||||
import com.bonus.base.api.domain.TreeSelect;
|
import com.bonus.base.api.domain.TreeSelect;
|
||||||
import com.bonus.base.service.IBmCustomerService;
|
import com.bonus.base.service.IBmCustomerService;
|
||||||
import com.bonus.base.service.impl.BaseTreeService;
|
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.bonus.system.api.RemoteDictService;
|
import com.bonus.system.api.RemoteDictService;
|
||||||
import com.bonus.system.api.domain.SysDictData;
|
|
||||||
import com.bonus.system.api.domain.SysUser;
|
|
||||||
//import com.bonus.system.service.ISysUserService;
|
//import com.bonus.system.service.ISysUserService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,12 +33,6 @@ public class BaseTreeController {
|
||||||
@Resource
|
@Resource
|
||||||
private IBmCustomerService customerService;
|
private IBmCustomerService customerService;
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private ISysUserService userService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private BaseTreeService baseTreeService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取工程类型
|
* 获取工程类型
|
||||||
*/
|
*/
|
||||||
|
|
@ -78,14 +65,6 @@ public class BaseTreeController {
|
||||||
@GetMapping("/getDeptUserTree")
|
@GetMapping("/getDeptUserTree")
|
||||||
public AjaxResult selectDeptTree(SysDeptTree sysDept) {
|
public AjaxResult selectDeptTree(SysDeptTree sysDept) {
|
||||||
List<TreeSelect> deptList = customerService.selectDeptTree(sysDept);
|
List<TreeSelect> deptList = customerService.selectDeptTree(sysDept);
|
||||||
List<SysUser> userList = new ArrayList<>();
|
|
||||||
SysUser su1 = new SysUser();
|
|
||||||
su1.setDeptId(103L);
|
|
||||||
su1.setUserName("admin");
|
|
||||||
su1.setUserId(1L);
|
|
||||||
userList.add(su1);
|
|
||||||
// List<SysUser> userList = userService.selectUserList(new SysUser());
|
|
||||||
baseTreeService.deptUserTreeScope(deptList.get(0), userList);
|
|
||||||
return AjaxResult.success(deptList);
|
return AjaxResult.success(deptList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ public class BmCustomerController extends BaseController {
|
||||||
@RequiresPermissions("material:maType:query")
|
@RequiresPermissions("material:maType:query")
|
||||||
@GetMapping("/deptTree")
|
@GetMapping("/deptTree")
|
||||||
public AjaxResult selectDeptTree(SysDeptTree sysDept) {
|
public AjaxResult selectDeptTree(SysDeptTree sysDept) {
|
||||||
|
sysDept.setIsTree(1);
|
||||||
List<TreeSelect> deptList = customerService.selectDeptTree(sysDept);
|
List<TreeSelect> deptList = customerService.selectDeptTree(sysDept);
|
||||||
return AjaxResult.success(deptList);
|
return AjaxResult.success(deptList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
package com.bonus.base.service.impl;
|
|
||||||
|
|
||||||
import com.bonus.base.api.domain.TreeSelect;
|
|
||||||
import com.bonus.system.api.domain.SysUser;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author : 阮世耀
|
|
||||||
* @version : 1.0
|
|
||||||
* @PackagePath: com.bonus.base.service.impl
|
|
||||||
* @CreateTime: 2024-08-16 13:17
|
|
||||||
* @Description: 基础公用tree、下拉框逻辑处理类
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BaseTreeService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门用户关联树处理
|
|
||||||
* @param sysDept 部门树根结构
|
|
||||||
* @return 树结构
|
|
||||||
*/
|
|
||||||
public TreeSelect deptUserTreeScope(TreeSelect sysDept, List<SysUser> userList) {
|
|
||||||
for (SysUser sysUser : userList) {
|
|
||||||
findDepartmentById(sysDept, sysUser, sysUser.getDeptId());
|
|
||||||
}
|
|
||||||
return sysDept;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递归查询部门结构,匹配用户id
|
|
||||||
* @param root 部门树
|
|
||||||
* @param id 用户id
|
|
||||||
* @return 匹配上的部门信息
|
|
||||||
*/
|
|
||||||
private static TreeSelect findDepartmentById(TreeSelect root, SysUser sysUser, Long id) {
|
|
||||||
// 只在方法开始处检查一次root是否为null
|
|
||||||
if (root == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查当前节点是否匹配id
|
|
||||||
if (id != null && root.getId() == id.intValue()) {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 遍历子节点
|
|
||||||
for (TreeSelect sysDept : root.getChildren()) {
|
|
||||||
TreeSelect found = findDepartmentById(sysDept, sysUser, id);
|
|
||||||
if (found != null) {
|
|
||||||
List<TreeSelect> children = new ArrayList<>();
|
|
||||||
TreeSelect treeSelect = new TreeSelect();
|
|
||||||
if (id != null) {
|
|
||||||
treeSelect.setId(sysUser.getUserId().intValue());
|
|
||||||
treeSelect.setLabel(sysUser.getUserName());
|
|
||||||
}
|
|
||||||
children.add(treeSelect);
|
|
||||||
found.setChildren(children);
|
|
||||||
// 找到匹配的节点,返回结果
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果没有找到匹配的节点,返回null
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
package com.bonus.material.controller;
|
package com.bonus.material.controller;
|
||||||
import com.bonus.common.core.domain.ResultBean;
|
import com.bonus.common.core.domain.ResultBean;
|
||||||
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.service.impl.MaHouseSetService;
|
import com.bonus.material.service.impl.MaHouseSetService;
|
||||||
import com.bonus.material.domain.MaHouseSet;
|
import com.bonus.material.domain.MaHouseSet;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,9 +61,8 @@ public class MaHouseSetController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
@RequiresPermissions("material:maHouseSet:add")
|
@RequiresPermissions("material:maHouseSet:add")
|
||||||
public ResultBean< Boolean> add(@RequestBody MaHouseSet maHouseSet) {
|
public ResultBean add(@RequestBody MaHouseSet maHouseSet) {
|
||||||
this.maHouseSetService.insertSelective(maHouseSet);
|
return this.maHouseSetService.insertSelective(maHouseSet);
|
||||||
return ResultBean.success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,9 +73,8 @@ public class MaHouseSetController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PutMapping(value = "/update")
|
@PutMapping(value = "/update")
|
||||||
@RequiresPermissions("material:maHouseSet:edit")
|
@RequiresPermissions("material:maHouseSet:edit")
|
||||||
public ResultBean< Boolean> edit(@RequestBody MaHouseSet maHouseSet) {
|
public ResultBean edit(@RequestBody MaHouseSet maHouseSet) {
|
||||||
this.maHouseSetService.updateByPrimaryKeySelective(maHouseSet);
|
return maHouseSetService.updateByPrimaryKeySelective(maHouseSet);
|
||||||
return ResultBean.success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,4 +89,14 @@ public class MaHouseSetController extends BaseController {
|
||||||
this.maHouseSetService.deleteByPrimaryKey(id);
|
this.maHouseSetService.deleteByPrimaryKey(id);
|
||||||
return ResultBean.success(true);
|
return ResultBean.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "导出仓库物资关联列表")
|
||||||
|
@RequiresPermissions("material:maHouseSet:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MaHouseSet maHouseSet)
|
||||||
|
{
|
||||||
|
List<MaHouseSet> list = this.maHouseSetService.selectAll(maHouseSet);
|
||||||
|
ExcelUtil<MaHouseSet> util = new ExcelUtil<>(MaHouseSet.class);
|
||||||
|
util.exportExcel(response, list, "仓库物资关联列表");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
package com.bonus.material.controller;
|
package com.bonus.material.controller;
|
||||||
import com.bonus.common.core.domain.ResultBean;
|
import com.bonus.common.core.domain.ResultBean;
|
||||||
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.service.impl.MaUserSetService;
|
import com.bonus.material.service.impl.MaUserSetService;
|
||||||
import com.bonus.material.domain.MaUserSet;
|
import com.bonus.material.domain.MaUserSet;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,9 +60,8 @@ public class MaUserSetController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
@RequiresPermissions("material:maUserSet:add")
|
@RequiresPermissions("material:maUserSet:add")
|
||||||
public ResultBean< Boolean> add(@RequestBody MaUserSet maUserSet) {
|
public ResultBean add(@RequestBody MaUserSet maUserSet) {
|
||||||
this.maUserSetService.insertSelective(maUserSet);
|
return this.maUserSetService.insertSelective(maUserSet);
|
||||||
return ResultBean.success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,9 +72,8 @@ public class MaUserSetController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PutMapping(value = "/update")
|
@PutMapping(value = "/update")
|
||||||
@RequiresPermissions("material:maUserSet:edit")
|
@RequiresPermissions("material:maUserSet:edit")
|
||||||
public ResultBean< Boolean> edit(@RequestBody MaUserSet maUserSet) {
|
public ResultBean edit(@RequestBody MaUserSet maUserSet) {
|
||||||
this.maUserSetService.updateByPrimaryKeySelective(maUserSet);
|
return this.maUserSetService.updateByPrimaryKeySelective(maUserSet);
|
||||||
return ResultBean.success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,4 +88,14 @@ public class MaUserSetController extends BaseController {
|
||||||
this.maUserSetService.deleteByPrimaryKey(id);
|
this.maUserSetService.deleteByPrimaryKey(id);
|
||||||
return ResultBean.success(true);
|
return ResultBean.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "导出仓库人员关联列表")
|
||||||
|
@RequiresPermissions("material:maUserSet:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MaUserSet maUserSet)
|
||||||
|
{
|
||||||
|
List<MaUserSet> list = this.maUserSetService.selectAll(maUserSet);
|
||||||
|
ExcelUtil<MaUserSet> util = new ExcelUtil<>(MaUserSet.class);
|
||||||
|
util.exportExcel(response, list, "仓库人员关联列表");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.bonus.material.domain;
|
package com.bonus.material.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -12,7 +14,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@ApiModel(description="仓库和物资配置")
|
@ApiModel(description="仓库和物资配置")
|
||||||
@Data
|
@Data
|
||||||
public class MaHouseSet implements Serializable {
|
public class MaHouseSet extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6368040076262260197L;
|
private static final long serialVersionUID = 6368040076262260197L;
|
||||||
|
|
||||||
|
|
@ -25,7 +27,12 @@ public class MaHouseSet implements Serializable {
|
||||||
@ApiModelProperty(value="机具规格id")
|
@ApiModelProperty(value="机具规格id")
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="仓库名称")
|
||||||
|
@Excel(name="仓库名称")
|
||||||
|
private String houseName;
|
||||||
|
|
||||||
@ApiModelProperty(value="机具规格名称")
|
@ApiModelProperty(value="机具规格名称")
|
||||||
|
@Excel(name="物资名称")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,8 +40,4 @@ public class MaHouseSet implements Serializable {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="仓库id")
|
@ApiModelProperty(value="仓库id")
|
||||||
private Integer houseId;
|
private Integer houseId;
|
||||||
|
|
||||||
@ApiModelProperty(value="仓库名称")
|
|
||||||
private String houseName;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.bonus.material.domain;
|
package com.bonus.material.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -11,7 +13,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@ApiModel(description = "物资和人员配置")
|
@ApiModel(description = "物资和人员配置")
|
||||||
@Data
|
@Data
|
||||||
public class MaUserSet implements Serializable {
|
public class MaUserSet extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
@ -19,15 +21,17 @@ public class MaUserSet implements Serializable {
|
||||||
@ApiModelProperty(value = "机具类型id")
|
@ApiModelProperty(value = "机具类型id")
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户名称")
|
||||||
|
@Excel(name = "人员名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "机具类型名称")
|
@ApiModelProperty(value = "机具类型名称")
|
||||||
|
@Excel(name = "物资名称")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户id")
|
@ApiModelProperty(value = "用户id")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户名称")
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1库管2修试
|
* 1库管2修试
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
package com.bonus.material.mapper;
|
package com.bonus.material.mapper;
|
||||||
import java.util.Collection;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.bonus.material.domain.MaHouseSet;
|
import com.bonus.material.domain.MaHouseSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -66,4 +64,5 @@ public interface MaHouseSetMapper {
|
||||||
List<MaHouseSet> findAll();
|
List<MaHouseSet> findAll();
|
||||||
|
|
||||||
|
|
||||||
|
MaHouseSet select(MaHouseSet record);
|
||||||
}
|
}
|
||||||
|
|
@ -73,4 +73,11 @@ public interface MaUserSetMapper {
|
||||||
List<MaUserSet> selectByUserId(@Param("userId") Integer userId);
|
List<MaUserSet> selectByUserId(@Param("userId") Integer userId);
|
||||||
|
|
||||||
List<MaUserSet> selectAll(MaUserSet record);
|
List<MaUserSet> selectAll(MaUserSet record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件查询
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MaUserSet select(MaUserSet record);
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.bonus.material.service.impl;
|
package com.bonus.material.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.domain.ResultBean;
|
||||||
import com.bonus.material.mapper.MaHouseSetMapper;
|
import com.bonus.material.mapper.MaHouseSetMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.bonus.material.domain.MaHouseSet;
|
import com.bonus.material.domain.MaHouseSet;
|
||||||
|
|
@ -42,8 +42,17 @@ public class MaHouseSetService{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int insertSelective(MaHouseSet record) {
|
public ResultBean insertSelective(MaHouseSet record) {
|
||||||
return maHouseSetMapper.insertSelective(record);
|
//根据仓库id和类型id去库中查询,判重
|
||||||
|
if(maHouseSetMapper.select(record) != null){
|
||||||
|
return ResultBean.error("该仓库和该类型已关联");
|
||||||
|
}
|
||||||
|
int result = maHouseSetMapper.insertSelective(record);
|
||||||
|
if(result > 0){
|
||||||
|
return ResultBean.success("添加成功");
|
||||||
|
}else{
|
||||||
|
return ResultBean.error("添加失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -52,8 +61,17 @@ public class MaHouseSetService{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int updateByPrimaryKeySelective(MaHouseSet record) {
|
public ResultBean updateByPrimaryKeySelective(MaHouseSet record) {
|
||||||
return maHouseSetMapper.updateByPrimaryKeySelective(record);
|
MaHouseSet houseSet = maHouseSetMapper.select(record);
|
||||||
|
if(houseSet != null && !houseSet.getId().equals(record.getId())){
|
||||||
|
return ResultBean.error("该仓库和该类型已关联");
|
||||||
|
}
|
||||||
|
int result = maHouseSetMapper.updateByPrimaryKeySelective(record);
|
||||||
|
if(result > 0){
|
||||||
|
return ResultBean.success("修改成功");
|
||||||
|
}else{
|
||||||
|
return ResultBean.error("修改失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.service.impl;
|
package com.bonus.material.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.domain.ResultBean;
|
||||||
import com.bonus.material.mapper.MaUserSetMapper;
|
import com.bonus.material.mapper.MaUserSetMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -38,8 +39,17 @@ public class MaUserSetService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int insertSelective(MaUserSet record) {
|
public ResultBean insertSelective(MaUserSet record) {
|
||||||
return maUserSetMapper.insertSelective(record);
|
MaUserSet maUserSet = maUserSetMapper.select(record);
|
||||||
|
if (maUserSet != null) {
|
||||||
|
return ResultBean.error("该人员和该物资配置关系已绑定");
|
||||||
|
}
|
||||||
|
int result = maUserSetMapper.insertSelective(record);
|
||||||
|
if (result > 0) {
|
||||||
|
return ResultBean.success("新增成功");
|
||||||
|
} else {
|
||||||
|
return ResultBean.error("新增失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteByPrimaryKey(Integer id) {
|
public int deleteByPrimaryKey(Integer id) {
|
||||||
|
|
@ -50,8 +60,17 @@ public class MaUserSetService {
|
||||||
return maUserSetMapper.selectByPrimaryKey(id);
|
return maUserSetMapper.selectByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateByPrimaryKeySelective(MaUserSet record) {
|
public ResultBean updateByPrimaryKeySelective(MaUserSet record) {
|
||||||
return maUserSetMapper.updateByPrimaryKeySelective(record);
|
MaUserSet maUserSet = maUserSetMapper.select(record);
|
||||||
|
if (maUserSet != null && !maUserSet.getId().equals(record.getId())) {
|
||||||
|
return ResultBean.error("该人员和该物资配置关系已绑定");
|
||||||
|
}
|
||||||
|
int result = maUserSetMapper.updateByPrimaryKeySelective(record);
|
||||||
|
if (result > 0) {
|
||||||
|
return ResultBean.success("修改成功");
|
||||||
|
} else {
|
||||||
|
return ResultBean.error("修改失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateByPrimaryKey(MaUserSet record) {
|
public int updateByPrimaryKey(MaUserSet record) {
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptTree" resultType="com.bonus.base.api.domain.SysDeptTree">
|
<select id="selectDeptTree" resultType="com.bonus.base.api.domain.SysDeptTree">
|
||||||
|
<choose>
|
||||||
|
<!-- 当 isTree 为 1 时执行 -->
|
||||||
|
<when test="isTree != null and isTree == 1">
|
||||||
SELECT
|
SELECT
|
||||||
d.dept_id AS deptId,
|
d.dept_id AS deptId,
|
||||||
d.parent_id AS parentId,
|
d.parent_id AS parentId,
|
||||||
|
|
@ -71,6 +74,30 @@
|
||||||
WHERE d.del_flag = '0'
|
WHERE d.del_flag = '0'
|
||||||
AND d.status = '0'
|
AND d.status = '0'
|
||||||
AND (LENGTH(d.ancestors) - LENGTH(REPLACE(d.ancestors, ',', ''))) + 1 != 3
|
AND (LENGTH(d.ancestors) - LENGTH(REPLACE(d.ancestors, ',', ''))) + 1 != 3
|
||||||
|
</when>
|
||||||
|
<!-- 否则执行默认查询 -->
|
||||||
|
<otherwise>
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
d.dept_id AS deptId,
|
||||||
|
d.parent_id AS parentId,
|
||||||
|
d.dept_name AS deptName
|
||||||
|
FROM sys_dept d
|
||||||
|
WHERE d.del_flag = '0'
|
||||||
|
AND d.STATUS = '0'
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
su.user_id AS deptId,
|
||||||
|
su.dept_id AS parentId,
|
||||||
|
su.user_name AS deptName
|
||||||
|
FROM sys_user su
|
||||||
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
|
) AS combined_results
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCustomerByName" resultType="com.bonus.base.api.domain.BmCustomer">
|
<select id="selectCustomerByName" resultType="com.bonus.base.api.domain.BmCustomer">
|
||||||
select
|
select
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,19 @@
|
||||||
from ma_house_set
|
from ma_house_set
|
||||||
left join `bns-smartwh`.ma_type mt on ma_house_set.type_id = mt.id
|
left join `bns-smartwh`.ma_type mt on ma_house_set.type_id = mt.id
|
||||||
left join `bns-smartwh`.ma_house mh on ma_house_set.house_id = mh.id
|
left join `bns-smartwh`.ma_house mh on ma_house_set.house_id = mh.id
|
||||||
|
where 1=1
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
mh.name LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR mt.name LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="dataCondition != null and dataCondition.size()>0">
|
||||||
|
AND ma_house_set.id in
|
||||||
|
<foreach collection="dataCondition" item="id" index="index" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrUpdate" parameterType="com.bonus.material.domain.MaHouseSet">
|
<insert id="insertOrUpdate" parameterType="com.bonus.material.domain.MaHouseSet">
|
||||||
|
|
@ -150,5 +163,17 @@
|
||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from ma_house_set
|
from ma_house_set
|
||||||
</select>
|
</select>
|
||||||
|
<select id="select" resultType="com.bonus.material.domain.MaHouseSet">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from ma_house_set
|
||||||
|
where 1 = 1
|
||||||
|
<if test="typeId != null">
|
||||||
|
and type_id = #{typeId}
|
||||||
|
</if>
|
||||||
|
<if test="houseId != null">
|
||||||
|
and house_id = #{houseId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -128,8 +128,27 @@
|
||||||
<if test="userId != null">
|
<if test="userId != null">
|
||||||
and ma_user_set.user_id = #{userId,jdbcType=INTEGER}
|
and ma_user_set.user_id = #{userId,jdbcType=INTEGER}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="dataCondition != null and dataCondition.size()>0">
|
||||||
|
AND ma_user_set.id in
|
||||||
|
<foreach collection="dataCondition" item="id" index="index" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
su.user_name LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR mt.name LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="select" resultType="com.bonus.material.domain.MaUserSet">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from ma_user_set
|
||||||
|
where type_id = #{typeId}
|
||||||
|
and user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.bonus.material.domain.MaUserSet"
|
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.bonus.material.domain.MaUserSet"
|
||||||
useGeneratedKeys="true">
|
useGeneratedKeys="true">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue