GST002精简

gst2base
Gitea 2 days ago
parent f202876630
commit aa87f67627
  1. 77
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/entity/Basicsskill.java
  2. 35
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/mapper/BasicsskillMapper.java
  3. 25
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/mapper/xml/BasicsskillMapper.xml
  4. 74
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/service/IBasicsskillService.java
  5. 219
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/service/impl/BasicsskillServiceImpl.java
  6. 71
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/entity/Compskill.java
  7. 53
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/entity/Compskillvo.java
  8. 17
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/mapper/CompskillMapper.java
  9. 5
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/mapper/xml/CompskillMapper.xml
  10. 14
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/service/ICompskillService.java
  11. 19
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/service/impl/CompskillServiceImpl.java

@ -1,77 +0,0 @@
package org.jeecg.modules.demo.basicsskill.entity;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.UnsupportedEncodingException;
/**
* @Description: 基础能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Data
@TableName("basicsskill")
@ApiModel(value="basicsskill对象", description="基础能力设置")
public class Basicsskill implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**上级*/
/*@Excel(name = "上级", width = 15)*/
@ApiModelProperty(value = "上级")
private String pid;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String name;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
@Dict(dicCode = "yn")
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
/**
* 启停
*/
@Excel(name = "启停", width = 15)
@ApiModelProperty(value = "启停")
private String startstop;
}

@ -1,35 +0,0 @@
package org.jeecg.modules.demo.basicsskill.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import java.util.List;
import java.util.Map;
/**
* @Description: 基础能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface BasicsskillMapper extends BaseMapper<Basicsskill> {
/**
* 编辑节点状态
* @param id
* @param status
*/
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);
/**
* vue3专用根据父级ID查询树节点数据
*
* @param pid
* @param query
* @return
*/
List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);
}

@ -1,25 +0,0 @@
<?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="org.jeecg.modules.demo.basicsskill.mapper.BasicsskillMapper">
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
update basicsskill set has_child = #{status} where id = #{id}
</update>
<!-- 【vue3专用】 -->
<select id="queryListByPid" parameterType="java.lang.Object" resultType="org.jeecg.common.system.vo.SelectTreeModel">
select
id as "key",
name as "title",
(case when has_child = '1' then 0 else 1 end) as isLeaf,
pid as parentId
from basicsskill
where pid = #{pid}
<if test="query != null">
<foreach collection="query.entrySet()" item="value" index="key">
and ${key} = #{value}
</foreach>
</if>
</select>
</mapper>

@ -1,74 +0,0 @@
package org.jeecg.modules.demo.basicsskill.service;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.exception.JeecgBootException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
/**
* @Description: 基础能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface IBasicsskillService extends IService<Basicsskill> {
/**根节点父ID的值*/
public static final String ROOT_PID_VALUE = "0";
/**树节点有子节点状态值*/
public static final String HASCHILD = "1";
/**树节点无子节点状态值*/
public static final String NOCHILD = "0";
/**
* 新增节点
*
* @param basicsskill
*/
void addBasicsskill(Basicsskill basicsskill);
/**
* 修改节点
*
* @param basicsskill
* @throws JeecgBootException
*/
void updateBasicsskill(Basicsskill basicsskill) throws JeecgBootException;
/**
* 删除节点
*
* @param id
* @throws JeecgBootException
*/
void deleteBasicsskill(String id) throws JeecgBootException;
/**
* 查询所有数据无分页
*
* @param queryWrapper
* @return List<Basicsskill>
*/
List<Basicsskill> queryTreeListNoPage(QueryWrapper<Basicsskill> queryWrapper);
/**
* vue3专用根据父级编码加载分类字典的数据
*
* @param parentCode
* @return
*/
List<SelectTreeModel> queryListByCode(String parentCode);
/**
* vue3专用根据pid查询子节点集合
*
* @param pid
* @return
*/
List<SelectTreeModel> queryListByPid(String pid);
}

@ -1,219 +0,0 @@
package org.jeecg.modules.demo.basicsskill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import org.jeecg.modules.demo.basicsskill.mapper.BasicsskillMapper;
import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 基础能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Service
public class BasicsskillServiceImpl extends ServiceImpl<BasicsskillMapper, Basicsskill> implements IBasicsskillService {
@Override
public void addBasicsskill(Basicsskill basicsskill) {
//新增时设置hasChild为0
basicsskill.setHasChild(IBasicsskillService.NOCHILD);
if(oConvertUtils.isEmpty(basicsskill.getPid())){
basicsskill.setPid(IBasicsskillService.ROOT_PID_VALUE);
}else{
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
Basicsskill parent = baseMapper.selectById(basicsskill.getPid());
if(parent!=null && !"1".equals(parent.getHasChild())){
parent.setHasChild("1");
baseMapper.updateById(parent);
}
}
baseMapper.insert(basicsskill);
}
@Override
public void updateBasicsskill(Basicsskill basicsskill) {
Basicsskill entity = this.getById(basicsskill.getId());
if(entity==null) {
throw new JeecgBootException("未找到对应实体");
}
String old_pid = entity.getPid();
String new_pid = basicsskill.getPid();
if(!old_pid.equals(new_pid)) {
updateOldParentNode(old_pid);
if(oConvertUtils.isEmpty(new_pid)){
basicsskill.setPid(IBasicsskillService.ROOT_PID_VALUE);
}
if(!IBasicsskillService.ROOT_PID_VALUE.equals(basicsskill.getPid())) {
baseMapper.updateTreeNodeStatus(basicsskill.getPid(), IBasicsskillService.HASCHILD);
}
}
baseMapper.updateById(basicsskill);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteBasicsskill(String id) throws JeecgBootException {
//查询选中节点下所有子节点一并删除
id = this.queryTreeChildIds(id);
if(id.indexOf(",")>0) {
StringBuffer sb = new StringBuffer();
String[] idArr = id.split(",");
for (String idVal : idArr) {
if(idVal != null){
Basicsskill basicsskill = this.getById(idVal);
String pidVal = basicsskill.getPid();
//查询此节点上一级是否还有其他子节点
List<Basicsskill> dataList = baseMapper.selectList(new QueryWrapper<Basicsskill>().eq("pid", pidVal).notIn("id",Arrays.asList(idArr)));
boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(pidVal) && !sb.toString().contains(pidVal);
if(flag){
//如果当前节点原本有子节点 现在木有了,更新状态
sb.append(pidVal).append(",");
}
}
}
//批量删除节点
baseMapper.deleteBatchIds(Arrays.asList(idArr));
//修改已无子节点的标识
String[] pidArr = sb.toString().split(",");
for(String pid : pidArr){
this.updateOldParentNode(pid);
}
}else{
Basicsskill basicsskill = this.getById(id);
if(basicsskill==null) {
throw new JeecgBootException("未找到对应实体");
}
updateOldParentNode(basicsskill.getPid());
baseMapper.deleteById(id);
}
}
@Override
public List<Basicsskill> queryTreeListNoPage(QueryWrapper<Basicsskill> queryWrapper) {
List<Basicsskill> dataList = baseMapper.selectList(queryWrapper);
List<Basicsskill> mapList = new ArrayList<>();
for(Basicsskill data : dataList){
String pidVal = data.getPid();
//递归查询子节点的根节点
if(pidVal != null && !IBasicsskillService.NOCHILD.equals(pidVal)){
Basicsskill rootVal = this.getTreeRoot(pidVal);
if(rootVal != null && !mapList.contains(rootVal)){
mapList.add(rootVal);
}
}else{
if(!mapList.contains(data)){
mapList.add(data);
}
}
}
return mapList;
}
@Override
public List<SelectTreeModel> queryListByCode(String parentCode) {
String pid = ROOT_PID_VALUE;
if (oConvertUtils.isNotEmpty(parentCode)) {
LambdaQueryWrapper<Basicsskill> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Basicsskill::getPid, parentCode);
List<Basicsskill> list = baseMapper.selectList(queryWrapper);
if (list == null || list.size() == 0) {
throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!");
}
if (list.size() > 1) {
throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!");
}
pid = list.get(0).getId();
}
return baseMapper.queryListByPid(pid, null);
}
@Override
public List<SelectTreeModel> queryListByPid(String pid) {
if (oConvertUtils.isEmpty(pid)) {
pid = ROOT_PID_VALUE;
}
return baseMapper.queryListByPid(pid, null);
}
/**
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值
* @param pid
*/
private void updateOldParentNode(String pid) {
if(!IBasicsskillService.ROOT_PID_VALUE.equals(pid)) {
Long count = baseMapper.selectCount(new QueryWrapper<Basicsskill>().eq("pid", pid));
if(count==null || count<=1) {
baseMapper.updateTreeNodeStatus(pid, IBasicsskillService.NOCHILD);
}
}
}
/**
* 递归查询节点的根节点
* @param pidVal
* @return
*/
private Basicsskill getTreeRoot(String pidVal){
Basicsskill data = baseMapper.selectById(pidVal);
if(data != null && !IBasicsskillService.ROOT_PID_VALUE.equals(data.getPid())){
return this.getTreeRoot(data.getPid());
}else{
return data;
}
}
/**
* 根据id查询所有子节点id
* @param ids
* @return
*/
private String queryTreeChildIds(String ids) {
//获取id数组
String[] idArr = ids.split(",");
StringBuffer sb = new StringBuffer();
for (String pidVal : idArr) {
if(pidVal != null){
if(!sb.toString().contains(pidVal)){
if(sb.toString().length() > 0){
sb.append(",");
}
sb.append(pidVal);
this.getTreeChildIds(pidVal,sb);
}
}
}
return sb.toString();
}
/**
* 递归查询所有子节点
* @param pidVal
* @param sb
* @return
*/
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
List<Basicsskill> dataList = baseMapper.selectList(new QueryWrapper<Basicsskill>().eq("pid", pidVal));
if(dataList != null && dataList.size()>0){
for(Basicsskill tree : dataList) {
if(!sb.toString().contains(tree.getId())){
sb.append(",").append(tree.getId());
}
this.getTreeChildIds(tree.getId(),sb);
}
}
return sb;
}
}

