Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d543013f30
|
|
@ -1,7 +1,9 @@
|
||||||
package com.bonus.sgzb.base.mapper;
|
package com.bonus.sgzb.base.mapper;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.base.domain.MaLabelBind;
|
||||||
import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机具设备标签ma_label_bindMapper接口
|
* 机具设备标签ma_label_bindMapper接口
|
||||||
|
|
@ -9,6 +11,7 @@ import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
||||||
* @author bonus
|
* @author bonus
|
||||||
* @date 2023-12-13
|
* @date 2023-12-13
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface MaLabelBindMapper
|
public interface MaLabelBindMapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
@ -65,4 +68,6 @@ public interface MaLabelBindMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateMaLabelBindByMaIds(Long maId);
|
public int updateMaLabelBindByMaIds(Long maId);
|
||||||
|
|
||||||
|
int insertLabelBind(MaLabelBind maLabelBind);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@
|
||||||
<insert id="insertMaLabelBindS" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" useGeneratedKeys="true" keyProperty="maId">
|
<insert id="insertMaLabelBindS" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" useGeneratedKeys="true" keyProperty="maId">
|
||||||
insert into ma_label_bind
|
insert into ma_label_bind
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maId != null">ma_id,</if>
|
||||||
<if test="labelCode != null">label_code,</if>
|
<if test="labelCode != null">label_code,</if>
|
||||||
<if test="typeId != null">type_id,</if>
|
<if test="typeId != null">type_id,</if>
|
||||||
<if test="binder != null">binder,</if>
|
<if test="binder != null">binder,</if>
|
||||||
|
|
@ -96,6 +97,7 @@
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maId != null">#{maId},</if>
|
||||||
<if test="labelCode != null">#{labelCode},</if>
|
<if test="labelCode != null">#{labelCode},</if>
|
||||||
<if test="typeId != null">#{typeId},</if>
|
<if test="typeId != null">#{typeId},</if>
|
||||||
<if test="binder != null">#{binder},</if>
|
<if test="binder != null">#{binder},</if>
|
||||||
|
|
@ -105,6 +107,30 @@
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertLabelBind">
|
||||||
|
insert into ma_label_bind
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maId != null">ma_id,</if>
|
||||||
|
<if test="labelCode != null">label_code,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="binder != null">binder,</if>
|
||||||
|
<if test="labelType != null">label_type,</if>
|
||||||
|
<if test="companyId != null">company_id,</if>
|
||||||
|
<if test="isBind != null">binder_time,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maId != null">#{maId},</if>
|
||||||
|
<if test="labelCode != null">#{labelCode},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="binder != null">#{binder},</if>
|
||||||
|
<if test="labelType != null">#{labelType},</if>
|
||||||
|
<if test="companyId != null">#{companyId},</if>
|
||||||
|
<if test="isBind != null">#{binderTime},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
</insert>
|
||||||
<update id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
|
<update id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
|
||||||
update ma_label_bind
|
update ma_label_bind
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,47 @@ public class SelectController {
|
||||||
public AjaxResult getProData(SelectDto dto) {
|
public AjaxResult getProData(SelectDto dto) {
|
||||||
return service.getProData(dto);
|
return service.getProData(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "机具类型下拉选")
|
||||||
|
@PostMapping("getMaTypeData")
|
||||||
|
public AjaxResult getMaTypeData(SelectDto dto){
|
||||||
|
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){
|
||||||
|
return service.getDictByPidCbx(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "单位树/归属部门/所属上级")
|
||||||
|
@PostMapping("getDeptTree")
|
||||||
|
public AjaxResult getDeptTree(SelectDto dto){
|
||||||
|
return service.getDeptTree(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "岗位下拉选")
|
||||||
|
@PostMapping("getPostCbx")
|
||||||
|
public AjaxResult getPostCbx(SelectDto dto){
|
||||||
|
return service.getPostCbx(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "角色下拉选")
|
||||||
|
@PostMapping("getRoleCbx")
|
||||||
|
public AjaxResult getRoleCbx(SelectDto dto){
|
||||||
|
return service.getRoleCbx(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "单位类型下拉选")
|
||||||
|
@PostMapping("getUnitTypeCbx")
|
||||||
|
public AjaxResult getUnitTypeCbx(SelectDto dto){
|
||||||
|
return service.getUnitTypeCbx(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,13 @@ public class SelectDto {
|
||||||
|
|
||||||
/** 参数id*/
|
/** 参数id*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/** 2.物品种类 3.设备类型 4.规格型号*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 字典表 父类值*/
|
||||||
|
private String parentValue;
|
||||||
|
|
||||||
|
/** 层级*/
|
||||||
|
private String level;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,5 @@ public class SelectVo {
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** 名称*/
|
/** 名称*/
|
||||||
private String titleName;
|
private String name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bonus.sgzb.system.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 10488
|
||||||
|
* 下拉树-实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TreeNode {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private long parentId;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<TreeNode> children = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.system.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.system.domain.SelectDto;
|
import com.bonus.sgzb.system.domain.SelectDto;
|
||||||
import com.bonus.sgzb.system.domain.SelectVo;
|
import com.bonus.sgzb.system.domain.SelectVo;
|
||||||
|
import com.bonus.sgzb.system.domain.TreeNode;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -29,4 +30,58 @@ public interface SelectMapper {
|
||||||
* @date 2023/12/20 15:05
|
* @date 2023/12/20 15:05
|
||||||
*/
|
*/
|
||||||
List<SelectVo> getProData(SelectDto dto);
|
List<SelectVo> getProData(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @description 机具类型
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 16:02
|
||||||
|
*/
|
||||||
|
List<SelectVo> getMaTypeData(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @description 数据字典下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 16:23
|
||||||
|
*/
|
||||||
|
List<SelectVo> getDictByPidCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<TreeVo>
|
||||||
|
* @description 单位树/归属部门/所属上级
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 17:10
|
||||||
|
*/
|
||||||
|
List<TreeNode> getDeptTree(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @description 岗位下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 17:50
|
||||||
|
*/
|
||||||
|
List<SelectVo> getPostCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @description 角色下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 17:56
|
||||||
|
*/
|
||||||
|
List<SelectVo> getRoleCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @description 单位类型下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 18:01
|
||||||
|
*/
|
||||||
|
List<SelectVo> getUnitTypeCbx(SelectDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,67 @@ public interface SelectService {
|
||||||
* @date 2023/12/20 15:04
|
* @date 2023/12/20 15:04
|
||||||
*/
|
*/
|
||||||
AjaxResult getProData(SelectDto dto);
|
AjaxResult getProData(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description 机具类型
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 16:02
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* @description 数据字典下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 16:22
|
||||||
|
*/
|
||||||
|
AjaxResult getDictByPidCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description 单位树/归属部门/所属上级
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 16:36
|
||||||
|
*/
|
||||||
|
AjaxResult getDeptTree(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description 岗位下拉树
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 17:45
|
||||||
|
*/
|
||||||
|
AjaxResult getPostCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description 角色下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 17:56
|
||||||
|
*/
|
||||||
|
AjaxResult getRoleCbx(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description 单位类型下拉选
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2023/12/20 18:00
|
||||||
|
*/
|
||||||
|
AjaxResult getUnitTypeCbx(SelectDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,12 @@ package com.bonus.sgzb.system.service.impl;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.system.domain.SelectDto;
|
import com.bonus.sgzb.system.domain.SelectDto;
|
||||||
import com.bonus.sgzb.system.domain.SelectVo;
|
import com.bonus.sgzb.system.domain.SelectVo;
|
||||||
|
import com.bonus.sgzb.system.domain.TreeNode;
|
||||||
import com.bonus.sgzb.system.mapper.SelectMapper;
|
import com.bonus.sgzb.system.mapper.SelectMapper;
|
||||||
import com.bonus.sgzb.system.service.SelectService;
|
import com.bonus.sgzb.system.service.SelectService;
|
||||||
|
import com.bonus.sgzb.system.util.TreeBuild;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -29,7 +32,7 @@ public class SelectServiceImpl implements SelectService {
|
||||||
try {
|
try {
|
||||||
list = mapper.getUnitData(dto);
|
list = mapper.getUnitData(dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("往来单位-查询失败",e);
|
log.error("往来单位-查询失败", e);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +43,80 @@ public class SelectServiceImpl implements SelectService {
|
||||||
try {
|
try {
|
||||||
list = mapper.getProData(dto);
|
list = mapper.getProData(dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("工程-查询失败",e);
|
log.error("工程-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMaTypeData(SelectDto dto) {
|
||||||
|
List<SelectVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getMaTypeData(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("机具类型-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getDictByPidCbx(SelectDto dto) {
|
||||||
|
List<SelectVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getDictByPidCbx(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("数据字典-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getDeptTree(SelectDto dto) {
|
||||||
|
List<TreeNode> groupList = new ArrayList<>();
|
||||||
|
List<TreeNode> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getDeptTree(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 getPostCbx(SelectDto dto) {
|
||||||
|
List<SelectVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getPostCbx(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("岗位下拉选-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getRoleCbx(SelectDto dto) {
|
||||||
|
List<SelectVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getRoleCbx(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("角色下拉选-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getUnitTypeCbx(SelectDto dto) {
|
||||||
|
List<SelectVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getUnitTypeCbx(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("单位类型下拉选-查询失败", e);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.bonus.sgzb.system.util;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.system.domain.TreeNode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BuildTree 构建树形结构
|
||||||
|
* @author 10488
|
||||||
|
*/
|
||||||
|
public class TreeBuild {
|
||||||
|
|
||||||
|
public List<TreeNode> nodeList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
* @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。
|
||||||
|
*/
|
||||||
|
public TreeBuild(List<TreeNode> nodeList){
|
||||||
|
this.nodeList = nodeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需构建的所有根节点(顶级节点) "0"
|
||||||
|
* @return 所有根节点List集合
|
||||||
|
*/
|
||||||
|
public List<TreeNode> getRootNode(){
|
||||||
|
// 保存所有根节点(所有根节点的数据)
|
||||||
|
List<TreeNode> rootNodeList = new ArrayList<>();
|
||||||
|
// treeNode:查询出的每一条数据(节点)
|
||||||
|
for (TreeNode treeNode : nodeList){
|
||||||
|
// 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
|
||||||
|
if (0 == treeNode.getParentId()) {
|
||||||
|
// 是,添加
|
||||||
|
rootNodeList.add(treeNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootNodeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据每一个顶级节点(根节点)进行构建树形结构
|
||||||
|
* @return 构建整棵树
|
||||||
|
*/
|
||||||
|
public List<TreeNode> buildTree(){
|
||||||
|
// treeNodes:保存一个顶级节点所构建出来的完整树形
|
||||||
|
List<TreeNode> treeNodes = new ArrayList<TreeNode>();
|
||||||
|
// getRootNode():获取所有的根节点
|
||||||
|
for (TreeNode treeRootNode : getRootNode()) {
|
||||||
|
// 将顶级节点进行构建子树
|
||||||
|
treeRootNode = buildChildTree(treeRootNode);
|
||||||
|
// 完成一个顶级节点所构建的树形,增加进来
|
||||||
|
treeNodes.add(treeRootNode);
|
||||||
|
}
|
||||||
|
return treeNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归-----构建子树形结构
|
||||||
|
* @param pNode 根节点(顶级节点)
|
||||||
|
* @return 整棵树
|
||||||
|
*/
|
||||||
|
public TreeNode buildChildTree(TreeNode pNode){
|
||||||
|
List<TreeNode> childTree = new ArrayList<TreeNode>();
|
||||||
|
// nodeList:所有节点集合(所有数据)
|
||||||
|
for (TreeNode treeNode : nodeList) {
|
||||||
|
// 判断当前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点
|
||||||
|
if (treeNode.getParentId() == pNode.getId()) {
|
||||||
|
// 再递归进行判断当前节点的情况,调用自身方法
|
||||||
|
childTree.add(buildChildTree(treeNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
||||||
|
pNode.setChildren(childTree);
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
/*根据标段工程id关联协议查询往来单位*/
|
/*根据标段工程id关联协议查询往来单位*/
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
SELECT DISTINCT bui.unit_id AS id,
|
SELECT DISTINCT bui.unit_id AS id,
|
||||||
bui.unit_name AS titleName
|
bui.unit_name AS `name`
|
||||||
FROM bm_project_lot bpl
|
FROM bm_project_lot bpl
|
||||||
LEFT JOIN bm_agreement_info bai ON bpl.lot_id = bai.project_id AND bai.`status` = '1'
|
LEFT JOIN bm_agreement_info bai ON bpl.lot_id = bai.project_id AND bai.`status` = '1'
|
||||||
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id AND bui.del_flag = '0'
|
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id AND bui.del_flag = '0'
|
||||||
|
|
@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
<if test="id == null or id == ''">
|
<if test="id == null or id == ''">
|
||||||
SELECT unit_id AS id,
|
SELECT unit_id AS id,
|
||||||
unit_name AS titleName
|
unit_name AS `name`
|
||||||
FROM bm_unit_info
|
FROM bm_unit_info
|
||||||
WHERE del_flag = '0'
|
WHERE del_flag = '0'
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
/*根据往来单位id关联协议查询工程*/
|
/*根据往来单位id关联协议查询工程*/
|
||||||
<if test="id != null and id != ''">
|
<if test="id != null and id != ''">
|
||||||
SELECT DISTINCT bpl.lot_id AS id,
|
SELECT DISTINCT bpl.lot_id AS id,
|
||||||
bpl.lot_name AS titleName
|
bpl.lot_name AS `name`
|
||||||
FROM bm_unit_info bui
|
FROM bm_unit_info bui
|
||||||
LEFT JOIN bm_agreement_info bai ON bui.unit_id = bai.unit_id AND bai.`status` = '1'
|
LEFT JOIN bm_agreement_info bai ON bui.unit_id = bai.unit_id AND bai.`status` = '1'
|
||||||
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id AND bpl.del_flag = '0'
|
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id AND bpl.del_flag = '0'
|
||||||
|
|
@ -36,9 +36,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
<if test="id == null or id == ''">
|
<if test="id == null or id == ''">
|
||||||
SELECT lot_id AS id,
|
SELECT lot_id AS id,
|
||||||
lot_name AS titleName
|
lot_name AS `name`
|
||||||
FROM bm_project_lot
|
FROM bm_project_lot
|
||||||
WHERE del_flag = '0'
|
WHERE del_flag = '0'
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--机具类型-->
|
||||||
|
<select id="getMaTypeData" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||||
|
SELECT type_id AS id,
|
||||||
|
type_name AS `name`
|
||||||
|
FROM ma_type
|
||||||
|
WHERE `level` = #{type} AND del_flag = '0'
|
||||||
|
</select>
|
||||||
|
<!--数据字典下拉选-->
|
||||||
|
<select id="getDictByPidCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||||
|
SELECT sd2.id,sd2.`name`
|
||||||
|
FROM sys_dic sd
|
||||||
|
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
|
||||||
|
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
|
||||||
|
</select>
|
||||||
|
<!--单位树/归属部门/所属上级-->
|
||||||
|
<select id="getDeptTree" 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'
|
||||||
|
ORDER BY order_num
|
||||||
|
</select>
|
||||||
|
<!--岗位下拉选-->
|
||||||
|
<select id="getPostCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||||
|
SELECT post_id AS id,
|
||||||
|
post_name AS `name`
|
||||||
|
FROM sys_post
|
||||||
|
WHERE status = '0'
|
||||||
|
ORDER BY post_sort
|
||||||
|
</select>
|
||||||
|
<!--角色下拉选-->
|
||||||
|
<select id="getRoleCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||||
|
SELECT role_id AS id,
|
||||||
|
role_name AS `name`
|
||||||
|
FROM sys_role
|
||||||
|
WHERE status = '0'
|
||||||
|
ORDER BY role_sort
|
||||||
|
</select>
|
||||||
|
<!--单位类型下拉选-->
|
||||||
|
<select id="getUnitTypeCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||||
|
SELECT sd2.id,sd2.`name`
|
||||||
|
FROM sys_dic sd
|
||||||
|
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
|
||||||
|
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue