parent
cd112003e9
commit
d35a24e6db
@ -0,0 +1,41 @@ |
||||
package edu.ncst.award.common.annotation; |
||||
|
||||
import edu.ncst.award.common.annotation.enums.BusinessType; |
||||
import edu.ncst.award.common.annotation.enums.OperatorType; |
||||
|
||||
import java.lang.annotation.*; |
||||
|
||||
/** |
||||
* 自定义操作日志记录注解 |
||||
* |
||||
* @author ruoyi |
||||
*/ |
||||
@Target({ElementType.PARAMETER, ElementType.METHOD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
public @interface Log { |
||||
/** |
||||
* 模块 |
||||
*/ |
||||
String title() default ""; |
||||
|
||||
/** |
||||
* 功能 |
||||
*/ |
||||
BusinessType businessType() default BusinessType.OTHER; |
||||
|
||||
/** |
||||
* 操作人类别 |
||||
*/ |
||||
OperatorType operatorType() default OperatorType.MANAGE; |
||||
|
||||
/** |
||||
* 是否保存请求的参数 |
||||
*/ |
||||
boolean isSaveRequestData() default true; |
||||
|
||||
/** |
||||
* 是否保存响应的参数 |
||||
*/ |
||||
boolean isSaveResponseData() default true; |
||||
} |
||||
@ -0,0 +1,58 @@ |
||||
package edu.ncst.award.common.annotation.enums; |
||||
|
||||
/** |
||||
* 业务操作类型 |
||||
* |
||||
* @author ruoyi |
||||
*/ |
||||
public enum BusinessType { |
||||
/** |
||||
* 其它 |
||||
*/ |
||||
OTHER, |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
INSERT, |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
UPDATE, |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
DELETE, |
||||
|
||||
/** |
||||
* 授权 |
||||
*/ |
||||
GRANT, |
||||
|
||||
/** |
||||
* 导出 |
||||
*/ |
||||
EXPORT, |
||||
|
||||
/** |
||||
* 导入 |
||||
*/ |
||||
IMPORT, |
||||
|
||||
/** |
||||
* 强退 |
||||
*/ |
||||
FORCE, |
||||
|
||||
/** |
||||
* 生成代码 |
||||
*/ |
||||
GENCODE, |
||||
|
||||
/** |
||||
* 清空数据 |
||||
*/ |
||||
CLEAN, |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
package edu.ncst.award.common.annotation.enums; |
||||
|
||||
/** |
||||
* 操作人类别 |
||||
* |
||||
* @author ruoyi |
||||
*/ |
||||
public enum OperatorType { |
||||
/** |
||||
* 其它 |
||||
*/ |
||||
OTHER, |
||||
|
||||
/** |
||||
* 后台用户 |
||||
*/ |
||||
MANAGE, |
||||
|
||||
/** |
||||
* 手机端用户 |
||||
*/ |
||||
MOBILE |
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
package edu.ncst.award.common.util.treeUtils; |
||||
|
||||
import cn.hutool.core.util.ObjectUtil; |
||||
|
||||
public class TreeNodeConfig { |
||||
|
||||
// 默认属性的单例对象
|
||||
private static final TreeNodeConfig DEFAULT_CONFIG = new TreeNodeConfig(); |
||||
|
||||
// 树节点默认常量属性
|
||||
static final String TREE_ID = "id"; |
||||
static final String TREE_NAME = "name"; |
||||
static final String TREE_CODE = "code"; |
||||
static final String TREE_CHILDREN = "children"; |
||||
static final String TREE_PARENT_ID = "parentId"; |
||||
|
||||
// 属性
|
||||
private String idKey; |
||||
private String codeKey; |
||||
private String nameKey; |
||||
private String childrenKey; |
||||
private String parentIdKey; |
||||
|
||||
public String getIdKey() { |
||||
return getOrDefault(idKey, TREE_ID); |
||||
} |
||||
|
||||
public void setIdKey(String idKey) { |
||||
this.idKey = idKey; |
||||
} |
||||
|
||||
public String getCodeKey() { |
||||
return getOrDefault(codeKey, TREE_CODE); |
||||
} |
||||
|
||||
public void setCodeKey(String codeKey) { |
||||
this.codeKey = codeKey; |
||||
} |
||||
|
||||
public String getNameKey() { |
||||
return getOrDefault(nameKey, TREE_NAME); |
||||
} |
||||
|
||||
public void setNameKey(String nameKey) { |
||||
this.nameKey = nameKey; |
||||
} |
||||
|
||||
public String getChildrenKey() { |
||||
return getOrDefault(childrenKey, TREE_CHILDREN); |
||||
} |
||||
|
||||
public void setChildrenKey(String childrenKey) { |
||||
this.childrenKey = childrenKey; |
||||
} |
||||
|
||||
public String getParentIdKey() { |
||||
return getOrDefault(parentIdKey, TREE_PARENT_ID); |
||||
} |
||||
|
||||
public void setParentIdKey(String parentIdKey) { |
||||
this.parentIdKey = parentIdKey; |
||||
} |
||||
|
||||
public <T> T getOrDefault(T key, T defaultKey) { |
||||
if (ObjectUtil.isNull(key)) { |
||||
return defaultKey; |
||||
} |
||||
return key; |
||||
} |
||||
|
||||
public static TreeNodeConfig getDefaultConfig(){ |
||||
return DEFAULT_CONFIG; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,65 @@ |
||||
package edu.ncst.award.common.util.treeUtils; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 泛型还没玩明白 |
||||
* 只能这样了 |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
public class TreeNodeMap extends HashMap<String,Object> { |
||||
|
||||
private final TreeNodeConfig treeNodeConfig; |
||||
|
||||
public TreeNodeMap(){ |
||||
this.treeNodeConfig = TreeNodeConfig.getDefaultConfig(); |
||||
} |
||||
|
||||
public TreeNodeMap(TreeNodeConfig treeNodeConfig){ |
||||
this.treeNodeConfig = treeNodeConfig; |
||||
} |
||||
|
||||
public <T> T getId() { return (T)super.get(treeNodeConfig.getIdKey()); } |
||||
|
||||
public void setId(Integer id) { |
||||
super.put(treeNodeConfig.getIdKey(), id); |
||||
} |
||||
|
||||
public <T> T getParentId() { |
||||
return (T)super.get(treeNodeConfig.getParentIdKey()); |
||||
} |
||||
|
||||
public void setParentId(Integer parentId) { |
||||
super.put(treeNodeConfig.getParentIdKey(), parentId); |
||||
} |
||||
|
||||
public <T> T getName() { |
||||
return (T)super.get(treeNodeConfig.getNameKey()); |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
super.put(treeNodeConfig.getNameKey(), name); |
||||
} |
||||
|
||||
public <T> T getCode() { |
||||
return (T)super.get(treeNodeConfig.getCodeKey()); |
||||
} |
||||
|
||||
public TreeNodeMap setCode(String code) { |
||||
super.put(treeNodeConfig.getCodeKey(), code); |
||||
return this; |
||||
} |
||||
|
||||
public List<TreeNodeMap> getChildren() { |
||||
return (List<TreeNodeMap>)super.get(treeNodeConfig.getChildrenKey()); |
||||
} |
||||
|
||||
public void setChildren(List<TreeNodeMap> children) { |
||||
super.put(treeNodeConfig.getChildrenKey(),children); |
||||
} |
||||
|
||||
public void extra(String key,Object value){ |
||||
super.put(key,value); |
||||
} |
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.config; |
||||
package edu.ncst.award.config.security; |
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
@ -1,13 +1,11 @@ |
||||
package edu.ncst.award.config; |
||||
package edu.ncst.award.config.security; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder; |
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||
import org.springframework.security.crypto.password.DelegatingPasswordEncoder; |
||||
import org.springframework.security.crypto.password.PasswordEncoder; |
||||
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder; |
||||
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
@ -0,0 +1,43 @@ |
||||
package edu.ncst.award.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
import springfox.documentation.builders.ApiInfoBuilder; |
||||
import springfox.documentation.builders.PathSelectors; |
||||
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
import springfox.documentation.oas.annotations.EnableOpenApi; |
||||
import springfox.documentation.service.ApiInfo; |
||||
import springfox.documentation.service.Contact; |
||||
import springfox.documentation.spi.DocumentationType; |
||||
import springfox.documentation.spring.web.plugins.Docket; |
||||
|
||||
@EnableOpenApi |
||||
@Configuration |
||||
public class swaggerConfig implements WebMvcConfigurer { |
||||
|
||||
@Bean |
||||
public Docket createRestApi() { |
||||
//返回文档摘要信息
|
||||
return new Docket(DocumentationType.OAS_30) |
||||
.apiInfo(apiInfo()) |
||||
.select() |
||||
//.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
//配合@EnableOpenApi 找到API位置,不需要再在启动类上配置
|
||||
.apis(RequestHandlerSelectors.basePackage("edu.ncst.award.controller")) |
||||
.paths(PathSelectors.any()) |
||||
.build(); |
||||
|
||||
} |
||||
|
||||
//生成接口信息,包括标题、联系人等
|
||||
private ApiInfo apiInfo() { |
||||
return new ApiInfoBuilder() |
||||
.title("Swagger3接口文档") |
||||
.description("Rabbit用Swagger3.0。") |
||||
.contact(new Contact("Rabbit", "https://swagger.io/", "362250024@qq.com")) |
||||
.version("1.0") |
||||
.build(); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,86 @@ |
||||
package edu.ncst.award.controller; |
||||
|
||||
|
||||
import edu.ncst.award.config.security.CustomUserCache; |
||||
import edu.ncst.award.domain.vo.R; |
||||
import edu.ncst.award.domain.vo.RouterVo; |
||||
import edu.ncst.award.domain.vo.result.UserInfoVO; |
||||
import edu.ncst.award.model.system.Menu; |
||||
import edu.ncst.award.model.system.User; |
||||
import edu.ncst.award.service.impl.system.MenuServiceImpl; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.security.core.context.SecurityContextHolder; |
||||
import org.springframework.security.core.userdetails.UserDetails; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.PathVariable; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.Cookie; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
|
||||
@Api(tags = "登录信息管理") |
||||
@RestController |
||||
@RequestMapping("/api") |
||||
@Slf4j |
||||
public class LoginController { |
||||
|
||||
@Resource |
||||
MenuServiceImpl menuService; |
||||
|
||||
@Resource |
||||
CustomUserCache userCache; |
||||
|
||||
|
||||
@ApiOperation("注销登录") |
||||
@GetMapping("/logout") |
||||
public R<?> logout(HttpServletRequest request, HttpServletResponse response) { |
||||
Cookie[] cookies = request.getCookies(); |
||||
|
||||
if (cookies != null) { |
||||
for (Cookie cookie : cookies) { |
||||
cookie.setValue(""); |
||||
cookie.setPath("/api"); |
||||
cookie.setMaxAge(0); |
||||
response.addCookie(cookie); |
||||
} |
||||
} |
||||
|
||||
return R.ok("注销成功", null); |
||||
} |
||||
|
||||
/** |
||||
* 获取路由信息 |
||||
* |
||||
* @return 路由信息 |
||||
*/ |
||||
@ApiOperation("获取路由信息") |
||||
@GetMapping("/getRouters/{userId}") |
||||
public R<List<RouterVo>> getRouters(@PathVariable Integer userId) { |
||||
if (userId == null) { |
||||
log.error("用户id不能为空"); |
||||
} |
||||
List<Menu> menus = menuService.selectMenuTreeByUserId(userId); |
||||
return R.ok(menuService.buildMenus(menus)); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户 |
||||
* |
||||
* @return 当前用户信息 |
||||
*/ |
||||
@ApiOperation("获取当前用户信息") |
||||
@GetMapping("/getCurrentUser") |
||||
public UserDetails getRouters() { |
||||
UserInfoVO userInfoVO = (UserInfoVO) SecurityContextHolder.getContext().getAuthentication().getDetails(); |
||||
User currentUser = (User) userCache.getUserFromCache(userInfoVO.getUsername()); |
||||
currentUser.setPassword(null); |
||||
return currentUser; |
||||
} |
||||
|
||||
} |
||||
@ -1,38 +0,0 @@ |
||||
package edu.ncst.award.controller; |
||||
|
||||
|
||||
import edu.ncst.award.model.project.Project; |
||||
import edu.ncst.award.service.impl.project.ProjectServiceImpl; |
||||
import edu.ncst.award.utils.ResultUtils; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* 项目 保存到数据库 |
||||
*/ |
||||
@Api(tags = "ProjectController") |
||||
@Slf4j |
||||
@RestController |
||||
@RequestMapping(value = "/api/project") |
||||
public class ProjectController { |
||||
|
||||
@Autowired |
||||
ProjectServiceImpl projectService; |
||||
|
||||
@ApiOperation("保存project数据") |
||||
@PostMapping("") |
||||
// @RequestBody Project project
|
||||
public Project saveProject(@RequestBody Project project) { |
||||
System.out.println(project); |
||||
projectService.save(project); |
||||
ResultUtils.success("success"); |
||||
return new Project(); |
||||
} |
||||
|
||||
} |
||||
@ -1,36 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import edu.ncst.award.model.dict.DictCountry; |
||||
import edu.ncst.award.service.impl.dict.DictCountryImpl; |
||||
import edu.ncst.award.utils.ResultUtils; |
||||
import edu.ncst.award.vo.ResultVO; |
||||
import lombok.val; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/api/dict/country") |
||||
public class DictCountryController { |
||||
|
||||
@Autowired |
||||
DictCountryImpl dictCountry; |
||||
|
||||
@GetMapping |
||||
public ResultVO<List<DictCountry>> getAllCountry() { |
||||
val countries = dictCountry.list(); |
||||
return ResultUtils.success("ok", countries); |
||||
} |
||||
} |
||||
@ -1,36 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import edu.ncst.award.model.dict.DictCountry; |
||||
import edu.ncst.award.model.dict.DictEvaluateLevel; |
||||
import edu.ncst.award.service.impl.dict.DictCountryImpl; |
||||
import edu.ncst.award.service.impl.dict.DictEvaluateLevelImpl; |
||||
import edu.ncst.award.utils.ResultUtils; |
||||
import edu.ncst.award.vo.ResultVO; |
||||
import lombok.val; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/dict/evaluate-level-entity") |
||||
public class DictEvaluateLevelController { |
||||
@Autowired |
||||
DictEvaluateLevelImpl evaluateLevel; |
||||
|
||||
@GetMapping |
||||
public ResultVO<List<DictEvaluateLevel>> getAllCountry() { |
||||
val evaluateLevels = evaluateLevel.list(); |
||||
return ResultUtils.success("ok", evaluateLevels); |
||||
} |
||||
} |
||||
@ -1,18 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/dict/nation-entity") |
||||
public class DictNationController { |
||||
|
||||
} |
||||
@ -1,18 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/dict/recommend-level-entity") |
||||
public class DictRecommendLevelController { |
||||
|
||||
} |
||||
@ -1,18 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/dict/rewards-type-entity") |
||||
public class DictRewardsTypeController { |
||||
|
||||
} |
||||
@ -1,18 +0,0 @@ |
||||
package edu.ncst.award.controller.dict; |
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/dict/secret-level-entity") |
||||
public class DictSecretLevelController { |
||||
|
||||
} |
||||
@ -0,0 +1,34 @@ |
||||
package edu.ncst.award.domain; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* 用户和角色关联 sys_user_role |
||||
* |
||||
* @author Lion Li |
||||
*/ |
||||
|
||||
@Data |
||||
@TableName("sys_user_role") |
||||
@ApiModel("用户和角色关联") |
||||
public class UserRole { |
||||
|
||||
/** |
||||
* 用户ID |
||||
*/ |
||||
@TableId(type = IdType.INPUT) |
||||
@ApiModelProperty(value = "用户ID") |
||||
private Long userId; |
||||
|
||||
/** |
||||
* 角色ID |
||||
*/ |
||||
@ApiModelProperty(value = "角色ID") |
||||
private Long roleId; |
||||
|
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo; |
||||
package edu.ncst.award.domain.vo; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo; |
||||
package edu.ncst.award.domain.vo; |
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
@ -0,0 +1,79 @@ |
||||
package edu.ncst.award.domain.vo; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
/** |
||||
* 统一的接口返回数据格式 |
||||
*/ |
||||
@ApiModel("请求响应对象") |
||||
@NoArgsConstructor |
||||
@Data |
||||
public class R<T> { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 成功 |
||||
*/ |
||||
public static final int SUCCESS = 200; |
||||
|
||||
/** |
||||
* 失败 |
||||
*/ |
||||
public static final int FAIL = 500; |
||||
|
||||
@ApiModelProperty("消息状态码") |
||||
private int code; |
||||
|
||||
@ApiModelProperty("消息内容") |
||||
private String msg; |
||||
|
||||
@ApiModelProperty("数据对象") |
||||
private T data; |
||||
|
||||
public static <T> R<T> ok() { |
||||
return restResult(null, SUCCESS, "操作成功"); |
||||
} |
||||
|
||||
public static <T> R<T> ok(T data) { |
||||
return restResult(data, SUCCESS, "操作成功"); |
||||
} |
||||
|
||||
public static <T> R<T> ok(String msg) { |
||||
return restResult(null, SUCCESS, msg); |
||||
} |
||||
|
||||
public static <T> R<T> ok(String msg, T data) { |
||||
return restResult(data, SUCCESS, msg); |
||||
} |
||||
|
||||
public static <T> R<T> fail() { |
||||
return restResult(null, FAIL, "操作失败"); |
||||
} |
||||
|
||||
public static <T> R<T> fail(String msg) { |
||||
return restResult(null, FAIL, msg); |
||||
} |
||||
|
||||
public static <T> R<T> fail(T data) { |
||||
return restResult(data, FAIL, "操作失败"); |
||||
} |
||||
|
||||
public static <T> R<T> fail(String msg, T data) { |
||||
return restResult(data, FAIL, msg); |
||||
} |
||||
|
||||
public static <T> R<T> fail(int code, String msg) { |
||||
return restResult(null, code, msg); |
||||
} |
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg) { |
||||
R<T> r = new R<>(); |
||||
r.setCode(code); |
||||
r.setData(data); |
||||
r.setMsg(msg); |
||||
return r; |
||||
} |
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo; |
||||
package edu.ncst.award.domain.vo; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
import edu.ncst.award.common.util.treeUtils.TreeNode; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo; |
||||
package edu.ncst.award.domain.vo; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo.param; |
||||
package edu.ncst.award.domain.vo.param; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo.param; |
||||
package edu.ncst.award.domain.vo.param; |
||||
|
||||
import edu.ncst.award.model.system.Menu; |
||||
import lombok.Data; |
||||
@ -1,13 +1,15 @@ |
||||
package edu.ncst.award.vo.param.query; |
||||
package edu.ncst.award.domain.vo.param.query; |
||||
|
||||
import edu.ncst.award.vo.Query; |
||||
import edu.ncst.award.domain.vo.Query; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(description = "登录日志查询对象") |
||||
@Data |
||||
public class LoginLogQuery extends Query { |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo.param.query; |
||||
package edu.ncst.award.domain.vo.param.query; |
||||
|
||||
import cn.hutool.core.util.ObjectUtil; |
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo.param.query; |
||||
package edu.ncst.award.domain.vo.param.query; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
@ -1,4 +1,4 @@ |
||||
package edu.ncst.award.vo.result; |
||||
package edu.ncst.award.domain.vo.result; |
||||
|
||||
import edu.ncst.award.model.system.Role; |
||||
import io.swagger.annotations.ApiModel; |
||||
@ -0,0 +1,30 @@ |
||||
package edu.ncst.award.framework.aspectj; |
||||
|
||||
import edu.ncst.award.common.annotation.Log; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.aspectj.lang.JoinPoint; |
||||
import org.aspectj.lang.annotation.AfterReturning; |
||||
import org.aspectj.lang.annotation.Aspect; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
/** |
||||
* 操作日志记录处理 |
||||
* |
||||
* @author Gpu is all you need |
||||
*/ |
||||
@Slf4j |
||||
@Aspect |
||||
@Component |
||||
public class LogAspect { |
||||
|
||||
/** |
||||
* 处理完请求后执行 |
||||
* |
||||
* @param joinPoint 切点 |
||||
*/ |
||||
@AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") |
||||
public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult){ |
||||
System.out.println(joinPoint); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
package edu.ncst.award.mapper; |
||||
|
||||
|
||||
import edu.ncst.award.common.mapper.BaseMapperPlus; |
||||
import edu.ncst.award.domain.UserRole; |
||||
|
||||
public interface UserRoleMapper extends BaseMapperPlus<UserRoleMapper, UserRole, UserRole> { |
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictCountry; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictCountryMapper extends BaseMapper<DictCountry> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictEvaluateLevel; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictEvaluateLevelMapper extends BaseMapper<DictEvaluateLevel> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictNation; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictNationMapper extends BaseMapper<DictNation> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictRecommendLevel; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictRecommendLevelMapper extends BaseMapper<DictRecommendLevel> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictRewardsType; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictRewardsTypeMapper extends BaseMapper<DictRewardsType> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.mapper.dict; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import edu.ncst.award.model.dict.DictSecretLevel; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface DictSecretLevelMapper extends BaseMapper<DictSecretLevel> { |
||||
|
||||
} |
||||
@ -1,17 +0,0 @@ |
||||
package edu.ncst.award.mapper.system; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import edu.ncst.award.model.project.Project; |
||||
import edu.ncst.award.model.system.Menu; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* project Mapper 接口 |
||||
*/ |
||||
@Repository |
||||
public interface ProjectMapper extends BaseMapper<Project> { |
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_country") |
||||
@ApiModel(value = "DictCountry对象", description = "职位") |
||||
public class DictCountry implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_evaluate_level") |
||||
@ApiModel(value = "DictEvaluateLevel对象", description = "职位") |
||||
public class DictEvaluateLevel implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_nation") |
||||
@ApiModel(value = "DictNation对象", description = "职位") |
||||
public class DictNation implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_recommend_level") |
||||
@ApiModel(value = "DictRecommendLevel对象", description = "职位") |
||||
public class DictRecommendLevel implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_rewards_type") |
||||
@ApiModel(value = "DictRewardsType对象", description = "职位") |
||||
public class DictRewardsType implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,53 +0,0 @@ |
||||
package edu.ncst.award.model.dict; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("dict_secret_level") |
||||
@ApiModel(value = "DictSecretLevel对象", description = "职位") |
||||
public class DictSecretLevel implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("ID") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("符号") |
||||
@TableField("value") |
||||
private String value; |
||||
|
||||
@ApiModelProperty("显示文本") |
||||
@TableField("label") |
||||
private String label; |
||||
|
||||
@ApiModelProperty("排序") |
||||
@TableField("sort") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("是否启用") |
||||
@TableField("enable") |
||||
private Boolean enable; |
||||
|
||||
|
||||
} |
||||
@ -1,210 +0,0 @@ |
||||
package edu.ncst.award.model.project; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
|
||||
import java.io.Serializable; |
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* <p> |
||||
* |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-16 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@Accessors(chain = true) |
||||
@TableName("project") |
||||
@ApiModel(value = "ProjectEntity对象") |
||||
public class Project implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("项目ID") |
||||
@TableId(value = "Id", type = IdType.ASSIGN_ID) |
||||
private Long id; |
||||
|
||||
@ApiModelProperty("项目中文名") |
||||
@TableField("chn_name") |
||||
private String chnName; |
||||
|
||||
@ApiModelProperty("项目英文名") |
||||
@TableField("eng_name") |
||||
private String engName; |
||||
|
||||
@ApiModelProperty("主要完成人") |
||||
@TableField("response_person_id") |
||||
private Long responsePersonId; |
||||
|
||||
@ApiModelProperty("主要完成单位") |
||||
@TableField("unit_id") |
||||
private Integer unitId; |
||||
|
||||
@ApiModelProperty("完成单位贡献情况阐述") |
||||
@TableField("unit_contribution") |
||||
private String unitContribution; |
||||
|
||||
@ApiModelProperty("奖励类别 APP_TECH:应用技术成果 BASIC_TECH:基础技术成果 EXTENSION:推广成果 TECH_BASIC:技术基础成果 SOFT_TECH:软科学成果 OTHER:其他") |
||||
@TableField("award_type") |
||||
private Integer awardType; |
||||
|
||||
@ApiModelProperty("推荐单位") |
||||
@TableField("recomend_unit_id") |
||||
private Integer recomendUnitId; |
||||
|
||||
@ApiModelProperty("推荐等级") |
||||
@TableField("recomend_level") |
||||
private Integer recomendLevel; |
||||
|
||||
@ApiModelProperty("推荐日期") |
||||
@TableField("recommend_date") |
||||
private LocalDate recommendDate; |
||||
|
||||
@ApiModelProperty("密级") |
||||
@TableField("secret_level") |
||||
private Integer secretLevel; |
||||
|
||||
@ApiModelProperty("主管部门") |
||||
@TableField("department_id") |
||||
private Integer departmentId; |
||||
|
||||
@ApiModelProperty("成果登记号") |
||||
@TableField("achieve_code") |
||||
private String achieveCode; |
||||
|
||||
@ApiModelProperty("主题词") |
||||
@TableField("theme") |
||||
private String theme; |
||||
|
||||
@ApiModelProperty("任务来源 A、国家计划 B、省部级计划、集团公司计划 C、计划外 ") |
||||
@TableField("task_source") |
||||
private String taskSource; |
||||
|
||||
@ApiModelProperty("专业分类") |
||||
@TableField("major_category_id") |
||||
private Integer majorCategoryId; |
||||
|
||||
@ApiModelProperty("计划名称") |
||||
@TableField("plan") |
||||
private String plan; |
||||
|
||||
@ApiModelProperty("计划编号") |
||||
@TableField("plan_code") |
||||
private String planCode; |
||||
|
||||
@ApiModelProperty("项目开始日期") |
||||
@TableField("project_start_time") |
||||
private LocalDate projectStartTime; |
||||
|
||||
@ApiModelProperty("项目终止日期") |
||||
@TableField("project_end_time") |
||||
private LocalDate projectEndTime; |
||||
|
||||
@ApiModelProperty("应用领域 A、民用 B、军民通用 ") |
||||
@TableField("app_field") |
||||
private String appField; |
||||
|
||||
@ApiModelProperty("应用日期") |
||||
@TableField("app_date") |
||||
private LocalDate appDate; |
||||
|
||||
@ApiModelProperty("成果评价机构") |
||||
@TableField("evaluate_org_id") |
||||
private Integer evaluateOrgId; |
||||
|
||||
@ApiModelProperty("评价水平") |
||||
@TableField("evaluate_level") |
||||
private Integer evaluateLevel; |
||||
|
||||
@ApiModelProperty("评价日期") |
||||
@TableField("evaluate_date") |
||||
private LocalDate evaluateDate; |
||||
|
||||
|
||||
@ApiModelProperty("授权发明专利") |
||||
@TableField("invention_patent") |
||||
private Integer inventionPatent; |
||||
|
||||
@ApiModelProperty("授权的其他知识产权") |
||||
@TableField("intellectual_property") |
||||
private Integer intellectualProperty; |
||||
|
||||
@ApiModelProperty("项目简介") |
||||
@TableField("project_info") |
||||
private String projectInfo; |
||||
|
||||
@ApiModelProperty("技术创新") |
||||
@TableField("tech_innovation") |
||||
private String techInnovation; |
||||
|
||||
@ApiModelProperty("技术局限性") |
||||
@TableField("tech_limitation") |
||||
private String techLimitation; |
||||
|
||||
@ApiModelProperty("第三方评价描述") |
||||
@TableField("third_evaluation") |
||||
private String thirdEvaluation; |
||||
|
||||
@ApiModelProperty("应用推广情况概述") |
||||
@TableField("application_summary") |
||||
private String applicationSummary; |
||||
|
||||
@ApiModelProperty("直接经济效益概述") |
||||
@TableField("direct_benifit") |
||||
private String directBenifit; |
||||
|
||||
@ApiModelProperty("间接经济效益概述") |
||||
@TableField("indirect_benifit") |
||||
private String indirectBenifit; |
||||
|
||||
@ApiModelProperty("社会效益概述") |
||||
@TableField("social_benifit") |
||||
private String socialBenifit; |
||||
|
||||
@ApiModelProperty("项目状态 {0:保存;1:提交;2::已分配专家;3:专家评审通过;4:已通过;6:专家评审未通过;7:打回修改;8:已拒绝;-1:无效项目") |
||||
@TableField("status") |
||||
private Integer status; |
||||
|
||||
@ApiModelProperty("项目备注") |
||||
@TableField("remark") |
||||
private String remark; |
||||
|
||||
@ApiModelProperty("创建者") |
||||
@TableField("create_user_id") |
||||
private Integer createUserId; |
||||
|
||||
|
||||
@ApiModelProperty("创建时间") |
||||
@TableField("create_time") |
||||
private LocalDateTime createTime; |
||||
|
||||
@ApiModelProperty("最后修改者") |
||||
@TableField("last_modify_user_id") |
||||
private Integer lastModifyUserId; |
||||
|
||||
@ApiModelProperty("最后修改时间") |
||||
@TableField("last_modify_time") |
||||
private LocalDateTime lastModifyTime; |
||||
|
||||
@ApiModelProperty("删除者") |
||||
@TableField("delete_user_id") |
||||
private Integer deleteUserId; |
||||
|
||||
@ApiModelProperty("删除时间") |
||||
@TableField("delete_time") |
||||
private LocalDate deleteTime; |
||||
|
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.dict.DictCountry; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface IDictCountry extends IService<DictCountry> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.dict.DictEvaluateLevel; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface IDictEvaluateLevel extends IService<DictEvaluateLevel> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.dict.DictNation; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface IDictNation extends IService<DictNation> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.dict.DictRewardsType; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface IDictRewardsType extends IService<DictRewardsType> { |
||||
|
||||
} |
||||
@ -1,16 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.dict.DictSecretLevel; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
public interface IDictSecretLevel extends IService<DictSecretLevel> { |
||||
|
||||
} |
||||
@ -1,7 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import edu.ncst.award.model.project.Project; |
||||
|
||||
public interface IProjectService extends IService<Project> { |
||||
} |
||||
@ -0,0 +1,114 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import edu.ncst.award.common.core.page.TableDataInfo; |
||||
import edu.ncst.award.domain.UserRole; |
||||
import edu.ncst.award.domain.vo.param.query.PageQuery; |
||||
import edu.ncst.award.model.system.Role; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 角色业务层 |
||||
* |
||||
* @author Lion Li |
||||
*/ |
||||
public interface IRoleService { |
||||
/** |
||||
* 查询所有角色 |
||||
* |
||||
* @return 角色列表 |
||||
*/ |
||||
List<Role> selectRoleAll(); |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
TableDataInfo<Role> selectPageRoleList(Role role, PageQuery pageQuery); |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
List<Role> selectRoleList(Role role); |
||||
|
||||
/** |
||||
* 根据角色编号查询详细信息 |
||||
* |
||||
* @param roleId 角色id |
||||
* @return 角色详细信息 |
||||
*/ |
||||
Role selectRoleById(Long roleId); |
||||
|
||||
String checkRoleNameUnique(Role role); |
||||
|
||||
String checkRoleLabelUnique(Role role); |
||||
|
||||
int insertRole(Role role); |
||||
|
||||
boolean updateRole(Role role); |
||||
|
||||
/** |
||||
* 修改角色状态 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 结果 |
||||
*/ |
||||
int updateRoleStatus(Role role); |
||||
|
||||
/** |
||||
* 批量删除角色信息 |
||||
* |
||||
* @param roleIds 需要删除的角色ID |
||||
* @return 结果 |
||||
*/ |
||||
int deleteRoleByIds(Long[] roleIds); |
||||
|
||||
/** |
||||
* 通过角色ID查询角色使用数量 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @return 结果 |
||||
*/ |
||||
long countUserRoleByRoleId(Long roleId); |
||||
|
||||
/** |
||||
* 根据用户ID查询角色列表 |
||||
* |
||||
* @param userId 用户ID |
||||
* @return 角色列表 |
||||
*/ |
||||
List<Role> selectRolesByUserId(Long userId); |
||||
|
||||
|
||||
/** |
||||
* 取消授权用户角色 |
||||
* |
||||
* @param userRole 用户和角色关联信息 |
||||
* @return 结果 |
||||
*/ |
||||
int deleteAuthUser(UserRole userRole); |
||||
|
||||
/** |
||||
* 批量取消授权用户角色 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @param userIds 需要取消授权的用户数据ID |
||||
* @return 结果 |
||||
*/ |
||||
int deleteAuthUsers(Long roleId, Long[] userIds); |
||||
|
||||
|
||||
/** |
||||
* 批量选择授权用户角色 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @param userIds 需要删除的用户数据ID |
||||
* @return 结果 |
||||
*/ |
||||
int insertAuthUsers(Long roleId, Long[] userIds); |
||||
} |
||||
@ -1,39 +0,0 @@ |
||||
package edu.ncst.award.service; |
||||
|
||||
import edu.ncst.award.common.core.page.TableDataInfo; |
||||
import edu.ncst.award.model.system.Role; |
||||
import edu.ncst.award.model.system.User; |
||||
import edu.ncst.award.vo.param.query.PageQuery; |
||||
|
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* 角色业务层 |
||||
* |
||||
* @author Lion Li |
||||
*/ |
||||
public interface ISysRoleService { |
||||
/** |
||||
* 查询所有角色 |
||||
* |
||||
* @return 角色列表 |
||||
*/ |
||||
List<Role> selectRoleAll(); |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
TableDataInfo<Role> selectPageRoleList(Role role, PageQuery pageQuery); |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
List<Role> selectRoleList(Role role); |
||||
} |
||||
@ -1,22 +0,0 @@ |
||||
package edu.ncst.award.service.impl.dict; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.dict.DictCountryMapper; |
||||
import edu.ncst.award.model.dict.DictCountry; |
||||
import edu.ncst.award.service.IDictCountry; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Service |
||||
public class DictCountryImpl extends ServiceImpl<DictCountryMapper, DictCountry> implements IDictCountry { |
||||
|
||||
} |
||||
@ -1,21 +0,0 @@ |
||||
package edu.ncst.award.service.impl.dict; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.dict.DictEvaluateLevelMapper; |
||||
import edu.ncst.award.model.dict.DictEvaluateLevel; |
||||
import edu.ncst.award.service.IDictEvaluateLevel; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Service |
||||
public class DictEvaluateLevelImpl extends ServiceImpl<DictEvaluateLevelMapper, DictEvaluateLevel> implements IDictEvaluateLevel { |
||||
|
||||
} |
||||
@ -1,21 +0,0 @@ |
||||
package edu.ncst.award.service.impl.dict; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.dict.DictNationMapper; |
||||
import edu.ncst.award.model.dict.DictNation; |
||||
import edu.ncst.award.service.IDictNation; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Service |
||||
public class DictNationImpl extends ServiceImpl<DictNationMapper, DictNation> implements IDictNation { |
||||
|
||||
} |
||||
@ -1,21 +0,0 @@ |
||||
package edu.ncst.award.service.impl.dict; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.dict.DictRewardsTypeMapper; |
||||
import edu.ncst.award.model.dict.DictRewardsType; |
||||
import edu.ncst.award.service.IDictRewardsType; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Service |
||||
public class DictRewardsTypeImpl extends ServiceImpl<DictRewardsTypeMapper, DictRewardsType> implements IDictRewardsType { |
||||
|
||||
} |
||||
@ -1,21 +0,0 @@ |
||||
package edu.ncst.award.service.impl.dict; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.dict.DictSecretLevelMapper; |
||||
import edu.ncst.award.model.dict.DictSecretLevel; |
||||
import edu.ncst.award.service.IDictSecretLevel; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 职位 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author <a href="https://www.fengwenyi.com?code">Erwin Feng</a> |
||||
* @since 2022-03-21 |
||||
*/ |
||||
@Service |
||||
public class DictSecretLevelImpl extends ServiceImpl<DictSecretLevelMapper, DictSecretLevel> implements IDictSecretLevel { |
||||
|
||||
} |
||||
@ -1,14 +0,0 @@ |
||||
package edu.ncst.award.service.impl.project; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import edu.ncst.award.mapper.system.ProjectMapper; |
||||
import edu.ncst.award.model.project.Project; |
||||
import edu.ncst.award.service.IProjectService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService { |
||||
} |
||||
@ -0,0 +1,220 @@ |
||||
package edu.ncst.award.service.impl.system; |
||||
|
||||
import cn.hutool.core.util.ObjectUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import edu.ncst.award.common.constant.UserConstants; |
||||
import edu.ncst.award.common.core.exception.ServiceException; |
||||
import edu.ncst.award.common.core.page.TableDataInfo; |
||||
import edu.ncst.award.common.util.spring.SpringUtils; |
||||
import edu.ncst.award.domain.UserRole; |
||||
import edu.ncst.award.domain.vo.param.query.PageQuery; |
||||
import edu.ncst.award.mapper.RoleMapper; |
||||
import edu.ncst.award.mapper.UserRoleMapper; |
||||
import edu.ncst.award.model.system.Role; |
||||
import edu.ncst.award.service.IRoleService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 角色 业务层处理 |
||||
* |
||||
* @author Lion Li |
||||
*/ |
||||
@RequiredArgsConstructor |
||||
@Service |
||||
public class RoleServiceImpl implements IRoleService { |
||||
|
||||
private final RoleMapper baseMapper; |
||||
private final UserRoleMapper userRoleMapper; |
||||
|
||||
/** |
||||
* 查询所有角色 |
||||
* |
||||
* @return 角色列表 |
||||
*/ |
||||
@Override |
||||
@Transactional |
||||
public List<Role> selectRoleAll() { |
||||
// 若依框架是这样写的但是不太理解
|
||||
// SpringUtils.getAopProxy(this).selectRoleList(new Role());
|
||||
// SpringUtils.getBean(SysRoleServiceImpl.class).selectRoleList(new Role());
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(new Role()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public TableDataInfo<Role> selectPageRoleList(Role role, PageQuery pageQuery) { |
||||
Page<Role> page = baseMapper.selectPageRoleList(pageQuery.build(), role); |
||||
return TableDataInfo.build(page); |
||||
} |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
@Override |
||||
public List<Role> selectRoleList(Role role) { |
||||
return baseMapper.selectRoleList(role); |
||||
} |
||||
|
||||
/** |
||||
* 根据角色编号查询详细信息 |
||||
* |
||||
* @param roleId 角色id |
||||
* @return 角色详细信息 |
||||
*/ |
||||
@Override |
||||
public Role selectRoleById(Long roleId) { |
||||
return baseMapper.selectById(roleId); |
||||
} |
||||
|
||||
@Override |
||||
public String checkRoleNameUnique(Role role) { |
||||
if (baseMapper.exists(new LambdaQueryWrapper<Role>().eq(Role::getName, role.getName()))) { |
||||
return UserConstants.NOT_UNIQUE; |
||||
} else { |
||||
return UserConstants.UNIQUE; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public String checkRoleLabelUnique(Role role) { |
||||
if (baseMapper.exists(new LambdaQueryWrapper<Role>() |
||||
.eq(Role::getLabel, role.getLabel()) |
||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), Role::getRoleId, role.getRoleId()) |
||||
)) { |
||||
return UserConstants.NOT_UNIQUE; |
||||
} else { |
||||
return UserConstants.UNIQUE; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public int insertRole(Role role) { |
||||
// // 新增角色信息
|
||||
// baseMapper.insert(role);
|
||||
// return insertRoleMenu(role);
|
||||
return baseMapper.insert(role); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean updateRole(Role role) { |
||||
// // 修改角色信息
|
||||
// baseMapper.updateById(role);
|
||||
// // 删除角色与菜单关联
|
||||
// roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, role.getRoleId()));
|
||||
int i = baseMapper.updateById(role); |
||||
return i > 0; |
||||
} |
||||
|
||||
/** |
||||
* 修改角色状态 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateRoleStatus(Role role) { |
||||
return baseMapper.updateById(role); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除角色信息 |
||||
* |
||||
* @param roleIds 需要删除的角色ID |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteRoleByIds(Long[] roleIds) { |
||||
//TODO 删除角色的同时删除和角色绑定的菜单和资源
|
||||
Arrays.stream(roleIds).forEach(roleId -> { |
||||
if (countUserRoleByRoleId(roleId) > 0) { |
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", roleId)); |
||||
} |
||||
}); |
||||
return baseMapper.deleteBatchIds(Arrays.asList(roleIds)); |
||||
} |
||||
|
||||
/** |
||||
* 通过角色ID查询角色使用数量 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public long countUserRoleByRoleId(Long roleId) { |
||||
return userRoleMapper.selectCount(new LambdaQueryWrapper<UserRole>().eq(UserRole::getRoleId, roleId)); |
||||
} |
||||
|
||||
/** |
||||
* 根据用户ID查询角色列表 |
||||
* |
||||
* @param userId 用户ID |
||||
* @return 角色列表 |
||||
*/ |
||||
@Override |
||||
public List<Role> selectRolesByUserId(Long userId) { |
||||
return baseMapper.getUserRolesById(userId); |
||||
} |
||||
|
||||
/** |
||||
* 取消授权用户角色 |
||||
* |
||||
* @param userRole 用户和角色关联信息 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteAuthUser(UserRole userRole) { |
||||
return userRoleMapper.delete(new LambdaQueryWrapper<UserRole>() |
||||
.eq(UserRole::getRoleId, userRole.getRoleId()) |
||||
.eq(UserRole::getUserId, userRole.getUserId())); |
||||
} |
||||
|
||||
/** |
||||
* 批量取消授权用户角色 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @param userIds 需要取消授权的用户数据ID |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteAuthUsers(Long roleId, Long[] userIds) { |
||||
return userRoleMapper.delete(new LambdaQueryWrapper<UserRole>() |
||||
.eq(UserRole::getRoleId, roleId) |
||||
.in(UserRole::getUserId, Arrays.asList(userIds))); |
||||
} |
||||
|
||||
/** |
||||
* 批量选择授权用户角色 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @param userIds 需要删除的用户数据ID |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertAuthUsers(Long roleId, Long[] userIds) { |
||||
// 新增用户与角色管理
|
||||
int rows = 1; |
||||
List<UserRole> list = new ArrayList<>(); |
||||
for (Long userId : userIds) { |
||||
UserRole ur = new UserRole(); |
||||
ur.setUserId(userId); |
||||
ur.setRoleId(roleId); |
||||
list.add(ur); |
||||
} |
||||
if (list.size() > 0) { |
||||
rows = userRoleMapper.insertBatch(list) ? list.size() : 0; |
||||
} |
||||
return rows; |
||||
} |
||||
} |
||||
@ -1,59 +0,0 @@ |
||||
package edu.ncst.award.service.impl.system; |
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import edu.ncst.award.common.core.page.TableDataInfo; |
||||
import edu.ncst.award.common.util.spring.SpringUtils; |
||||
import edu.ncst.award.mapper.system.SysRoleMapper; |
||||
import edu.ncst.award.model.system.Role; |
||||
import edu.ncst.award.model.system.User; |
||||
import edu.ncst.award.service.ISysRoleService; |
||||
import edu.ncst.award.vo.param.query.PageQuery; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 角色 业务层处理 |
||||
* |
||||
* @author Lion Li |
||||
*/ |
||||
@RequiredArgsConstructor |
||||
@Service |
||||
public class SysRoleServiceImpl implements ISysRoleService { |
||||
|
||||
private final SysRoleMapper baseMapper; |
||||
|
||||
/** |
||||
* 查询所有角色 |
||||
* |
||||
* @return 角色列表 |
||||
*/ |
||||
@Override |
||||
@Transactional |
||||
public List<Role> selectRoleAll() { |
||||
// 若依框架是这样写的但是不太理解
|
||||
// SpringUtils.getAopProxy(this).selectRoleList(new Role());
|
||||
// SpringUtils.getBean(SysRoleServiceImpl.class).selectRoleList(new Role());
|
||||
return SpringUtils.getAopProxy(this).selectRoleList(new Role()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public TableDataInfo<Role> selectPageRoleList(Role role, PageQuery pageQuery) { |
||||
Page<Role> page = baseMapper.selectPageRoleList(pageQuery.build(), role); |
||||
return TableDataInfo.build(page); |
||||
} |
||||
|
||||
/** |
||||
* 根据条件分页查询角色数据 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return 角色数据集合信息 |
||||
*/ |
||||
@Override |
||||
public List<Role> selectRoleList(Role role) { |
||||
return baseMapper.selectRoleList(role); |
||||
} |
||||
} |
||||
@ -1,84 +0,0 @@ |
||||
package edu.ncst.award.utils; |
||||
|
||||
import edu.ncst.award.exception.CodeMsg; |
||||
import edu.ncst.award.vo.ResultVO; |
||||
|
||||
public class ResultUtils { |
||||
|
||||
// 成功
|
||||
public static <T> ResultVO<T> success(String msg, T data) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(0); |
||||
resultVO.setMsg(msg); |
||||
resultVO.setData(data); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
public static <T> ResultVO<T> success(String msg) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(0); |
||||
resultVO.setMsg(msg); |
||||
resultVO.setData(null); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
// 成功
|
||||
public static <T> ResultVO<T> success(T data) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(0); |
||||
resultVO.setMsg("success"); |
||||
resultVO.setData(data); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
public static <T> ResultVO<T> success() { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(0); |
||||
resultVO.setMsg("success"); |
||||
return resultVO; |
||||
} |
||||
|
||||
// 错误
|
||||
public static <T> ResultVO<T> error(CodeMsg codeMsg) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(codeMsg.getCode()); |
||||
resultVO.setMsg(codeMsg.getMsg()); |
||||
resultVO.setData(null); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
public static <T> ResultVO<T> error() { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setMsg("fail"); |
||||
resultVO.setData(null); |
||||
return resultVO; |
||||
} |
||||
|
||||
|
||||
// 错误
|
||||
public static <T> ResultVO<T> error(String codeMsg, Boolean showCode) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setMsg(codeMsg); |
||||
if (showCode) { |
||||
resultVO.setCode(500); |
||||
} |
||||
resultVO.setData(null); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
// 错误
|
||||
public static <T> ResultVO<T> error(String codeMsg) { |
||||
ResultVO<T> resultVO = new ResultVO<>(); |
||||
resultVO.setCode(500); |
||||
resultVO.setMsg(codeMsg); |
||||
resultVO.setData(null); |
||||
|
||||
return resultVO; |
||||
} |
||||
|
||||
} |
||||
@ -1,19 +0,0 @@ |
||||
package edu.ncst.award.vo; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
/** |
||||
* 统一的接口返回数据格式 |
||||
*/ |
||||
@ApiModel(value = "ResultVO", description = "返回信息") |
||||
@Data |
||||
public class ResultVO<T> { |
||||
private Integer code=0; |
||||
private String msg="success"; |
||||
// 数据
|
||||
@ApiModelProperty(value = "数据", dataType = "Object",name = "data") |
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY) |
||||
private T data; |
||||
} |
||||
@ -1,6 +1,6 @@ |
||||
<?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="edu.ncst.award.mapper.system.ResourceMapper"> |
||||
<mapper namespace="edu.ncst.award.mapper.ResourceMapper"> |
||||
|
||||
<select id="getIdByName" resultType="java.lang.Integer"> |
||||
select id |
||||
@ -1,13 +0,0 @@ |
||||
package edu.ncst.award; |
||||
|
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
@SpringBootTest |
||||
class AwardApplicationTests { |
||||
|
||||
@Test |
||||
void contextLoads() { |
||||
} |
||||
|
||||
} |
||||
@ -1,21 +1,37 @@ |
||||
package edu.ncst.award; |
||||
|
||||
import edu.ncst.award.service.impl.system.SysRoleServiceImpl; |
||||
import cn.hutool.core.date.DateTime; |
||||
import edu.ncst.award.model.system.Role; |
||||
import edu.ncst.award.service.impl.system.RoleServiceImpl; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@SpringBootTest |
||||
public class TestRoleService { |
||||
|
||||
@Resource |
||||
SysRoleServiceImpl sysRoleService; |
||||
RoleServiceImpl sysRoleService; |
||||
|
||||
@Test |
||||
public void selectRoleList(){ |
||||
sysRoleService.selectRoleAll(); |
||||
public void selectRoleList() { |
||||
List<Role> roles = sysRoleService.selectRoleAll(); |
||||
System.out.println(roles.toString()); |
||||
} |
||||
|
||||
@Test |
||||
public void addNewRole() { |
||||
Role role = new Role(); |
||||
role.setCreateTime(new DateTime()); |
||||
role.setCreateUserId(1); |
||||
role.setName("ni42377547547hao"); |
||||
role.setLabel("hh56754h4523"); |
||||
role.setEnable(true); |
||||
System.out.println(sysRoleService.insertRole(role)); |
||||
System.out.println(); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue