版本修改 4-26 todo
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
package com.yxt.demo.system.api.sys_forum;
|
||||
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeFeignFallback;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:21
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "论坛")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysForum",
|
||||
name = "demo-system",
|
||||
path = "v1/sysforum",
|
||||
fallback = SysForumFeignFallback.class)
|
||||
public interface SysForumFeign {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.yxt.demo.system.api.sys_forum_comment;
|
||||
|
||||
import com.yxt.demo.system.api.sys_forum.SysForumFeignFallback;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:22
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "论坛评论")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysForumComment",
|
||||
name = "demo-system",
|
||||
path = "v1/SysForumComment",
|
||||
fallback = SysForumCommentFeignFallback.class)
|
||||
public interface SysForumCommentFeign {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import com.yxt.demo.system.api.sys_user.SysUserFeignFallback;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 11:50
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "基础信息")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysInfo",
|
||||
name = "demo-system",
|
||||
path = "v1/sysinfo",
|
||||
fallback = SysInfoFeignFallback.class)
|
||||
public interface SysInfoFeign {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.yxt.demo.system.api.sys_notice;
|
||||
|
||||
import com.yxt.demo.system.api.dict_type.DictTypeFeignFallback;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:23
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "公告")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysNotice",
|
||||
name = "demo-system",
|
||||
path = "v1/SysNotice",
|
||||
fallback = SysNoticeFeignFallback.class)
|
||||
public interface SysNoticeFeign {
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserDto;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserFeignFallback;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
* @Date 2023/4/24 14:27
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "角色表")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysRole",
|
||||
name = "demo-system",
|
||||
path = "v1/sysrole",
|
||||
fallback = SysRoleFeignFallback.class)
|
||||
public interface SysRoleFeign {
|
||||
|
||||
@ApiOperation(value = "添加角色")
|
||||
@PostMapping("/addRole")
|
||||
ResultBean addRole(@RequestBody SysRole sysRole);
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.yxt.demo.system.api.dict_common;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,7 +11,7 @@ import javax.validation.constraints.NotBlank;
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class DictCommonDto implements Dto {
|
||||
public class DictCommonDto{
|
||||
|
||||
private String sid;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.yxt.demo.system.api.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.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -18,11 +17,6 @@ import java.util.List;
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "数据字典数据项")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-DictCommon",
|
||||
name = "demo-system",
|
||||
path = "v1/DictCommon",
|
||||
fallback = DictCommonFeignFallback.class)
|
||||
public interface DictCommonFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.dict_type;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.yxt.demo.system.api.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.DictCommonFeignFallback;
|
||||
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.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -18,11 +16,6 @@ import javax.validation.Valid;
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "数据字典数据项")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-DictType",
|
||||
name = "demo-system",
|
||||
path = "v1/DictType",
|
||||
fallback = DictTypeFeignFallback.class)
|
||||
public interface DictTypeFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_forum;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_forum_comment;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_info;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -31,4 +31,9 @@ public class SysInfo extends BaseEntity {
|
||||
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,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;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_info_ship;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.yxt.demo.system.api.sys_menu;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_info.SysInfoFeignFallback;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
@@ -15,11 +12,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "菜单表")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysMenu",
|
||||
name = "demo-system",
|
||||
path = "v1/SysMenu",
|
||||
fallback = SysMenuFeignFallback.class)
|
||||
public interface SysMenuFeign {
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_menu_role;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_notice;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_plan;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_plan_schedule;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_resources;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_role;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.yxt.demo.system.api.sys_score;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserDto;
|
||||
import com.yxt.demo.system.api.sys_user.SysUserFeignFallback;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@@ -14,12 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
* @Date 2023/4/24 14:28
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "用户表")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysScore",
|
||||
name = "demo-system",
|
||||
path = "v1/sysscore",
|
||||
fallback = SysScoreFeignFallback.class)
|
||||
@Api(tags = "成绩表")
|
||||
public interface SysScoreFeign {
|
||||
|
||||
@ApiOperation(value = "查询成绩")
|
||||
@@ -29,4 +21,5 @@ public interface SysScoreFeign {
|
||||
@ApiOperation(value = "成绩修改")
|
||||
@PostMapping("/update")
|
||||
ResultBean alterById(@RequestBody SysScore sysScore);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_student_score;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import com.yxt.demo.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,7 +11,7 @@ import javax.validation.constraints.NotBlank;
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class SysUserDto implements Dto {
|
||||
public class SysUserDto{
|
||||
private static final long serialVersionUID = 2068661415449582838L;
|
||||
|
||||
@ApiModelProperty("学号")
|
||||
@@ -27,9 +26,6 @@ public class SysUserDto implements Dto {
|
||||
@ApiModelProperty("确认密码")
|
||||
@NotBlank(message = "确认密码不能为空")
|
||||
private String confirmPassword;
|
||||
@ApiModelProperty("手机号")
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
|
||||
@ApiModelProperty("昵称")
|
||||
private String nickName;
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.yxt.demo.system.api.sys_user;
|
||||
|
||||
import com.yxt.demo.common.core.result.ResultBean;
|
||||
import com.yxt.demo.system.utils.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @Author dimengzhe
|
||||
@@ -14,11 +13,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
* @Description
|
||||
*/
|
||||
@Api(tags = "用户表")
|
||||
@FeignClient(
|
||||
contextId = "demo-system-SysUser",
|
||||
name = "demo-system",
|
||||
path = "v1/sysuser",
|
||||
fallback = SysUserFeignFallback.class)
|
||||
public interface SysUserFeign {
|
||||
|
||||
@ApiOperation(value = "学生注册")
|
||||
@@ -27,8 +21,10 @@ public interface SysUserFeign {
|
||||
|
||||
|
||||
@ApiOperation(value = "登录")
|
||||
@PostMapping("/login")
|
||||
@RequestMapping("/login")
|
||||
ResultBean login(@RequestBody SysUserLoginQuery query);
|
||||
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
@RequestMapping("/alterPassword")
|
||||
ResultBean alterPassword(@RequestBody SysUser sysUser);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yxt.demo.system.api.sys_user_role;
|
||||
|
||||
import com.yxt.demo.common.core.domain.BaseEntity;
|
||||
import com.yxt.demo.system.utils.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user