Merge branch 'develop_3' into 'develop_master'

Develop 3

See merge request !34
This commit is contained in:
super_liu
2021-07-15 10:38:32 +00:00
16 changed files with 434 additions and 12 deletions
@@ -0,0 +1,40 @@
package com.adc.da.slrs.sarModelTree.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@RestController
@Api(tags = "福田标准法规--标准法规库-模块树结构")
@RequestMapping("/${restPath}/sarModelTree")
public class SarModelTreeController extends BaseController<SarModelTree> {
@Autowired
private ISarModelTreeService iSarModelTreeService;
@ApiOperation("查询所有资源")
@GetMapping("/list")
public ResponseMessage<List<SarModelTree>> getAll(SarModelTree sarVppsTree){
List<SarModelTree> tsResources = iSarModelTreeService.getAll(sarVppsTree);
return Result.success(tsResources);
}
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarModelTree.dao;
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
public interface SarModelTreeDao extends BaseMapper<SarModelTree> {
}
@@ -0,0 +1,68 @@
package com.adc.da.slrs.sarModelTree.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarModelTree对象", description="")
public class SarModelTree extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId("ID")
private String id;
@TableField("NAME")
private String name;
@TableField("PID")
private String pid;
@TableField("MODEL")
private String model;
@ApiModelProperty(value = "模块结构特性")
@TableField("FEATURES")
private String features;
@ApiModelProperty(value = "删除标识 1:未删除 2:已删除")
@TableField("DEL_FLAG")
private String delFlag;
@ApiModelProperty(value = "排序序号")
@TableField("SORT")
private Integer sort;
@ApiModelProperty(value = "子菜单")
@TableField(exist = false)
private List<SarModelTree> children;
@ApiModelProperty(value = "上级菜单名称")
@TableField(exist = false)
private String parentIdsName;
@TableField(exist=false)
private List<String> roleIds;
@TableField(exist=false)
private List<String> childMenuIds;
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarModelTree.service;
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
public interface ISarModelTreeService extends IService<SarModelTree> {
List<SarModelTree> getAll(SarModelTree sarModelTree);
}
@@ -0,0 +1,53 @@
package com.adc.da.slrs.sarModelTree.service.impl;
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
import com.adc.da.slrs.sarModelTree.dao.SarModelTreeDao;
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@Service
public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarModelTree> implements ISarModelTreeService {
/**
* 查询所有菜单
* @param sarModelTree
*/
@Override
public List<SarModelTree> getAll(SarModelTree sarModelTree) {
QueryWrapper<SarModelTree> tsResourceQueryWrapper=new QueryWrapper<>();
tsResourceQueryWrapper.isNull("PID");
List<SarModelTree> list = this.baseMapper.selectList(tsResourceQueryWrapper);
for(SarModelTree tree:list){
tree.setChildren(recursionGetChildren((tree)));
}
return list;
}
/**
* 递归调用获取子节点
* @param parent:父节点
* @return List<SarMenu>
*/
private List<SarModelTree> recursionGetChildren(SarModelTree parent){
QueryWrapper<SarModelTree> sarMenuQueryWrapper=new QueryWrapper<>();
sarMenuQueryWrapper.orderByAsc("SORT");
sarMenuQueryWrapper.eq("PID",parent.getId());
List<SarModelTree> children=this.baseMapper.selectList(sarMenuQueryWrapper);
for(SarModelTree sarMenu:children){
sarMenu.setChildren(recursionGetChildren((sarMenu)));
}
return children;
}
}
@@ -8,8 +8,8 @@ import java.util.List;
public interface SarModelDao extends BaseMapper<SarModel> {
@Select("select id,pid,CONCAT(name,model) name,features from sar_model_tree where 1=1 and isnull(pid)")
List<SarModel> findTreeAll();
@Select("select id,pid,CONCAT(name,model) name,features from sar_model_tree where 1=1 and pid = #{pid}")
List<SarModel> selectList(@Param("pid") String pid);
// @Select("select id,pid,CONCAT(name,model) name,features from sar_model_tree where 1=1 and isnull(pid)")
// List<SarModel> findTreeAll();
// @Select("select id,pid,CONCAT(name,model) name,features from sar_model_tree where 1=1 and pid = #{pid}")
// List<SarModel> selectList(@Param("pid") String pid);
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarTree.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -12,6 +13,7 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarVPPS对象", description="")
@TableName(value = "sar_vpps_tree")
public class SarVPPS extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarTree.service.impl;
import com.adc.da.slrs.sarTree.dao.SarModelDao;
import com.adc.da.slrs.sarTree.entity.SarModel;
import com.adc.da.slrs.sarTree.service.SarModelService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,8 +24,10 @@ public class SarModelServiceImpl implements SarModelService {
@Override
public List<SarModel> findTreeAll() {
//查询父级都为null的数据
List<SarModel> sarVppsList = sarModelDao.findTreeAll();
for (SarModel sarVppsOne : sarVppsList) {
QueryWrapper<SarModel> qw = new QueryWrapper<>();
qw.isNull("pid");
List<SarModel> sarVppsList = sarModelDao.selectList(qw);
for (SarModel sarVppsOne:sarVppsList) {
sarVppsOne.setChildren(getChildren(sarVppsOne));
}
return sarVppsList;
@@ -32,14 +35,15 @@ public class SarModelServiceImpl implements SarModelService {
/**
* 递归调用获取子节点
*
* @param parent:父节点
* @return List<TsResource>
*/
private List<SarModel> getChildren(SarModel parent) {
private List<SarModel> getChildren(SarModel parent){
String pid = parent.getId();
List<SarModel> children = sarModelDao.selectList(pid);
for (SarModel sarVppsOne : children) {
QueryWrapper<SarModel> qw = new QueryWrapper<>();
qw.eq("pid",parent.getId());
List<SarModel> children=sarModelDao.selectList(qw);
for(SarModel sarVppsOne:children){
sarVppsOne.setChildren(getChildren((sarVppsOne)));
}
return children;
@@ -24,7 +24,9 @@ public class SarVPPSServiceImpl implements SarVPPSService {
@Override
public List<SarVPPS> findTreeAll() {
//查询父级都为null的数据
List<SarVPPS> sarVppsList = sarVPPSDao.findTreeAll();
QueryWrapper<SarVPPS> qw = new QueryWrapper<>();
qw.isNull("pid");
List<SarVPPS> sarVppsList = sarVPPSDao.selectList(qw);
for (SarVPPS sarVppsOne:sarVppsList) {
sarVppsOne.setChildren(getChildren(sarVppsOne));
}
@@ -38,7 +40,9 @@ public class SarVPPSServiceImpl implements SarVPPSService {
*/
private List<SarVPPS> getChildren(SarVPPS parent){
String pid = parent.getId();
List<SarVPPS> children = sarVPPSDao.selectList(pid);
QueryWrapper<SarVPPS> qw = new QueryWrapper<>();
qw.eq("pid",parent.getId());
List<SarVPPS> children=sarVPPSDao.selectList(qw);
for(SarVPPS sarVppsOne:children){
sarVppsOne.setChildren(getChildren((sarVppsOne)));
}
@@ -0,0 +1,41 @@
package com.adc.da.slrs.sarVppsTree.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarVppsTree.service.ISarVppsTreeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@RestController
@Api(tags = "福田标准法规--标准法规库-Vpps树结构")
@RequestMapping("/${restPath}/sarVppsTree")
public class SarVppsTreeController extends BaseController<SarVppsTree> {
@Autowired
private ISarVppsTreeService iSarVppsTreeService;
@ApiOperation("查询所有资源")
@GetMapping("/list")
public ResponseMessage<List<SarVppsTree>> getAll(SarVppsTree sarVppsTree){
List<SarVppsTree> tsResources = iSarVppsTreeService.getAll(sarVppsTree);
return Result.success(tsResources);
}
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarVppsTree.dao;
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
public interface SarVppsTreeDao extends BaseMapper<SarVppsTree> {
}
@@ -0,0 +1,76 @@
package com.adc.da.slrs.sarVppsTree.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarVppsTree对象", description="")
public class SarVppsTree extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId("ID")
private String id;
@ApiModelProperty(value = "VPPS编码")
@TableField("VPPS_CODE")
private String vppsCode;
@ApiModelProperty(value = "父级id")
@TableField("PID")
private String pid;
@ApiModelProperty(value = "编码")
@TableField("CODE")
private String code;
@ApiModelProperty(value = "中文名称")
@TableField("CHINESE_NAME")
private String chineseName;
@ApiModelProperty(value = "中文名称")
@TableField("ENGLISH_NAME")
private String englishName;
@ApiModelProperty(value = "删除标识 1:未删除 2:已删除")
@TableField("DEL_FLAG")
private String delFlag;
@ApiModelProperty(value = "排序序号")
@TableField("SORT")
private Integer sort;
@ApiModelProperty(value = "子菜单")
@TableField(exist = false)
private List<SarVppsTree> children;
@ApiModelProperty(value = "上级菜单名称")
@TableField(exist = false)
private String parentIdsName;
@TableField(exist=false)
private List<String> roleIds;
@TableField(exist=false)
private List<String> childMenuIds;
}
@@ -0,0 +1,19 @@
package com.adc.da.slrs.sarVppsTree.service;
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
public interface ISarVppsTreeService extends IService<SarVppsTree> {
List<SarVppsTree> getAll(SarVppsTree sarVppsTree);
}
@@ -0,0 +1,53 @@
package com.adc.da.slrs.sarVppsTree.service.impl;
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
import com.adc.da.slrs.sarVppsTree.dao.SarVppsTreeDao;
import com.adc.da.slrs.sarVppsTree.service.ISarVppsTreeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-07-15
*/
@Service
public class SarVppsTreeServiceImpl extends ServiceImpl<SarVppsTreeDao, SarVppsTree> implements ISarVppsTreeService {
/**
* 查询所有菜单
* @param sarVppsTree
*/
@Override
public List<SarVppsTree> getAll(SarVppsTree sarVppsTree) {
QueryWrapper<SarVppsTree> tsResourceQueryWrapper=new QueryWrapper<>();
tsResourceQueryWrapper.isNull("PID");
List<SarVppsTree> list = this.baseMapper.selectList(tsResourceQueryWrapper);
for(SarVppsTree tree:list){
tree.setChildren(recursionGetChildren((tree)));
}
return list;
}
/**
* 递归调用获取子节点
* @param parent:父节点
* @return List<SarMenu>
*/
private List<SarVppsTree> recursionGetChildren(SarVppsTree parent){
QueryWrapper<SarVppsTree> sarMenuQueryWrapper=new QueryWrapper<>();
sarMenuQueryWrapper.orderByAsc("SORT");
sarMenuQueryWrapper.eq("PID",parent.getId());
List<SarVppsTree> children=this.baseMapper.selectList(sarMenuQueryWrapper);
for(SarVppsTree sarMenu:children){
sarMenu.setChildren(recursionGetChildren((sarMenu)));
}
return children;
}
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.slrs.sarModelTree.dao.SarModelTreeDao">
</mapper>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.slrs.sarVppsTree.dao.SarVppsTreeDao">
</mapper>