版本修改 4-26 todo
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-system</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -15,41 +16,57 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>demo-system-api</artifactId>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<version>0.0.1</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-common-config</artifactId>
|
||||
<artifactId>demo-common-core</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-common-base</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<!-- mysql驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.26</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-common-redis</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-common-jdbc</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yxt.demo</groupId>
|
||||
<artifactId>demo-common-utils</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
<version>2.0.0.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
package com.yxt.demo.system;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"com.yxt.demo.common",
|
||||
"com.yxt.demo.system"
|
||||
})
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {})
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.yxt.demo.system.biz.*")
|
||||
public class SystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:23
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictCommon extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 4167649996979863792L;
|
||||
@ApiModelProperty("code值")
|
||||
private String dictType;
|
||||
@ApiModelProperty("key")
|
||||
private String dictKey;
|
||||
@ApiModelProperty("value")
|
||||
private String dictValue;
|
||||
@ApiModelProperty("父级sid")
|
||||
private String parentSid;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 15:34
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictCommonDto{
|
||||
|
||||
private String sid;
|
||||
|
||||
@ApiModelProperty(value = "数据项值", required = true)
|
||||
@NotBlank(message = "数据项值不能为空")
|
||||
private String dictKey;
|
||||
|
||||
@ApiModelProperty(value = "数据类型", required = true)
|
||||
@NotBlank(message = "数据类型不能为空")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "数据项相对应的value值", required = true)
|
||||
@NotBlank(message = "数据项相对应的value值不能为空")
|
||||
private String dictValue;
|
||||
|
||||
@ApiModelProperty(value = "数据项的父级sid", required = true)
|
||||
@NotBlank(message = "数据项的父级sid不能为空")
|
||||
private String parentSid;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:16
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "数据字典数据项")
|
||||
public interface DictCommonFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@ApiOperation(value = "数据字典数据项保存")
|
||||
ResultBean save(@Valid @RequestBody DictCommonDto dictCommonDto);
|
||||
|
||||
@DeleteMapping("/delete/{sid}")
|
||||
@ApiOperation(value = "删除")
|
||||
ResultBean delete(@ApiParam(value = "数据项sid", required = true) @PathVariable("sid") String sid);
|
||||
|
||||
@PostMapping("/pageList")
|
||||
@ApiOperation(value = "数据字典数据项分页列表")
|
||||
ResultBean<PagerVo<DictCommonVo>> pageList(@RequestBody PagerQuery<DictCommonQuery> pagerQuery);
|
||||
|
||||
@GetMapping("/typeValues")
|
||||
@ApiOperation("下拉框的获取")
|
||||
ResultBean<List<DictCommonVo>> getTypeValues(@RequestParam("type") String type, @RequestParam(value = "psid", defaultValue = "0") String psid);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:46
|
||||
* @Description
|
||||
*/
|
||||
public class DictCommonFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 16:20
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictCommonQuery implements Query {
|
||||
private static final long serialVersionUID = 6235063340152975098L;
|
||||
|
||||
@ApiModelProperty(value = "数据字典条目key", required = false)
|
||||
private String dictKey;
|
||||
|
||||
@ApiModelProperty(value = "数据字典文本", required = false)
|
||||
private String dictValue;
|
||||
|
||||
@ApiModelProperty(value = "dictType")
|
||||
private String dictType;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/9/30 15:33
|
||||
* @description 下拉框条件
|
||||
*/
|
||||
@Data
|
||||
public class DictCommonTypeQuery implements Query {
|
||||
private static final long serialVersionUID = 139959085226402464L;
|
||||
|
||||
@ApiModelProperty(value = "数据字典类型", required = true)
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "psid", required = false, example = "0")
|
||||
private String psid;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.vo.Vo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 16:19
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictCommonVo implements Vo {
|
||||
|
||||
private static final long serialVersionUID = 5516430679944504663L;
|
||||
@ApiModelProperty(value = "数据字典项key")
|
||||
private String dictKey;
|
||||
|
||||
@ApiModelProperty(value = "数据字典类型")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "数据字典项名称")
|
||||
private String dictValue;
|
||||
@ApiModelProperty(value = "父级sid:0为第一级")
|
||||
private String parentSid;
|
||||
|
||||
private String sid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:27
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictType extends BaseEntity {
|
||||
private static final long serialVersionUID = 8854804037013178995L;
|
||||
|
||||
@ApiModelProperty("类型代码")
|
||||
private String dictTypeCode;
|
||||
@ApiModelProperty("类型名称")
|
||||
private String dictTypeName;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 16:48
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictTypeDto implements Dto {
|
||||
private static final long serialVersionUID = -7638091202643596231L;
|
||||
|
||||
@ApiModelProperty(value = "类型代码", required = true)
|
||||
@NotBlank(message = "类型代码不能为空")
|
||||
private String dictTypeCode;
|
||||
|
||||
@ApiModelProperty(value = "类型名称", required = true)
|
||||
@NotBlank(message = "类型名称不能为空")
|
||||
private String dictTypeName;
|
||||
|
||||
@ApiModelProperty(value = "类型说明", required = false)
|
||||
private String remarks;
|
||||
|
||||
private String sid;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:21
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "数据字典数据项")
|
||||
public interface DictTypeFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "数据字典类型保存")
|
||||
ResultBean save(@Valid @RequestBody DictTypeDto dictTypeDto);
|
||||
|
||||
@PostMapping("/pageList")
|
||||
@ApiOperation(value = "数据字典类型分页列表")
|
||||
ResultBean<PagerVo<DictTypeVo>> pageList(@RequestBody PagerQuery<DictTypeQuery> pagerQuery);
|
||||
|
||||
@DeleteMapping("/delete/{sid}")
|
||||
@ApiOperation(value = "数据字典类型删除")
|
||||
ResultBean delete(@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:47
|
||||
* @Description
|
||||
*/
|
||||
public class DictTypeFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 17:15
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictTypeQuery implements Query {
|
||||
|
||||
@ApiModelProperty(value = "数据字典code", required = false)
|
||||
private String dictTypeCode;
|
||||
|
||||
@ApiModelProperty(value = "数据分类名称", required = false)
|
||||
private String dictTypeName;
|
||||
|
||||
@ApiModelProperty(value = "说明", required = false)
|
||||
private String remarks;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.vo.Vo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 17:16
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictTypeVo implements Vo {
|
||||
private static final long serialVersionUID = -3404457483419237424L;
|
||||
|
||||
@ApiModelProperty(value = "数据类型sid")
|
||||
private String sid;
|
||||
|
||||
@ApiModelProperty(value = "类型代码")
|
||||
private String dictTypeCode;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String dictTypeName;
|
||||
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String remarks;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.demo.system.api.sys_forum;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:27
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysForum extends BaseEntity {
|
||||
private static final long serialVersionUID = -6162657517570831690L;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
@ApiModelProperty("内容")
|
||||
private String content;
|
||||
@ApiModelProperty("类别")
|
||||
private String type;
|
||||
@ApiModelProperty("类别key")
|
||||
private String typeKey;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yxt.demo.system.api.sys_forum;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:21
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "论坛")
|
||||
public interface SysForumFeign {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_forum;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:47
|
||||
* @Description
|
||||
*/
|
||||
public class SysForumFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.demo.system.api.sys_forum_comment;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysForumComment extends BaseEntity {
|
||||
private static final long serialVersionUID = 3863241346399021803L;
|
||||
|
||||
@ApiModelProperty("论坛sid")
|
||||
private String forumSid;
|
||||
@ApiModelProperty("内容")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_forum_comment;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:22
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "论坛评论")
|
||||
public interface SysForumCommentFeign {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_forum_comment;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 15:25
|
||||
* @Description
|
||||
*/
|
||||
public class SysForumCommentFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = -6222893927885655368L;
|
||||
|
||||
@ApiModelProperty("用户sid")
|
||||
private String userSid;
|
||||
@ApiModelProperty("学号、工号")
|
||||
private String infoId;
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
@ApiModelProperty("性别")
|
||||
private String sex;
|
||||
@ApiModelProperty("性别key")
|
||||
private String sexKey;
|
||||
@ApiModelProperty("入学年份")
|
||||
private String studyYear;
|
||||
@ApiModelProperty("系别")
|
||||
private String department;
|
||||
@ApiModelProperty("专业")
|
||||
private String speciality;
|
||||
@ApiModelProperty("班级")
|
||||
private String calss;
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
private String userName;
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeQuery;
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeVo;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserDto;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:50
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "基础信息表")
|
||||
public interface SysInfoFeign {
|
||||
|
||||
@ApiOperation(value = "修改基础信息")
|
||||
@PostMapping("/alterInfo")
|
||||
ResultBean alterInfo(@RequestBody SysInfo sysInfo);
|
||||
|
||||
@ApiOperation(value = "查询基本信息")
|
||||
@RequestMapping("/selectInfo")
|
||||
ResultBean selectInfoOne(@RequestBody SysInfoPageCount sysInfoPageCount);
|
||||
|
||||
@ApiOperation(value = "删除基本信息")
|
||||
@RequestMapping("/deleteInfo")
|
||||
ResultBean deleteInfo(@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
|
||||
@ApiOperation(value = "添加基本信息")
|
||||
@RequestMapping("/saveInfo")
|
||||
ResultBean saveInfo(@RequestBody SysInfo sysInfo);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:53
|
||||
* @Description
|
||||
*/
|
||||
@Component
|
||||
public class SysInfoFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-26-15:54
|
||||
*/
|
||||
@Data
|
||||
public class SysInfoPageCount {
|
||||
@ApiModelProperty(value = "基础信息sid")
|
||||
private String sid;
|
||||
@ApiModelProperty(value = "开始条数")
|
||||
private Integer from;
|
||||
@ApiModelProperty(value = "显示条数")
|
||||
private Integer to;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yxt.demo.system.api.sys_info_ship;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysInfoShip extends BaseEntity {
|
||||
private static final long serialVersionUID = -8733034109620831216L;
|
||||
@ApiModelProperty("工号")
|
||||
private String teacherNo;
|
||||
@ApiModelProperty("教师")
|
||||
private String teacherName;
|
||||
@ApiModelProperty("学号")
|
||||
private String studentNo;
|
||||
@ApiModelProperty("学生")
|
||||
private String studentName;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysMenu extends BaseEntity {
|
||||
private static final long serialVersionUID = 1451455109001765427L;
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String name;
|
||||
@ApiModelProperty("菜单路由路径")
|
||||
private String menuUrl;
|
||||
@ApiModelProperty("菜单对应的前端页面路径")
|
||||
private String pageUrl;
|
||||
@ApiModelProperty("菜单图标地址")
|
||||
private String iconUrl;
|
||||
@ApiModelProperty("资源sid")
|
||||
private String sourceSid;
|
||||
@ApiModelProperty("是否显示:1显示,0不显示")
|
||||
private String isShow;
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNo;
|
||||
|
||||
private String pSid;
|
||||
@ApiModelProperty("前端页面路径重定向")
|
||||
private String pageUrlRedirect;
|
||||
@ApiModelProperty("前端页面名称")
|
||||
private String pageName;
|
||||
@ApiModelProperty("前端页面别名")
|
||||
private String pageAliasName;
|
||||
@ApiModelProperty("菜单类型(0左侧当行菜单1页面中的功能)")
|
||||
private String menuType;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 21:27
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuDto implements Dto {
|
||||
private static final long serialVersionUID = -3578983530779493714L;
|
||||
|
||||
private String sid;
|
||||
@ApiModelProperty("图标地址")
|
||||
private String iconUrl;
|
||||
@ApiModelProperty("是否可见:默认为1显示,0为不显示")
|
||||
private String isShow;
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String name;
|
||||
@ApiModelProperty("前端页面路径")
|
||||
private String pageUrl;
|
||||
@ApiModelProperty("上级名称")
|
||||
private String pname;
|
||||
@ApiModelProperty("父级sid")
|
||||
private String psid;
|
||||
@ApiModelProperty("排序")
|
||||
private int sortNo;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:08
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "菜单表")
|
||||
public interface SysMenuFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@ApiOperation(value = "保存修改")
|
||||
ResultBean saveOrUpdates(@RequestBody SysMenuDto dto);
|
||||
|
||||
@PostMapping(value = "/list")
|
||||
@ApiOperation(value = "列表")
|
||||
ResultBean<SysMenuVo> list(@RequestBody SysMenuQuery sysMenuQuery);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:09
|
||||
* @Description
|
||||
*/
|
||||
@Component
|
||||
public class SysMenuFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.query.Query;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 22:15
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuQuery implements Query {
|
||||
private static final long serialVersionUID = 4807896221608672228L;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.vo.Vo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 22:15
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuVo implements Vo {
|
||||
private static final long serialVersionUID = 4190346430531800875L;
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String name;
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNo;
|
||||
@ApiModelProperty("上级sid")
|
||||
private String pSid;
|
||||
@ApiModelProperty("上级菜单名称")
|
||||
private String pName;
|
||||
@ApiModelProperty("sid")
|
||||
private String sid;
|
||||
@ApiModelProperty("前端页面地址")
|
||||
private String pageUrl;
|
||||
@ApiModelProperty("图标")
|
||||
private String iconUrl;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
@ApiModelProperty("子菜单")
|
||||
private List<SysMenuVo> children;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.demo.system.api.sys_menu_role;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuRole extends BaseEntity {
|
||||
private static final long serialVersionUID = 451643872797644349L;
|
||||
|
||||
@ApiModelProperty("菜单sid")
|
||||
private String menuSid;
|
||||
@ApiModelProperty("角色sid")
|
||||
private String roleSid;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.demo.system.api.sys_notice;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysNotice extends BaseEntity {
|
||||
private static final long serialVersionUID = 1231722267699962585L;
|
||||
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
@ApiModelProperty("内容")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_notice;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:23
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "公告")
|
||||
public interface SysNoticeFeign {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_notice;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 22:42
|
||||
* @Description
|
||||
*/
|
||||
@Component
|
||||
public class SysNoticeFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.demo.system.api.sys_plan;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysPlan extends BaseEntity {
|
||||
private static final long serialVersionUID = -7482950267556936041L;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String teacherNo;
|
||||
@ApiModelProperty("学号")
|
||||
private String studentNo;
|
||||
|
||||
@ApiModelProperty("学习计划内容")
|
||||
private String planContent;
|
||||
@ApiModelProperty("反馈意见")
|
||||
private String planOpinion;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_plan;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:24
|
||||
* @Description
|
||||
*/
|
||||
public interface SysPlanFeign {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yxt.demo.system.api.sys_plan_schedule;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysPlanSchedule extends BaseEntity {
|
||||
private static final long serialVersionUID = 1774768251703010035L;
|
||||
|
||||
@ApiModelProperty("计划sid")
|
||||
private String planSid;
|
||||
@ApiModelProperty("进度内容")
|
||||
private String planContent;
|
||||
@ApiModelProperty("反馈意见")
|
||||
private String planOpinion;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_plan_schedule;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:25
|
||||
* @Description
|
||||
*/
|
||||
public interface SysPlanScheduleFeign {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yxt.demo.system.api.sys_resources;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysResources extends BaseEntity {
|
||||
private static final long serialVersionUID = 2392261901770217832L;
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String type;
|
||||
|
||||
private String typeKey;
|
||||
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_resources;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:26
|
||||
* @Description
|
||||
*/
|
||||
public interface SysResourcesFeign {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysRole extends BaseEntity {
|
||||
private static final long serialVersionUID = -1613625558809353237L;
|
||||
@ApiModelProperty("角色名称")
|
||||
private String name;
|
||||
@ApiModelProperty("排序")
|
||||
private int sort;
|
||||
@ApiModelProperty("角色类型")
|
||||
private int type;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysRoleDto implements Dto {
|
||||
private static final long serialVersionUID = 2068661415449582838L;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty("排序")
|
||||
private int sort;
|
||||
@ApiModelProperty("角色类型")
|
||||
@NotBlank(message = "角色类型不能为空")
|
||||
private int type;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:27
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "角色表")
|
||||
public interface SysRoleFeign {
|
||||
|
||||
@ApiOperation(value = "添加角色")
|
||||
@PostMapping("/addRole")
|
||||
ResultBean addRole(@RequestBody SysRole sysRole);
|
||||
|
||||
@ApiOperation(value = "删除角色")
|
||||
@PostMapping("/deleteRole/{sid}")
|
||||
ResultBean deleteRole(@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
|
||||
@ApiOperation(value = "查询角色")
|
||||
@PostMapping("/RoleOne/{sid}")
|
||||
ResultBean RoleOne(@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
|
||||
@ApiOperation(value = "查询多角色")
|
||||
@PostMapping("/RoleOne")
|
||||
ResultBean RoleList();
|
||||
|
||||
@ApiOperation(value = "修改角色")
|
||||
@RequestMapping("/alterRole")
|
||||
ResultBean alterRole(@RequestBody SysRole sysRole);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:28
|
||||
* @Description
|
||||
*/
|
||||
@Component
|
||||
public class SysRoleFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysScore extends BaseEntity {
|
||||
private static final long serialVersionUID = -1676424079241884880L;
|
||||
@ApiModelProperty("类别")
|
||||
private String type;
|
||||
@ApiModelProperty("类别Key")
|
||||
private String typeKey;
|
||||
@ApiModelProperty("成绩")
|
||||
private String score;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-25-16:07
|
||||
*/
|
||||
@Data
|
||||
public class SysScoreDto implements Dto {
|
||||
|
||||
@ApiModelProperty("类别")
|
||||
@NotBlank(message = "类别不能为空")
|
||||
private String type;
|
||||
@ApiModelProperty("类别Key")
|
||||
@NotBlank(message = "类别Key不能为空")
|
||||
private String typeKey;
|
||||
@ApiModelProperty("成绩")
|
||||
private String score;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:28
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "成绩表")
|
||||
public interface SysScoreFeign {
|
||||
|
||||
@ApiOperation(value = "查询成绩")
|
||||
@PostMapping("/save")
|
||||
ResultBean save(@RequestBody SysScoreDto sysScoreDto);
|
||||
|
||||
@ApiOperation(value = "成绩修改")
|
||||
@PostMapping("/update")
|
||||
ResultBean alterById(@RequestBody SysScore sysScore);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-25-16:10
|
||||
*/
|
||||
@Component
|
||||
public class SysScoreFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yxt.demo.system.api.sys_student_score;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysStudentScore extends BaseEntity {
|
||||
private static final long serialVersionUID = -3123378722999542918L;
|
||||
|
||||
@ApiModelProperty("类别")
|
||||
private String type;
|
||||
|
||||
private String typeKey;
|
||||
@ApiModelProperty("学号")
|
||||
private String studentNo;
|
||||
@ApiModelProperty("四级")
|
||||
private String fourScore;
|
||||
@ApiModelProperty("六级")
|
||||
private String sixScore;
|
||||
@ApiModelProperty("计算机成绩")
|
||||
private String computerScore;
|
||||
@ApiModelProperty("是否就业:1是,0否")
|
||||
private int employment;
|
||||
@ApiModelProperty("是否升学")
|
||||
private int enterSchool;
|
||||
@ApiModelProperty("是否考公通过")
|
||||
private int kaoGong;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yxt.demo.system.api.sys_student_score;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:29
|
||||
* @Description
|
||||
*/
|
||||
public interface SysStudentScoreFeign {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:29
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysUser extends BaseEntity {
|
||||
private static final long serialVersionUID = -4151693504419808527L;
|
||||
@ApiModelProperty("用户名工号")
|
||||
private String userName;
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
@ApiModelProperty("昵称")
|
||||
private String nickName;
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
@ApiModelProperty("基础信息sid")
|
||||
private String infoSid;
|
||||
@ApiModelProperty("类型:0学生、1教师、2管理员")
|
||||
private int type;
|
||||
@ApiModelProperty("是否已激活:0未激活,1已激活")
|
||||
private int hasActivated;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:28
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysUserDto{
|
||||
private static final long serialVersionUID = 2068661415449582838L;
|
||||
|
||||
@ApiModelProperty("学号")
|
||||
@NotBlank(message = "学号不能为空")
|
||||
private String userName;
|
||||
@ApiModelProperty("姓名")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty("密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
@ApiModelProperty("确认密码")
|
||||
@NotBlank(message = "确认密码不能为空")
|
||||
private String confirmPassword;
|
||||
@ApiModelProperty("昵称")
|
||||
private String nickName;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:26
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "用户表")
|
||||
public interface SysUserFeign {
|
||||
|
||||
@ApiOperation(value = "学生注册")
|
||||
@PostMapping("/register")
|
||||
ResultBean register(@RequestBody SysUserDto dto);
|
||||
|
||||
|
||||
@ApiOperation(value = "登录")
|
||||
@RequestMapping("/login")
|
||||
ResultBean login(@RequestBody SysUserLoginQuery query);
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
@RequestMapping("/alterPassword")
|
||||
ResultBean alterPassword(@RequestBody SysUser sysUser);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:28
|
||||
* @Description
|
||||
*/
|
||||
@Component
|
||||
public class SysUserFeignFallback {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import com.yxt.demo.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 13:36
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysUserLoginQuery implements Query {
|
||||
private static final long serialVersionUID = 4963834204184842445L;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String userName;
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.demo.system.api.sys_user_role;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/20 0:30
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysUserRole extends BaseEntity {
|
||||
private static final long serialVersionUID = 1275775509946006356L;
|
||||
@ApiModelProperty("用户sid")
|
||||
private String userSid;
|
||||
@ApiModelProperty("角色sid")
|
||||
private String roleSid;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.demo.system.api.sys_user_role;
|
||||
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-26-14:31
|
||||
*/
|
||||
@Api(tags = "用户角色关联表")
|
||||
public interface SysUserRoleFeign {
|
||||
|
||||
@ApiOperation(value = "给用户分配角色")
|
||||
@RequestMapping("/addUserRole")
|
||||
ResultBean addUserRole(@RequestBody SysUserRole sysUserRole);
|
||||
|
||||
@ApiOperation(value = "修改用户角色")
|
||||
@RequestMapping("/alterUserRole")
|
||||
ResultBean alterUserRole(@RequestBody SysUserRole sysUserRole);
|
||||
|
||||
@ApiOperation(value = "删除该用户角色")
|
||||
@RequestMapping("/deleteUserRoleById")
|
||||
ResultBean deleteUserRoleById(@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommon;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommonVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.yxt.demo.system.biz.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.system.api.dict_common.*;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -3,19 +3,15 @@ package com.yxt.demo.system.biz.dict_common;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.common.jdbc.service.PagerUtil;
|
||||
import com.yxt.demo.common.utils.convert.StringUtil;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.jdbc.service.PagerUtil;
|
||||
import com.yxt.demo.system.api.dict_common.*;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.biz.dict_type.DictTypeService;
|
||||
import com.yxt.demo.system.biz.sys_user.SysUserMapper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.yxt.demo.system.biz.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommon;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommonVo;
|
||||
import com.yxt.demo.system.api.dict_type.*;
|
||||
import com.yxt.demo.system.biz.dict_common.DictCommonService;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -3,19 +3,16 @@ package com.yxt.demo.system.biz.dict_type;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.common.jdbc.service.PagerUtil;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommon;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommonQuery;
|
||||
import com.yxt.demo.system.api.dict_common.DictCommonVo;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.jdbc.service.PagerUtil;
|
||||
import com.yxt.demo.system.api.dict_type.DictType;
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeDto;
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeQuery;
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeVo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.yxt.demo.system.biz.sys_forum;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:21
|
||||
* @Description
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysForumMapper {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?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="">
|
||||
<mapper namespace="com.yxt.demo.system.biz.sys_forum.SysForumMapper">
|
||||
</mapper>
|
||||
@@ -2,9 +2,13 @@ package com.yxt.demo.system.biz.sys_info;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfo;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfoPageCount;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:51
|
||||
@@ -14,4 +18,12 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface SysInfoMapper extends BaseMapper<SysInfo> {
|
||||
|
||||
SysInfo selectByNoAndName(@Param("userName") String userName, @Param("name") String name);
|
||||
|
||||
SysInfo selectStudentBySid(SysInfoPageCount sysInfoPageCount);
|
||||
|
||||
List<SysInfo> selectInfoList(SysInfoPageCount sysInfoPageCount);
|
||||
|
||||
SysInfo selectBySid(@Param("sid") String sid);
|
||||
|
||||
void deleteInfoBySid(@Param("sid") String sid);
|
||||
}
|
||||
|
||||
@@ -7,4 +7,27 @@
|
||||
where infoId = #{userName}
|
||||
and name = #{name}
|
||||
</select>
|
||||
|
||||
<select id="selectStudentBySid" resultType="com.yxt.demo.system.api.sys_info.SysInfo" parameterType="com.yxt.demo.system.api.sys_info.SysInfoPageCount">
|
||||
select i.id,i.userSid,i.infoId,u.userName,u.password,i.name,i.sex,i.studyYear,i.department,i.speciality,i.calss
|
||||
from sys_info i
|
||||
left join sys_user u
|
||||
on i.userSid = u.sid
|
||||
where i.userSid = #{sid} limit #{from},#{to}
|
||||
</select>
|
||||
|
||||
<select id="selectInfoList" resultType="com.yxt.demo.system.api.sys_info.SysInfo" parameterType="com.yxt.demo.system.api.sys_info.SysInfoPageCount">
|
||||
select i.id,i.userSid,i.infoId,u.userName,u.password,i.name,i.sex,i.studyYear,i.department,i.speciality,i.calss
|
||||
from sys_info i
|
||||
left join sys_user u
|
||||
on i.userSid = u.sid limit #{from},#{to}
|
||||
</select>
|
||||
|
||||
<select id="selectBySid" resultType="com.yxt.demo.system.api.sys_info.SysInfo">
|
||||
select * from sys_info where sid = #{sid}
|
||||
</select>
|
||||
|
||||
<delete id="deleteInfoBySid">
|
||||
delete from sys_info where sid = #{sid}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.yxt.demo.system.biz.sys_info;
|
||||
|
||||
import com.yxt.demo.system.api.sys_info.SysInfo;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfoFeign;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfoPageCount;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -12,5 +17,28 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(tags = "基础信息表")
|
||||
@RestController
|
||||
@RequestMapping("v1/sysinfo")
|
||||
public class SysInfoRest {
|
||||
public class SysInfoRest implements SysInfoFeign {
|
||||
|
||||
@Autowired
|
||||
private SysInfoService sysInfoService;
|
||||
|
||||
@Override
|
||||
public ResultBean alterInfo(SysInfo sysInfo) {
|
||||
return sysInfoService.alterInfo(sysInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean selectInfoOne(SysInfoPageCount sysInfoPageCount) {
|
||||
return sysInfoService.selectInfoOne(sysInfoPageCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean deleteInfo(String sid) {
|
||||
return sysInfoService.deleteInfoBySid(sid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean saveInfo(SysInfo sysInfo) {
|
||||
return sysInfoService.saveInfo(sysInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
package com.yxt.demo.system.biz.sys_info;
|
||||
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfoPageCount;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.biz.sys_user.SysUserMapper;
|
||||
import com.yxt.demo.system.biz.sys_user.SysUserService;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfo;
|
||||
import com.yxt.demo.system.utils.Const;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:51
|
||||
@@ -12,7 +22,68 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SysInfoService extends MybatisBaseService<SysInfoMapper, SysInfo> {
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
public SysInfo selectByNoAndName(String userName, String name) {
|
||||
return baseMapper.selectByNoAndName(userName, name);
|
||||
}
|
||||
|
||||
public ResultBean alterInfo(SysInfo sysInfo){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
sysInfo.setUpdateBySid(user.getSid());
|
||||
sysInfo.setModifyTime(new Date());
|
||||
int i = baseMapper.updateById(sysInfo);
|
||||
if (i == 0){
|
||||
return rb.setMsg("修改失败");
|
||||
}
|
||||
return rb.setMsg("修改成功");
|
||||
}
|
||||
|
||||
public ResultBean selectInfoOne(SysInfoPageCount sysInfoPageCount){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
int type = user.getType();
|
||||
if (type == 0 || type == 1){
|
||||
SysInfo sysInfo = baseMapper.selectStudentBySid(sysInfoPageCount);
|
||||
return rb.setData(sysInfo);
|
||||
}else if (type == 2){
|
||||
List<SysInfo> sysInfos = baseMapper.selectInfoList(sysInfoPageCount);
|
||||
return rb.setData(sysInfos);
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
public ResultBean deleteInfoBySid(String sid){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
if (user.getType() == 2){
|
||||
SysInfo sysInfo = baseMapper.selectBySid(sid);
|
||||
baseMapper.deleteInfoBySid(sid);
|
||||
sysUserMapper.deleteUserBySid(sysInfo.getUserSid());
|
||||
return rb.setMsg("删除成功");
|
||||
}else {
|
||||
return rb.setMsg("无权操作");
|
||||
}
|
||||
}
|
||||
|
||||
public ResultBean saveInfo(SysInfo sysInfo){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
SysUser sysUser = sysUserMapper.selectByNameAndUserName(sysInfo.getInfoId(), sysInfo.getName());
|
||||
if (sysUser != null){
|
||||
sysInfo.setUserSid(sysUser.getSid());
|
||||
baseMapper.insert(sysInfo);
|
||||
sysUser.setInfoSid(sysInfo.getSid());
|
||||
sysUser.setModifyTime(new Date());
|
||||
sysUser.setUpdateBySid(user.getSid());
|
||||
sysUserMapper.updateById(sysUser);
|
||||
return rb.success();
|
||||
}else {
|
||||
baseMapper.insert(sysInfo);
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.yxt.demo.system.biz.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuDto;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuFeign;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuQuery;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuVo;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.yxt.demo.system.biz.sys_menu;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.common.utils.convert.StringUtil;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenu;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuDto;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuQuery;
|
||||
import com.yxt.demo.system.api.sys_menu.SysMenuVo;
|
||||
import com.yxt.demo.system.biz.sys_info.SysInfoMapper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?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="">
|
||||
<mapper namespace="com.yxt.demo.system.biz.sys_plan.SysPlanMapper">
|
||||
</mapper>
|
||||
@@ -2,13 +2,18 @@ package com.yxt.demo.system.biz.sys_role;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.demo.system.api.sys_role.SysRole;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:27
|
||||
* @Description
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
SysRole selectRole(@Param("name") String name);
|
||||
SysRole selectRole(String name);
|
||||
|
||||
List<SysRole> selectRoleList();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<?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.yxt.demo.system.biz.sys_role.SysRoleMapper">
|
||||
<select id="selectRole" resultType="com.yxt.demo.system.biz.sys_role.SysRoleMapper">
|
||||
select count(*) from sys_role where name == #{name}
|
||||
<select id="selectRole" resultType="com.yxt.demo.system.api.sys_role.SysRoleDto">
|
||||
select * from sys_role where name == #{name}
|
||||
</select>
|
||||
|
||||
<select id="selectRoleList" resultType="com.yxt.demo.system.api.sys_role.SysRoleDto">
|
||||
select * from sys_role
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,28 +1,83 @@
|
||||
package com.yxt.demo.system.biz.sys_role;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_role.SysRole;
|
||||
import com.yxt.demo.system.api.sys_role.SysRoleFeign;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.api.sys_user_role.SysUserRole;
|
||||
import com.yxt.demo.system.biz.sys_user_role.SysUserRoleSerrvice;
|
||||
import com.yxt.demo.system.utils.Const;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:27
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "成绩表")
|
||||
@Api(tags = "角色表")
|
||||
@RestController
|
||||
@RequestMapping("v1/sysrole")
|
||||
public class SysRoleRest implements SysRoleFeign {
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleSerrvice sysUserRoleSerrvice;
|
||||
//
|
||||
@Override
|
||||
public ResultBean addRole(SysRole sysRole) {
|
||||
return sysRoleService.addRole(sysRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean deleteRole(String sid){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
if (user.getType() == 2){
|
||||
SysRole sysRole = sysRoleService.fetchBySid(sid);
|
||||
if (sysRole == null){
|
||||
return rb.setMsg("该角色不存在");
|
||||
}
|
||||
List<SysUserRole> sysUserRoles = sysUserRoleSerrvice.selectSysUserRole(sid);
|
||||
if (sysUserRoles.size() != 0){
|
||||
return rb.setMsg("该角色已有用户使用,不可删除");
|
||||
}
|
||||
if (0 == sysRoleService.deleteBySid(sid)){
|
||||
return rb.setMsg("删除失败");
|
||||
}
|
||||
return rb.success().setMsg("删除成功");
|
||||
}else {
|
||||
return rb.setMsg("无权操作");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean RoleOne(String sid){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
SysRole sysRole = sysRoleService.fetchBySid(sid);
|
||||
if (sysRole != null){
|
||||
return rb.setData(sysRole);
|
||||
}else {
|
||||
return rb.setData("查询角色失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean RoleList(){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
sysRoleService.selectRoleList();
|
||||
return rb.setMsg("查询角色失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean alterRole(SysRole sysRole) {
|
||||
return sysRoleService.alterRole(sysRole);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.yxt.demo.system.biz.sys_role;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_role.SysRole;
|
||||
import com.yxt.demo.system.api.sys_score.SysScore;
|
||||
import com.yxt.demo.system.api.sys_score.SysScoreDto;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_role.SysRole;
|
||||
import com.yxt.demo.system.utils.Const;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:27
|
||||
@@ -21,17 +22,45 @@ public class SysRoleService extends MybatisBaseService<SysRoleMapper, SysRole> {
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
public ResultBean addRole(SysRole sysRole) {
|
||||
public ResultBean addRole(SysRole sysRole){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
SysRole sysRole1 = sysRoleMapper.selectRole(sysRole.getName());
|
||||
if (sysRole1 != null){
|
||||
if (sysRole1 == null){
|
||||
sysRole.setCreateBySid(user.getSid());
|
||||
sysRole.setCreateTime(new Date());
|
||||
int insert = baseMapper.insert(sysRole);
|
||||
if (insert == 1){
|
||||
return rb.success().setMsg("添加成功");
|
||||
}else{
|
||||
return rb;
|
||||
return rb.setMsg("添加失败");
|
||||
}
|
||||
}
|
||||
return rb;
|
||||
return rb.setMsg("已有该角色名称请重新添加");
|
||||
}
|
||||
|
||||
public ResultBean selectRoleList(){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<SysRole> sysRoles = sysRoleMapper.selectRoleList();
|
||||
if (sysRoles.size() != 0){
|
||||
return rb.setData(sysRoles);
|
||||
}else {
|
||||
return rb.setMsg("查询多角色失败");
|
||||
}
|
||||
}
|
||||
|
||||
public ResultBean alterRole(SysRole sysRole){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
if (user.getType() == 2){
|
||||
int i = sysRoleMapper.updateById(sysRole);
|
||||
if (i == 0){
|
||||
return rb.setMsg("修改失败,请重试!!!");
|
||||
}else {
|
||||
return rb.setMsg("修改成功!");
|
||||
}
|
||||
}else {
|
||||
return rb.setMsg("无权操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.yxt.demo.system.biz.sys_score;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.demo.system.api.sys_score.SysScore;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:28
|
||||
* @Description
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysScoreMapper extends BaseMapper<SysScore> {
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.yxt.demo.system.biz.sys_score;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_score.SysScore;
|
||||
import com.yxt.demo.system.api.sys_score.SysScoreDto;
|
||||
import com.yxt.demo.system.api.sys_score.SysScoreFeign;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.yxt.demo.system.biz.sys_score;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_score.SysScore;
|
||||
import com.yxt.demo.system.api.sys_score.SysScoreDto;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yxt.demo.system.biz.sys_user;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
@@ -11,5 +12,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
SysUser selectByNo(String userName);
|
||||
SysUser selectByNo(@Param("userName") String userName);
|
||||
|
||||
void deleteUserBySid(@Param("sid") String sid);
|
||||
|
||||
SysUser selectByNameAndUserName(@Param("userName") String userName, @Param("name") String name);
|
||||
}
|
||||
|
||||
@@ -6,4 +6,12 @@
|
||||
from sys_user
|
||||
where userName = #{userName}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserBySid">
|
||||
delete from sys_user where sid = #{sid}
|
||||
</delete>
|
||||
|
||||
<select id="selectByNameAndUserName" resultType="com.yxt.demo.system.api.sys_user.SysUser">
|
||||
select * from sys_user where userName = #{userName} and name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.yxt.demo.system.biz.sys_user;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserDto;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserFeign;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserLoginQuery;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -31,4 +32,9 @@ public class SysUserRest implements SysUserFeign {
|
||||
public ResultBean login(SysUserLoginQuery query) {
|
||||
return sysUserService.login(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean alterPassword(SysUser sysUser){
|
||||
return sysUserService.alterPassword(sysUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.yxt.demo.system.biz.sys_user;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.common.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.common.redis.service.RedisService;
|
||||
import com.yxt.demo.common.utils.allutils.Encodes;
|
||||
import com.yxt.demo.common.utils.jwt.JWTUtil;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import com.yxt.demo.system.utils.jwt.JWTUtil;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfo;
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserDto;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserLoginQuery;
|
||||
import com.yxt.demo.system.biz.sys_info.SysInfoService;
|
||||
import jdk.nashorn.internal.ir.IfNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -26,7 +25,7 @@ public class SysUserService extends MybatisBaseService<SysUserMapper, SysUser> {
|
||||
@Autowired
|
||||
private SysInfoService sysInfoService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
public ResultBean register(SysUserDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
@@ -38,24 +37,36 @@ public class SysUserService extends MybatisBaseService<SysUserMapper, SysUser> {
|
||||
String userName = dto.getUserName();
|
||||
String name = dto.getName();
|
||||
SysInfo sysInfo = sysInfoService.selectByNoAndName(userName, name);
|
||||
if (sysInfo == null) {
|
||||
return rb.setMsg("学号或姓名错误");
|
||||
}
|
||||
//查看该账号是否已激活
|
||||
SysUser sysUser = baseMapper.selectByNo(userName);
|
||||
if (sysUser != null) {
|
||||
if (sysUser.getHasActivated() == 1) {
|
||||
return rb.setMsg("该账号已注册");
|
||||
if (sysInfo != null) {
|
||||
// return rb.setMsg("学号或姓名错误");
|
||||
//查看该账号是否已激活
|
||||
SysUser sysUser = baseMapper.selectByNo(userName);
|
||||
if (sysUser != null) {
|
||||
if (sysUser.getHasActivated() == 1) {
|
||||
return rb.setMsg("该账号已注册");
|
||||
}
|
||||
}
|
||||
sysUser = new SysUser();
|
||||
BeanUtil.copyProperties(dto, sysUser);
|
||||
sysUser.setPassword(dto.getPassword());
|
||||
sysUser.setInfoSid(sysInfo.getSid());
|
||||
baseMapper.insert(sysUser);
|
||||
sysInfo.setUserSid(sysUser.getSid());
|
||||
sysInfoService.updateById(sysInfo);
|
||||
return rb.success();
|
||||
}else {
|
||||
SysUser sysUser = baseMapper.selectByNo(userName);
|
||||
if (sysUser != null) {
|
||||
if (sysUser.getHasActivated() == 1) {
|
||||
return rb.setMsg("该账号已注册");
|
||||
}
|
||||
}
|
||||
sysUser = new SysUser();
|
||||
BeanUtil.copyProperties(dto, sysUser);
|
||||
sysUser.setPassword(dto.getPassword());
|
||||
baseMapper.insert(sysUser);
|
||||
return rb.success();
|
||||
}
|
||||
sysUser = new SysUser();
|
||||
BeanUtil.copyProperties(dto, sysUser);
|
||||
String md5Password = Encodes.md5(dto.getPassword());
|
||||
sysUser.setPassword(md5Password);
|
||||
baseMapper.insert(sysUser);
|
||||
sysInfo.setUserSid(sysUser.getSid());
|
||||
sysInfoService.updateById(sysInfo);
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
public ResultBean login(SysUserLoginQuery query) {
|
||||
@@ -65,8 +76,7 @@ public class SysUserService extends MybatisBaseService<SysUserMapper, SysUser> {
|
||||
if (sysUser == null) {
|
||||
return rb.setMsg("账号密码错误");
|
||||
} else {
|
||||
String md5Password = Encodes.md5(query.getPassword());
|
||||
if (!query.getPassword().equals(md5Password)) {
|
||||
if (!query.getPassword().equals(query.getPassword())) {
|
||||
return rb.setMsg("账号密码错误");
|
||||
}
|
||||
//验证是否激活状态
|
||||
@@ -74,11 +84,15 @@ public class SysUserService extends MybatisBaseService<SysUserMapper, SysUser> {
|
||||
return rb.setMsg("该账号已失效");
|
||||
}
|
||||
}
|
||||
// 生成token
|
||||
String uniqueToken = JWTUtil.create(sysUser.getSid() + "");
|
||||
// redis中缓存token
|
||||
redisService.set(uniqueToken, sysUser.getUserName(),
|
||||
USERS_REDIS_SESSION_TL_PC);
|
||||
return rb.success().setData(sysUser);
|
||||
}
|
||||
|
||||
public ResultBean alterPassword(SysUser sysUser){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
int i = sysUserMapper.updateById(sysUser);
|
||||
if (i != 0){
|
||||
return rb.setMsg("修改账号或密码成功");
|
||||
}
|
||||
return rb.setMsg("修改失败,请重试!!!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package com.yxt.demo.system.biz.sys_user_role;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.demo.system.api.sys_user_role.SysUserRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:31
|
||||
* @Description
|
||||
*/
|
||||
public interface SysUserRoleMapper {
|
||||
@Mapper
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
|
||||
List<SysUserRole> selectSysUserRole(String sid);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?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.yxt.demo.system.biz.sys_user_role.SysUserRoleMapper">
|
||||
<select id="selectSysUserRole" resultType="com.yxt.demo.system.api.sys_user_role.SysUserRole">
|
||||
select * from sys_user_role
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.yxt.demo.system.biz.sys_user_role;
|
||||
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.api.sys_user_role.SysUserRole;
|
||||
import com.yxt.demo.system.api.sys_user_role.SysUserRoleFeign;
|
||||
import com.yxt.demo.system.utils.Const;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-26-14:34
|
||||
*/
|
||||
@Api(tags = "用户角色关联表")
|
||||
@RestController
|
||||
@RequestMapping("v1/sysuser")
|
||||
public class SysUserRoleRest implements SysUserRoleFeign {
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleSerrvice sysUserRoleSerrvice;
|
||||
|
||||
@Override
|
||||
public ResultBean addUserRole(SysUserRole sysUserRole) {
|
||||
return sysUserRoleSerrvice.addUserRole(sysUserRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean alterUserRole(SysUserRole sysUserRole) {
|
||||
return sysUserRoleSerrvice.alterUserRole(sysUserRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean deleteUserRoleById(String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
SysUser user = Const.getUser();
|
||||
if (user.getType() == 2){
|
||||
int i = sysUserRoleSerrvice.deleteBySid(sid);
|
||||
if (i == 0){
|
||||
return rb.setMsg("删除失败");
|
||||
}else {
|
||||
return rb.success().setMsg("删除成功");
|
||||
}
|
||||
}else {
|
||||
return rb.setMsg("无权操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,53 @@
|
||||
package com.yxt.demo.system.biz.sys_user_role;
|
||||
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import com.yxt.demo.system.jdbc.service.MybatisBaseService;
|
||||
import com.yxt.demo.system.api.sys_user_role.SysUserRole;
|
||||
import com.yxt.demo.system.utils.Const;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:31
|
||||
* @Description
|
||||
*/
|
||||
public class SysUserRoleSerrvice {
|
||||
@Service
|
||||
public class SysUserRoleSerrvice extends MybatisBaseService<SysUserRoleMapper, SysUserRole> {
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
|
||||
public List<SysUserRole> selectSysUserRole(String sid){
|
||||
return sysUserRoleMapper.selectSysUserRole(sid);
|
||||
}
|
||||
|
||||
public ResultBean addUserRole(SysUserRole sysUserRole){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
sysUserRole.setCreateBySid(user.getSid());
|
||||
int insert = sysUserRoleMapper.insert(sysUserRole);
|
||||
if (insert == 0){
|
||||
return rb.setMsg("新增失败");
|
||||
}
|
||||
return rb.setSuccess(true).setMsg("新增成功");
|
||||
}
|
||||
|
||||
public ResultBean alterUserRole(SysUserRole sysUserRole){
|
||||
SysUser user = Const.getUser();
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
sysUserRole.setUpdateBySid(user.getSid());
|
||||
sysUserRole.setModifyTime(new Date());
|
||||
int i = sysUserRoleMapper.updateById(sysUserRole);
|
||||
if (i == 0){
|
||||
return rb.setMsg("修改失败");
|
||||
}else {
|
||||
return rb.setMsg("修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.yxt.demo.system.config;
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
@@ -32,4 +34,19 @@ public class Swagger2Config {
|
||||
return new ApiInfoBuilder().title("demo/系统管理").description("系统管理接口").version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods("GET","POST","PUT","OPTIONS","DELETE","PATCH")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yxt.demo.system.jdbc.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/9/4 0:40
|
||||
* @description
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor paginationInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.demo.system.jdbc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MybatisBaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {
|
||||
|
||||
|
||||
public T fetchBySid(String sid) {
|
||||
QueryWrapper<T> qw = new QueryWrapper<>();
|
||||
qw.eq("sid", sid);
|
||||
return baseMapper.selectOne(qw);
|
||||
}
|
||||
|
||||
public int deleteBySid(String sid) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sid", sid);
|
||||
return baseMapper.deleteByMap(map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yxt.demo.system.jdbc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yxt.demo.common.core.query.PagerQuery;
|
||||
import com.yxt.demo.common.core.vo.PagerVo;
|
||||
import com.yxt.demo.common.core.vo.Vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: PagerUtil.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.base.utils.PagerUtil <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/22 上午9:35 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class PagerUtil {
|
||||
|
||||
public static <T> IPage<T> queryToPage(PagerQuery pq) {
|
||||
IPage<T> page = new Page<>();
|
||||
page.setSize(pq.getSize()).setCurrent(pq.getCurrent());
|
||||
return page;
|
||||
}
|
||||
|
||||
public static <V, T> PagerVo<V> pageToVo(IPage pr, PagerVo<V> pv) {
|
||||
if (pv == null) {
|
||||
pv = new PagerVo<V>();
|
||||
}
|
||||
pv.setCurrent(pr.getCurrent()).setSize(pr.getSize())
|
||||
.setTotal(pr.getTotal()).setPages(pr.getPages())
|
||||
.setRecords(pr.getRecords());
|
||||
return pv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换pagerVo
|
||||
*
|
||||
* @param soure
|
||||
* @return
|
||||
*/
|
||||
public static <S extends Vo, T extends Vo> PagerVo<T> switchPagerVo(
|
||||
PagerVo<S> soure) {
|
||||
if (soure == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PagerVo<T> target = new PagerVo<>();
|
||||
target.setCurrent(soure.getCurrent()).setPages(soure.getPages())
|
||||
.setSize(soure.getSize()).setTotal(soure.getTotal());
|
||||
target.setRecords(new ArrayList<T>());
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.yxt.demo.system.utils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/9/3 16:06
|
||||
* @description
|
||||
*/
|
||||
public class BaseEntity extends Entity {
|
||||
|
||||
@ApiModelProperty("字符型编号")
|
||||
private String sid = UUID.randomUUID().toString();
|
||||
|
||||
@ApiModelProperty("记录版本,锁")
|
||||
private Integer lockVersion = 0;
|
||||
|
||||
@ApiModelProperty("记录创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime = new Date();
|
||||
|
||||
@ApiModelProperty("记录最后修改时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date modifyTime = new Date();
|
||||
|
||||
@ApiModelProperty("记录状态值")
|
||||
private Integer state = 0;
|
||||
|
||||
@ApiModelProperty("记录是否可用,0:可用(默认),1:不可用")
|
||||
private Integer isEnable = 0;
|
||||
|
||||
@ApiModelProperty("记录是否被删除,0:未删除(默认),1:已经删除")
|
||||
private Integer isDelete = 0;
|
||||
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remarks;
|
||||
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBySid;
|
||||
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBySid;
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public Integer getLockVersion() {
|
||||
return lockVersion;
|
||||
}
|
||||
|
||||
public void setLockVersion(Integer lockVersion) {
|
||||
this.lockVersion = lockVersion;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Integer getIsEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
public void setIsEnable(Integer isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getCreateBySid() {
|
||||
return createBySid;
|
||||
}
|
||||
|
||||
public void setCreateBySid(String createBySid) {
|
||||
this.createBySid = createBySid;
|
||||
}
|
||||
|
||||
public String getUpdateBySid() {
|
||||
return updateBySid;
|
||||
}
|
||||
|
||||
public void setUpdateBySid(String updateBySid) {
|
||||
this.updateBySid = updateBySid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.yxt.demo.system.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2022/2/9 21:52
|
||||
* @Description 工具类
|
||||
*/
|
||||
public class BeanUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 获取String 类型
|
||||
*
|
||||
* @param map
|
||||
* @param keyName 键值对中键名称
|
||||
* @param defaultValue 默认值
|
||||
* @return
|
||||
*/
|
||||
public static String getString(Map<String, Object> map, String keyName, String defaultValue) {
|
||||
if (map == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (map.containsKey(keyName)) {
|
||||
Object o = map.get(keyName);
|
||||
if (o instanceof String) {
|
||||
return (String) o;
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取Integer
|
||||
public static Integer getInteger(Map<String, Object> map, String keyName) {
|
||||
if (map == null) {
|
||||
return -1;
|
||||
}
|
||||
if (map.containsKey(keyName)) {
|
||||
Object o = map.get(keyName);
|
||||
if (o instanceof Integer) {
|
||||
return (int) o;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//获取map类型
|
||||
public static Map<String, Object> getMap(Map<String, Object> map, String keyName) {
|
||||
if (map == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
if (map.containsKey(keyName)) {
|
||||
Object o = map.get(keyName);
|
||||
if (o instanceof Map) {
|
||||
return (Map) o;
|
||||
} else {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
} else {
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取List类型
|
||||
public static List<Map<String, Object>> getListData(Map<String, Object> map, String keyName) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (map == null) {
|
||||
return list;
|
||||
}
|
||||
if (map.containsKey(keyName)) {
|
||||
Object o = map.get(keyName);
|
||||
if (o instanceof List) {
|
||||
for (int i = 0; i < ((List) o).size(); i++) {
|
||||
Object o1 = ((List) o).get(i);
|
||||
if (o1 instanceof Map) {
|
||||
list.add((Map) o1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.demo.system.utils;
|
||||
|
||||
import com.yxt.demo.system.api.sys_user.SysUser;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
/**
|
||||
* @author shkstart
|
||||
* @create 2023-04-26-14:42
|
||||
*/
|
||||
public class Const{
|
||||
public static final long EXPIRATION_TIME = 3600 * 24 * 7; // 以秒计
|
||||
public static final String SECRET = "sinsinsinsinsinsinnetnetnetnetnetnet"; // JWT密码
|
||||
public static final String TOKEN_PREFIX = "Bearer"; // Token前缀
|
||||
public static final String HEADER_STRING = "Authorization"; // 存放Token的Header Key
|
||||
public static final String AUTHORITY = "admin"; //管理员
|
||||
|
||||
|
||||
public static SysUser getUser(){
|
||||
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
if(principal instanceof SysUser){
|
||||
return (SysUser)principal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yxt.demo.system.utils;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/9/3 16:06
|
||||
* @description
|
||||
*/
|
||||
public class Entity implements Serializable {
|
||||
|
||||
@ApiModelProperty("ID,唯一编号")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("ID值的字符串形式")
|
||||
public String getIdStr() {
|
||||
if (null == id) {
|
||||
return "";
|
||||
}
|
||||
return "" + id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClassName:" + getClass().getName() + ";id:" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int id2 = Long.hashCode(getId());
|
||||
return super.hashCode() + id2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Entity)) {
|
||||
return false;
|
||||
}
|
||||
Entity entity = (Entity) obj;
|
||||
return this.getId().equals(entity.getId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.yxt.demo.system.utils;
|
||||
|
||||
import com.yxt.demo.system.utils.constant.Constants;
|
||||
import com.yxt.demo.system.utils.constant.StatusEnum;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2021/8/23 16:42
|
||||
* @Description 返回结果
|
||||
*/
|
||||
public class ResultBean<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int FAIL = Constants.FAIL;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
private Boolean success;
|
||||
|
||||
public ResultBean() {
|
||||
}
|
||||
|
||||
public ResultBean(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public ResultBean(boolean success, String msg) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ResultBean(boolean success, String msg, int code) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ResultBean(T data) {
|
||||
this.success = true;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBean(int code, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBean(int code, String msg, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public ResultBean<T> setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public ResultBean<T> setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public ResultBean<T> setCode(int code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public ResultBean<T> setData(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.类实例化的非静态方法调用 2.类不实例化的静态方法调用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ResultBean<T> success() {
|
||||
this.setSuccess(true);
|
||||
this.setCode(StatusEnum.SUCCESS.getCode());
|
||||
this.setMsg("操作成功!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean<T> fail() {
|
||||
this.setSuccess(false);
|
||||
this.setCode(StatusEnum.FAIL.getCode());
|
||||
this.setMsg("操作失败!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public static <T> ResultBean<T> fireSuccess() {
|
||||
ResultBean<T> rb = new ResultBean<T>();
|
||||
rb.setSuccess(true);
|
||||
rb.setCode(StatusEnum.SUCCESS.getCode());
|
||||
rb.setMsg("操作成功!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
public static <T> ResultBean<T> fireFail() {
|
||||
ResultBean<T> rb = new ResultBean<T>();
|
||||
rb.setSuccess(false);
|
||||
rb.setCode(StatusEnum.FAIL.getCode());
|
||||
rb.setMsg("操作失败!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
//package com.yxt.demo.system.utils.allutils;
|
||||
//
|
||||
//import org.apache.commons.lang3.StringEscapeUtils;
|
||||
//import org.apache.tomcat.util.codec.binary.Base64;
|
||||
//
|
||||
//import java.io.UnsupportedEncodingException;
|
||||
//import java.net.URLDecoder;
|
||||
//import java.net.URLEncoder;
|
||||
//import java.security.MessageDigest;
|
||||
//import java.security.NoSuchAlgorithmException;
|
||||
//
|
||||
///**
|
||||
// * 封装各种格式的编码解码工具类. 1.Commons-Codec的 hex/base64 编码 2.自制的base62 编码
|
||||
// * 3.Commons-Lang的xml/html escape 4.JDK提供的URLEncoder
|
||||
// *
|
||||
// * @author dimengzhe
|
||||
// * @date 2020/9/11 13:38
|
||||
// * @description 编码解码工具类
|
||||
// */
|
||||
//
|
||||
//public class Encodes {
|
||||
//
|
||||
// private static final String DEFAULT_URL_ENCODING = "UTF-8";
|
||||
// private static final char[] BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
// private static final String SALT = "jlzx@yxt?";
|
||||
//
|
||||
// /**
|
||||
// * Hex编码.
|
||||
// */
|
||||
// public static String encodeHex(byte[] input) {
|
||||
// return new String(Hex.encodeHex(input));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Hex解码.
|
||||
// */
|
||||
// public static byte[] decodeHex(String input) {
|
||||
// try {
|
||||
// return Hex.decodeHex(input.toCharArray());
|
||||
// } catch (DecoderException e) {
|
||||
// throw Exceptions.unchecked(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Base64编码.
|
||||
// */
|
||||
// public static String encodeBase64(byte[] input) {
|
||||
// return new String(Base64.encodeBase64(input));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Base64编码.
|
||||
// */
|
||||
// public static String encodeBase64(String input) {
|
||||
// try {
|
||||
// return new String(Base64.encodeBase64(input.getBytes(DEFAULT_URL_ENCODING)));
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Base64解码.
|
||||
// */
|
||||
// public static byte[] decodeBase64(String input) {
|
||||
// return Base64.decodeBase64(input.getBytes());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Base64解码.
|
||||
// */
|
||||
// public static String decodeBase64String(String input) {
|
||||
// try {
|
||||
// return new String(Base64.decodeBase64(input.getBytes()), DEFAULT_URL_ENCODING);
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Base62编码。
|
||||
// */
|
||||
// public static String encodeBase62(byte[] input) {
|
||||
// char[] chars = new char[input.length];
|
||||
// for (int i = 0; i < input.length; i++) {
|
||||
// chars[i] = BASE62[((input[i] & 0xFF) % BASE62.length)];
|
||||
// }
|
||||
// return new String(chars);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Html 转码.
|
||||
// */
|
||||
// public static String escapeHtml(String html) {
|
||||
// return StringEscapeUtils.escapeHtml4(html);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Html 解码.
|
||||
// */
|
||||
// public static String unescapeHtml(String htmlEscaped) {
|
||||
// return StringEscapeUtils.unescapeHtml4(htmlEscaped);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Xml 转码.
|
||||
// */
|
||||
// public static String escapeXml(String xml) {
|
||||
// return StringEscapeUtils.escapeXml10(xml);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Xml 解码.
|
||||
// */
|
||||
// public static String unescapeXml(String xmlEscaped) {
|
||||
// return StringEscapeUtils.unescapeXml(xmlEscaped);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * URL 编码, Encode默认为UTF-8.
|
||||
// */
|
||||
// public static String urlEncode(String part) {
|
||||
// try {
|
||||
// return URLEncoder.encode(part, DEFAULT_URL_ENCODING);
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// throw Exceptions.unchecked(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * URL 解码, Encode默认为UTF-8.
|
||||
// */
|
||||
// public static String urlDecode(String part) {
|
||||
//
|
||||
// try {
|
||||
// return URLDecoder.decode(part, DEFAULT_URL_ENCODING);
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// throw Exceptions.unchecked(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static String digest(String algorithm, byte[] bytes, byte[] salt, int iterations) {
|
||||
// try {
|
||||
// MessageDigest md = MessageDigest.getInstance(algorithm);
|
||||
// if (salt != null) {
|
||||
// md.update(salt);
|
||||
// }
|
||||
// byte[] hashBytes = md.digest(bytes);
|
||||
// for (int i = 1; i < iterations; i++) {
|
||||
// md.reset();
|
||||
// hashBytes = md.digest(hashBytes);
|
||||
// }
|
||||
// return fixedHexString(hashBytes);
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw Exceptions.unchecked(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static String fixedHexString(byte[] hashBytes) {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// for (int i = 0; i < hashBytes.length; i++) {
|
||||
// sb.append(Integer.toString((hashBytes[i] & 0xFF) + 256, 16).substring(1));
|
||||
// }
|
||||
//
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.yxt.demo.system.utils.allutils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/**
|
||||
* 关于异常的工具类.
|
||||
*
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/11 13:44
|
||||
* @description
|
||||
*/
|
||||
|
||||
public class Exceptions {
|
||||
|
||||
/**
|
||||
* 将CheckedException转换为UncheckedException.
|
||||
*/
|
||||
public static RuntimeException unchecked(Throwable e) {
|
||||
if ((e instanceof RuntimeException)) {
|
||||
return (RuntimeException) e;
|
||||
}
|
||||
if ((e instanceof InvocationTargetException)) {
|
||||
return unchecked(((InvocationTargetException) e).getTargetException());
|
||||
}
|
||||
return new RuntimeException(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将ErrorStack转化为String.
|
||||
*/
|
||||
public static String getStackTraceAsString(Throwable e) {
|
||||
if (e == null) {
|
||||
return "";
|
||||
}
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(stringWriter));
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断异常是否由某些底层的异常引起.
|
||||
*/
|
||||
public static boolean isCausedBy(Exception ex, Class<? extends Exception>... causeExceptionClasses) {
|
||||
Throwable cause = ex.getCause();
|
||||
while (cause != null) {
|
||||
for (Class<? extends Exception> causeClass : causeExceptionClasses) {
|
||||
if (causeClass.isInstance(cause)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cause = cause.getCause();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在request中获取异常类
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static Throwable getThrowable(HttpServletRequest request) {
|
||||
Throwable ex = null;
|
||||
if (request.getAttribute("exception") != null) {
|
||||
ex = (Throwable) request.getAttribute("exception");
|
||||
} else if (request.getAttribute("javax.servlet.error.exception") != null) {
|
||||
ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
|
||||
}
|
||||
return ex;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yxt.demo.system.utils.allutils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2022/7/23 23:59
|
||||
* @Description
|
||||
*/
|
||||
@Slf4j
|
||||
public class RegexpUtils {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user