@ -1,71 +0,0 @@
package org.jeecg.modules.demo.compskill.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Data
@TableName("compskill")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="compskill对象", description="项目能力设置")
public class Compskill implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**年度比赛项目id*/
@Excel(name = "年度比赛项目id", width = 15)
@ApiModelProperty(value = "年度比赛项目id")
private String annucompid;
/**能力id*/
@Excel(name = "能力id", width = 15)
@ApiModelProperty(value = "能力id")
private String capacityid;
/**权值*/
@Excel(name = "权值", width = 15)
@ApiModelProperty(value = "权值")
private Integer weight;
}

@ -1,53 +0,0 @@
package org.jeecg.modules.demo.compskill.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class Compskillvo {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**年度比赛项目id*/
@Excel(name = "年度比赛项目id", width = 15)
@ApiModelProperty(value = "年度比赛项目id")
private String annucompid;
/**能力id*/
@Excel(name = "能力id", width = 15)
@ApiModelProperty(value = "能力id")
private String capacityid;
/**权值*/
@Excel(name = "权值", width = 15)
@ApiModelProperty(value = "权值")
private Integer weight;
private String annual;
private String comp;
}

@ -1,17 +0,0 @@
package org.jeecg.modules.demo.compskill.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface CompskillMapper extends BaseMapper<Compskill> {
}

@ -1,5 +0,0 @@
<?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="org.jeecg.modules.demo.compskill.mapper.CompskillMapper">
</mapper>

@ -1,14 +0,0 @@
package org.jeecg.modules.demo.compskill.service;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
public interface ICompskillService extends IService<Compskill> {
}

@ -1,19 +0,0 @@
package org.jeecg.modules.demo.compskill.service.impl;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.mapper.CompskillMapper;
import org.jeecg.modules.demo.compskill.service.ICompskillService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Version: V1.0
*/
@Service
public class CompskillServiceImpl extends ServiceImpl<CompskillMapper, Compskill> implements ICompskillService {
}
Loading…
Cancel
Save