统一下拉选
This commit is contained in:
parent
7bdd7d5cef
commit
455ab5e30b
|
|
@ -22,13 +22,13 @@ public class SelectController {
|
|||
private SelectService service;
|
||||
|
||||
@ApiOperation(value = "往来单位下拉选")
|
||||
@PostMapping("getUnitData")
|
||||
@PostMapping("getUnitCbx")
|
||||
public AjaxResult getUnitData(SelectDto dto) {
|
||||
return service.getUnitData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程下拉选")
|
||||
@PostMapping("getProData")
|
||||
@PostMapping("getSectionEngineeringCbx")
|
||||
public AjaxResult getProData(SelectDto dto) {
|
||||
return service.getProData(dto);
|
||||
}
|
||||
|
|
@ -39,13 +39,6 @@ public class SelectController {
|
|||
return service.getMaTypeData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "机具类型下拉树")
|
||||
@PostMapping("getMaTypeTreeData")
|
||||
public AjaxResult getMaTypeTreeData(SelectDto dto){
|
||||
// return service.getMaTypeTreeData(dto);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "数据字典下拉选")
|
||||
@PostMapping("getDictByPidCbx")
|
||||
public AjaxResult getDictByPidCbx(SelectDto dto){
|
||||
|
|
@ -75,4 +68,46 @@ public class SelectController {
|
|||
public AjaxResult getUnitTypeCbx(SelectDto dto){
|
||||
return service.getUnitTypeCbx(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设备类型树")
|
||||
@PostMapping("getDeviceTypeTree")
|
||||
public AjaxResult getDeviceTypeTree(SelectDto dto){
|
||||
return service.getDeviceTypeTree(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "资产属性")
|
||||
@PostMapping("getAssetAttributesCbx")
|
||||
public AjaxResult getAssetAttributesCbx(SelectDto dto){
|
||||
return service.getAssetAttributesCbx(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "机具厂家")
|
||||
@PostMapping("getDeviceFactoryCbx")
|
||||
public AjaxResult getDeviceFactoryCbx(SelectDto dto){
|
||||
return service.getDeviceFactoryCbx(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程项目")
|
||||
@PostMapping("getProCbx")
|
||||
public AjaxResult getProCbx(SelectDto dto){
|
||||
return service.getProCbx(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "配件所属上级树")
|
||||
@PostMapping("getAccessoryTree")
|
||||
public AjaxResult getAccessoryTree(SelectDto dto){
|
||||
return service.getAccessoryTree(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "货架")
|
||||
@PostMapping("getGoodsShelvesCbx")
|
||||
public AjaxResult getGoodsShelvesCbx(SelectDto dto){
|
||||
return service.getGoodsShelvesCbx(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户/维修员/库管员/采购员")
|
||||
@PostMapping("getUserByRoleIdCbx")
|
||||
public AjaxResult getUserByRoleIdCbx(SelectDto dto){
|
||||
return service.getUserByRoleIdCbx(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.sgzb.system.domain;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
*/
|
||||
|
|
@ -19,4 +21,8 @@ public class SelectDto {
|
|||
|
||||
/** 层级*/
|
||||
private String level;
|
||||
|
||||
/** 角色权限字符串*/
|
||||
private String roleKey;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,4 +84,76 @@ public interface SelectMapper {
|
|||
* @date 2023/12/20 18:01
|
||||
*/
|
||||
List<SelectVo> getUnitTypeCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<TreeNode>
|
||||
* @description 设备类型树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 18:15
|
||||
*/
|
||||
List<TreeNode> getDeviceTypeTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 资产属性
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 19:48
|
||||
*/
|
||||
List<SelectVo> getAssetAttributesCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 机具厂家
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 19:57
|
||||
*/
|
||||
List<SelectVo> getDeviceFactoryCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 工程项目
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:01
|
||||
*/
|
||||
List<SelectVo> getProCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<TreeNode>
|
||||
* @description 配件所属上级树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:26
|
||||
*/
|
||||
List<TreeNode> getAccessoryTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<TreeNode>
|
||||
* @description 货架
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:36
|
||||
*/
|
||||
List<TreeNode> getGoodsShelvesCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<SelectVo>
|
||||
* @description 用户/维修员/库管员/采购员-下拉选
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:54
|
||||
*/
|
||||
List<SelectVo> getUserByRoleIdCbxSelect(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return List<TreeNode>
|
||||
* @description 用户/维修员/库管员/采购员-树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 21:02
|
||||
*/
|
||||
List<TreeNode> getUserByRoleIdCbxTree(SelectDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,15 +36,6 @@ public interface SelectService {
|
|||
*/
|
||||
AjaxResult getMaTypeData(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 机具类型-下拉树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 16:10
|
||||
*/
|
||||
// AjaxResult getMaTypeTreeData(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
|
|
@ -89,4 +80,67 @@ public interface SelectService {
|
|||
* @date 2023/12/20 18:00
|
||||
*/
|
||||
AjaxResult getUnitTypeCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 设备类型树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 18:14
|
||||
*/
|
||||
AjaxResult getDeviceTypeTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 资产属性
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 19:47
|
||||
*/
|
||||
AjaxResult getAssetAttributesCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 机具厂家
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 19:56
|
||||
*/
|
||||
AjaxResult getDeviceFactoryCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 工程项目
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:01
|
||||
*/
|
||||
AjaxResult getProCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 配件所属上级树
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:25
|
||||
*/
|
||||
AjaxResult getAccessoryTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 货架
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:36
|
||||
*/
|
||||
AjaxResult getGoodsShelvesCbx(SelectDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 用户/维修员/库管员/采购员
|
||||
* @author cwchen
|
||||
* @date 2023/12/20 20:48
|
||||
*/
|
||||
AjaxResult getUserByRoleIdCbx(SelectDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 10488
|
||||
|
|
@ -120,4 +121,118 @@ public class SelectServiceImpl implements SelectService {
|
|||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceTypeTree(SelectDto dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getDeviceTypeTree(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("单位树/归属部门/所属上级-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAssetAttributesCbx(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getAssetAttributesCbx(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("资产属性-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceFactoryCbx(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getDeviceFactoryCbx(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("机具厂家-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProCbx(SelectDto dto) {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getProCbx(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("工程项目-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAccessoryTree(SelectDto dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getAccessoryTree(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("配件所属上级树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getGoodsShelvesCbx(SelectDto dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getGoodsShelvesCbx(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("货架-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getUserByRoleIdCbx(SelectDto dto) {
|
||||
try {
|
||||
if(Objects.equals("1",dto.getType())){
|
||||
// 用户/维修员/库管员/采购员-下拉选
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
list = mapper.getUserByRoleIdCbxSelect(dto);
|
||||
return AjaxResult.success(list);
|
||||
}else if(Objects.equals("2",dto.getType())){
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
// 用户/维修员/库管员/采购员-树
|
||||
list = mapper.getUserByRoleIdCbxTree(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("用户/维修员/库管员/采购员-查询失败",e);
|
||||
}
|
||||
return AjaxResult.success(null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!--工程-->
|
||||
<!--标段工程-->
|
||||
<select id="getProData" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
/*根据往来单位id关联协议查询工程*/
|
||||
<if test="id != null and id != ''">
|
||||
|
|
@ -88,4 +88,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
|
||||
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
|
||||
</select>
|
||||
<!--设备类型树-->
|
||||
<select id="getDeviceTypeTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
||||
SELECT type_id AS id,
|
||||
type_name AS label,
|
||||
parent_id AS parentId
|
||||
FROM ma_type
|
||||
WHERE del_flag = '0'
|
||||
<if test="level!=null and level!=''">
|
||||
<if test="level == 2">
|
||||
AND level IN ('1','2')
|
||||
</if>
|
||||
<if test="level == 3">
|
||||
AND level IN ('1','2','3')
|
||||
</if>
|
||||
<if test="level == 4">
|
||||
AND level IN ('1','2','3','4')
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
<!--资产属性-->
|
||||
<select id="getAssetAttributesCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
SELECT prop_id AS id,
|
||||
prop_name AS `name`
|
||||
FROM ma_prop_info
|
||||
WHERE del_flag = '0'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
<!--机具厂家-->
|
||||
<select id="getDeviceFactoryCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
SELECT supplier_id AS id,
|
||||
supplier AS `name`
|
||||
FROM ma_supplier_info
|
||||
WHERE del_flag = '0'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
<!--工程项目-->
|
||||
<select id="getProCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
SELECT pro_id AS id,
|
||||
pro_name AS `name`
|
||||
FROM bm_project_info
|
||||
WHERE del_flag = '0'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
<!--配件所属上级树-->
|
||||
<select id="getAccessoryTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
||||
SELECT pa_id AS id,
|
||||
pa_name AS label,
|
||||
parent_id AS parentId
|
||||
FROM ma_part_type
|
||||
WHERE del_flag = '0'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
<!--货架-->
|
||||
<select id="getGoodsShelvesCbx" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
||||
SELECT house_id AS id,
|
||||
house_name AS label,
|
||||
parent_id AS parentId
|
||||
FROM ma_house_info
|
||||
WHERE del_flag = '0' AND status = '0'
|
||||
</select>
|
||||
<!--用户/维修员/库管员/采购员-下拉选-->
|
||||
<select id="getUserByRoleIdCbxSelect" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
SELECT su.user_id AS id,
|
||||
su.user_name AS `name`
|
||||
FROM sys_role sr
|
||||
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
|
||||
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
|
||||
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
|
||||
</select>
|
||||
<!--用户/维修员/库管员/采购员-树-->
|
||||
<select id="getUserByRoleIdCbxTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
||||
SELECT dept_id AS id,
|
||||
parent_id AS parentId,
|
||||
dept_name AS label
|
||||
FROM sys_dept
|
||||
WHERE del_flag = '0'
|
||||
UNION ALL
|
||||
SELECT su.user_id AS id,
|
||||
su.dept_id AS parentId,
|
||||
su.user_name AS label
|
||||
FROM sys_role sr
|
||||
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
|
||||
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
|
||||
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue