单位类型
This commit is contained in:
parent
7d0a54fe83
commit
844ab1067d
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.bonus.common.biz.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MaType extends BaseEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 135108051525707131L;
|
||||||
|
|
||||||
|
private Integer isExport;
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 上级id
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级名称
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级
|
||||||
|
*/
|
||||||
|
private String level;
|
||||||
|
/**
|
||||||
|
* 库存
|
||||||
|
*/
|
||||||
|
private Integer storageNum;
|
||||||
|
/**
|
||||||
|
* 计量单位id
|
||||||
|
*/
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
/**
|
||||||
|
* 采购单价
|
||||||
|
*/
|
||||||
|
private Integer buyPrice;
|
||||||
|
/**
|
||||||
|
* 租赁单价
|
||||||
|
*/
|
||||||
|
private Integer leasePrice;
|
||||||
|
/**
|
||||||
|
* 管理类型(0是编码 1数量)
|
||||||
|
*/
|
||||||
|
private String manageType;
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private String isActive;
|
||||||
|
/**
|
||||||
|
* 额定载荷
|
||||||
|
*/
|
||||||
|
private String rateLoad;
|
||||||
|
/**
|
||||||
|
* 试验载荷
|
||||||
|
*/
|
||||||
|
private String testLoad;
|
||||||
|
/**
|
||||||
|
* 持荷时间 (分钟)
|
||||||
|
*/
|
||||||
|
private String holdTime;
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
/**
|
||||||
|
* 数据所属
|
||||||
|
*/
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否试验(0 否 1是)
|
||||||
|
*/
|
||||||
|
private String isTest;
|
||||||
|
|
||||||
|
/** 子节点 */
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<MaType> children = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.bonus.common.biz.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门表(SysDept)实体类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-08-15 13:44:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysDeptTree implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 991828482042492876L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级树标识 1代表查询二级树
|
||||||
|
*/
|
||||||
|
private Integer isTree;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 更新者
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 创建者
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
|
private String delFlag;
|
||||||
|
/**
|
||||||
|
* 部门状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
private Integer orderNum;
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
/**
|
||||||
|
* 父部门id
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
/** 子节点 */
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<SysDeptTree> children = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.bonus.common.biz.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TreeSelect树结构实体类
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class TreeSelect implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 节点ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 节点名称 */
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/** 子节点 */
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<TreeSelect> children;
|
||||||
|
|
||||||
|
private List<SysUser> userList;
|
||||||
|
|
||||||
|
public TreeSelect(SysDeptTree dept) {
|
||||||
|
this.id = Integer.valueOf(dept.getDeptId());
|
||||||
|
this.parentId = Integer.valueOf(dept.getParentId());
|
||||||
|
this.label = dept.getDeptName();
|
||||||
|
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeSelect(MaType maType) {
|
||||||
|
this.parentId = Integer.valueOf(maType.getParentId());
|
||||||
|
this.code = maType.getCode();
|
||||||
|
this.level = Integer.valueOf(maType.getLevel());
|
||||||
|
this.id = Integer.valueOf(maType.getId());
|
||||||
|
this.label = maType.getName();
|
||||||
|
this.companyId = maType.getCompanyId();
|
||||||
|
this.children = maType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeSelect() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.bonus.material.basic.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.SysDeptTree;
|
||||||
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -51,6 +54,16 @@ public class BmUnitPersonController extends BaseController
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门用户下拉树
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询部门用户下拉树")
|
||||||
|
@GetMapping("/getDeptUserTree")
|
||||||
|
public AjaxResult selectDeptTree(SysDeptTree sysDept) {
|
||||||
|
List<TreeSelect> deptList = bmUnitPersonService.selectDeptTree(sysDept);
|
||||||
|
return AjaxResult.success(deptList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出往来单位管理列表
|
* 导出往来单位管理列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,14 @@ public class BmUnitTypeController extends BaseController {
|
||||||
@ApiOperation(value = "查询往来单位类型管理列表")
|
@ApiOperation(value = "查询往来单位类型管理列表")
|
||||||
@RequiresPermissions("basic:unitType:list")
|
@RequiresPermissions("basic:unitType:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BmUnitType bmUnitType)
|
public AjaxResult list(BmUnitType bmUnitType)
|
||||||
{
|
{
|
||||||
|
if (bmUnitType.getIsAll() != null) {
|
||||||
|
return AjaxResult.success(bmUnitTypeService.selectBmUnitList(bmUnitType));
|
||||||
|
}
|
||||||
startPage();
|
startPage();
|
||||||
List<BmUnitType> list = bmUnitTypeService.selectBmUnitList(bmUnitType);
|
List<BmUnitType> list = bmUnitTypeService.selectBmUnitList(bmUnitType);
|
||||||
return getDataTable(list);
|
return AjaxResult.success(getDataTable(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取往来单位类型详细信息")
|
@ApiOperation(value = "获取往来单位类型详细信息")
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class BmUnitType extends BaseEntity {
|
public class BmUnitType extends BaseEntity {
|
||||||
|
|
||||||
|
private Integer isAll;
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键id")
|
@ApiModelProperty(value = "主键id")
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.material.basic.mapper;
|
package com.bonus.material.basic.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.SysDeptTree;
|
||||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,4 +60,11 @@ public interface BmUnitPersonMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBmUnitPersonByIDs(Long[] IDs);
|
public int deleteBmUnitPersonByIDs(Long[] IDs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门树
|
||||||
|
* @param sysDept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysDeptTree> selectDeptTree(SysDeptTree sysDept);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,11 @@ public interface BmUnitTypeMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteBmUnitTypeByUnitTypeIds(Long typeId);
|
int deleteBmUnitTypeByUnitTypeIds(Long typeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键查询单位类型
|
||||||
|
* @param typeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int select(Long typeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.bonus.material.basic.service;
|
package com.bonus.material.basic.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.SysDeptTree;
|
||||||
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,4 +61,11 @@ public interface IBmUnitPersonService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBmUnitPersonByID(Long ID);
|
public int deleteBmUnitPersonByID(Long ID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门下拉树结构
|
||||||
|
* @param sysDept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TreeSelect> selectDeptTree(SysDeptTree sysDept);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
package com.bonus.material.basic.service.impl;
|
package com.bonus.material.basic.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.SysDeptTree;
|
||||||
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.basic.mapper.BmUnitPersonMapper;
|
import com.bonus.material.basic.mapper.BmUnitPersonMapper;
|
||||||
|
|
@ -93,4 +100,74 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
||||||
{
|
{
|
||||||
return bmUnitPersonMapper.deleteBmUnitPersonByID(ID);
|
return bmUnitPersonMapper.deleteBmUnitPersonByID(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门下拉树结构
|
||||||
|
* @param sysDept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TreeSelect> selectDeptTree(SysDeptTree sysDept) {
|
||||||
|
List<SysDeptTree> deptList = bmUnitPersonMapper.selectDeptTree(sysDept);
|
||||||
|
return buildDeptTreeSelect(deptList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TreeSelect> buildDeptTreeSelect(List<SysDeptTree> deptList) {
|
||||||
|
List<SysDeptTree> deptTrees = buildDeptTree(deptList);
|
||||||
|
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SysDeptTree> buildDeptTree(List<SysDeptTree> deptList) {
|
||||||
|
List<SysDeptTree> returnList = new ArrayList<>();
|
||||||
|
List<String> tempList = deptList.stream().map(SysDeptTree::getDeptId).collect(Collectors.toList());
|
||||||
|
for (SysDeptTree sysDept : deptList) {
|
||||||
|
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||||
|
if (!tempList.contains(sysDept.getParentId())) {
|
||||||
|
recursionFn(deptList, sysDept);
|
||||||
|
returnList.add(sysDept);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (returnList.isEmpty()) {
|
||||||
|
returnList = deptList;
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归列表
|
||||||
|
*/
|
||||||
|
private void recursionFn(List<SysDeptTree> list, SysDeptTree t) {
|
||||||
|
// 得到子节点列表
|
||||||
|
List<SysDeptTree> childList = getChildList(list, t);
|
||||||
|
t.setChildren(childList);
|
||||||
|
for (SysDeptTree tChild : childList) {
|
||||||
|
if (hasChild(list, tChild)) {
|
||||||
|
recursionFn(list, tChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到子节点列表
|
||||||
|
*/
|
||||||
|
private List<SysDeptTree> getChildList(List<SysDeptTree> list, SysDeptTree t) {
|
||||||
|
List<SysDeptTree> tlist = new ArrayList<>();
|
||||||
|
Iterator<SysDeptTree> it = list.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
SysDeptTree n = (SysDeptTree) it.next();
|
||||||
|
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().equals(t.getDeptId())) {
|
||||||
|
tlist.add(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否有子节点
|
||||||
|
*/
|
||||||
|
private boolean hasChild(List<SysDeptTree> list, SysDeptTree t) {
|
||||||
|
return getChildList(list, t).size() > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ package com.bonus.material.basic.service.impl;
|
||||||
|
|
||||||
import com.bonus.common.biz.constant.MaterialConstants;
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.material.basic.domain.BmUnitType;
|
import com.bonus.material.basic.domain.BmUnitType;
|
||||||
import com.bonus.material.basic.mapper.BmUnitTypeMapper;
|
import com.bonus.material.basic.mapper.BmUnitTypeMapper;
|
||||||
import com.bonus.material.basic.service.IBmUnitTypeService;
|
import com.bonus.material.basic.service.IBmUnitTypeService;
|
||||||
|
|
@ -66,6 +68,8 @@ public class BmUnitTypeServiceImpl implements IBmUnitTypeService {
|
||||||
if (unitType != null) {
|
if (unitType != null) {
|
||||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
|
bmUnitType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
|
bmUnitType.setCreateTime(DateUtils.getNowDate());
|
||||||
int result = bmUnitTypeMapper.insertBmUnitType(bmUnitType);
|
int result = bmUnitTypeMapper.insertBmUnitType(bmUnitType);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -87,6 +91,8 @@ public class BmUnitTypeServiceImpl implements IBmUnitTypeService {
|
||||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bmUnitType.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||||
|
bmUnitType.setUpdateTime(DateUtils.getNowDate());
|
||||||
int result = bmUnitTypeMapper.updateBmUnitType(bmUnitType);
|
int result = bmUnitTypeMapper.updateBmUnitType(bmUnitType);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -102,6 +108,10 @@ public class BmUnitTypeServiceImpl implements IBmUnitTypeService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult deleteBmUnitTypeByUnitTypeIds(Long typeId) {
|
public AjaxResult deleteBmUnitTypeByUnitTypeIds(Long typeId) {
|
||||||
//首先根据单位类型查询是否关联单位
|
//首先根据单位类型查询是否关联单位
|
||||||
|
int count = bmUnitTypeMapper.select(typeId);
|
||||||
|
if (count > 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该单位类型关联相关单位,无法删除");
|
||||||
|
}
|
||||||
int result = bmUnitTypeMapper.deleteBmUnitTypeByUnitTypeIds(typeId);
|
int result = bmUnitTypeMapper.deleteBmUnitTypeByUnitTypeIds(typeId);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectBmUnitPersonVo"/>
|
<include refid="selectBmUnitPersonVo"/>
|
||||||
where ID = #{ID}
|
where ID = #{ID}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeptTree" resultType="com.bonus.common.biz.domain.SysDeptTree">
|
||||||
|
<choose>
|
||||||
|
<!-- 当 isTree 为 1 时执行 -->
|
||||||
|
<when test="isTree != null and isTree == 1">
|
||||||
|
SELECT
|
||||||
|
d.dept_id AS deptId,
|
||||||
|
d.parent_id AS parentId,
|
||||||
|
d.ancestors,
|
||||||
|
d.dept_name AS deptName,
|
||||||
|
d.order_num,
|
||||||
|
d.leader,
|
||||||
|
d.phone,
|
||||||
|
d.email,
|
||||||
|
d.status,
|
||||||
|
d.del_flag,
|
||||||
|
d.create_by,
|
||||||
|
d.create_time
|
||||||
|
FROM sys_dept d
|
||||||
|
WHERE d.del_flag = '0'
|
||||||
|
AND d.status = '0'
|
||||||
|
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>
|
||||||
|
|
||||||
<insert id="insertBmUnitPerson" parameterType="com.bonus.material.basic.domain.BmUnitPerson" useGeneratedKeys="true" keyProperty="ID">
|
<insert id="insertBmUnitPerson" parameterType="com.bonus.material.basic.domain.BmUnitPerson" useGeneratedKeys="true" keyProperty="ID">
|
||||||
insert into bm_unit_person
|
insert into bm_unit_person
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -58,4 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select type_id as typeId, type_name as typeName, company_id as companyId, del_flag as delFlag from bm_unit_type
|
select type_id as typeId, type_name as typeName, company_id as companyId, del_flag as delFlag from bm_unit_type
|
||||||
where del_flag = '0' and type_name = #{typeName}
|
where del_flag = '0' and type_name = #{typeName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="select" resultType="java.lang.Integer">
|
||||||
|
select count(1) from bm_unit where type_id = #{typeId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue