数据库修改,DO模块编写
This commit is contained in:
parent
7dbf3d52b8
commit
a1817ac53f
|
@ -312,7 +312,7 @@ node6 --|> node4
|
|||
| 7 | `git` | git代码仓库内容 | json | | YES | | |
|
||||
| 8 | `difficulty_level` | 难度等级 | tinyint unsigned | | NO | | 1 |
|
||||
| 9 | `type` | 类型 | int unsigned | MUL | NO | | |
|
||||
| 10 | `reward` | 报酬 | double | | YES | | |
|
||||
| 10 | `reward` | 报酬 | bigint unsigned | | YES | | |
|
||||
| 11 | `status` | 状态 | tinyint unsigned | | NO | | 0 |
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ CREATE TABLE `oa_project`
|
|||
`git` json DEFAULT NULL COMMENT 'git代码仓库内容',
|
||||
`difficulty_level` tinyint UNSIGNED NOT NULL DEFAULT '1' COMMENT '难度等级',
|
||||
`type` int UNSIGNED NOT NULL COMMENT '类型',
|
||||
`reward` double DEFAULT NULL COMMENT '报酬',
|
||||
`reward` bigint UNSIGNED DEFAULT NULL COMMENT '报酬',
|
||||
`status` tinyint UNSIGNED NOT NULL DEFAULT '0' COMMENT '状态'
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
</parent>
|
||||
<groupId>com.jsl</groupId>
|
||||
<artifactId>oa</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.0</version>
|
||||
<name>JSL_OrganizeInternalOA</name>
|
||||
<description>JSL_OrganizeInternalOA</description>
|
||||
<properties>
|
||||
|
|
|
@ -35,7 +35,7 @@ public class UserControllerAspect {
|
|||
* @return {@link Object}
|
||||
* @throws Throwable 异常
|
||||
*/
|
||||
@Around("execution(* com.jsl.oa.controllers.UserController.*(..))")
|
||||
@Around("execution(* com.jsl.oa.controllers.AuthController.*(..))")
|
||||
public Object controllerAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// 获取HttpServletRequest对象
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.jsl.oa.controllers;
|
|||
|
||||
import com.jsl.oa.model.voData.UserLoginVO;
|
||||
import com.jsl.oa.model.voData.UserRegisterVO;
|
||||
import com.jsl.oa.services.UserService;
|
||||
import com.jsl.oa.services.AuthService;
|
||||
import com.jsl.oa.utils.BaseResponse;
|
||||
import com.jsl.oa.utils.ErrorCode;
|
||||
import com.jsl.oa.utils.Processing;
|
||||
|
@ -18,8 +18,8 @@ import java.text.ParseException;
|
|||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class UserController {
|
||||
private final UserService userService;
|
||||
public class AuthController {
|
||||
private final AuthService authService;
|
||||
|
||||
/**
|
||||
* <h1>用户注册</h1>
|
||||
|
@ -30,12 +30,12 @@ public class UserController {
|
|||
* @author 筱锋xiao_lfeng
|
||||
*/
|
||||
@PostMapping("/user/register")
|
||||
public BaseResponse userRegister(@RequestBody @Validated UserRegisterVO userRegisterVO, BindingResult bindingResult) throws ParseException {
|
||||
public BaseResponse authRegister(@RequestBody @Validated UserRegisterVO userRegisterVO, BindingResult bindingResult) throws ParseException {
|
||||
// 判断是否有参数错误
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||
}
|
||||
return userService.userRegister(userRegisterVO);
|
||||
return authService.authRegister(userRegisterVO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,11 +49,11 @@ public class UserController {
|
|||
* @author 176yunxuan
|
||||
*/
|
||||
@PostMapping("/user/login")
|
||||
public BaseResponse userLogin(@RequestBody @Validated UserLoginVO userLoginVO, BindingResult bindingResult){
|
||||
public BaseResponse authLogin(@RequestBody @Validated UserLoginVO userLoginVO, BindingResult bindingResult){
|
||||
// 判断是否有参数错误
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||
}
|
||||
return userService.userLogin(userLoginVO);
|
||||
return authService.authLogin(userLoginVO);
|
||||
}
|
||||
}
|
27
src/main/java/com/jsl/oa/model/doData/ConfigDO.java
Normal file
27
src/main/java/com/jsl/oa/model/doData/ConfigDO.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>config 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_config 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ConfigDO {
|
||||
private Long id;
|
||||
private String value;
|
||||
private String data;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
28
src/main/java/com/jsl/oa/model/doData/PermissionDO.java
Normal file
28
src/main/java/com/jsl/oa/model/doData/PermissionDO.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>permission 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_permission 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PermissionDO {
|
||||
private Long id;
|
||||
private Long pid;
|
||||
private String name;
|
||||
private String code;
|
||||
private Short type;
|
||||
private Timestamp deletedAt;
|
||||
}
|
31
src/main/java/com/jsl/oa/model/doData/ProjectCuttingDO.java
Normal file
31
src/main/java/com/jsl/oa/model/doData/ProjectCuttingDO.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>project_cutting 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_project_cutting 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProjectCuttingDO {
|
||||
private Long id;
|
||||
private Long pid;
|
||||
private String name;
|
||||
private String tag;
|
||||
private Short engineering;
|
||||
private Integer estimatedTime;
|
||||
private Integer realTime;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
31
src/main/java/com/jsl/oa/model/doData/ProjectDO.java
Normal file
31
src/main/java/com/jsl/oa/model/doData/ProjectDO.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <h1>project 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_project 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProjectDO {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String introduction;
|
||||
private Boolean codeOpen;
|
||||
private String coreCode;
|
||||
private String git;
|
||||
private Short difficultyLevel;
|
||||
private Integer type;
|
||||
private Long reward;
|
||||
private Short status;
|
||||
}
|
26
src/main/java/com/jsl/oa/model/doData/ProjectTypeDO.java
Normal file
26
src/main/java/com/jsl/oa/model/doData/ProjectTypeDO.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>project_type 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_project_type 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProjectTypeDO {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
27
src/main/java/com/jsl/oa/model/doData/ProjectUserDO.java
Normal file
27
src/main/java/com/jsl/oa/model/doData/ProjectUserDO.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>project_user 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_project_user 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProjectUserDO {
|
||||
private Long id;
|
||||
private Long pid;
|
||||
private Long uid;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
26
src/main/java/com/jsl/oa/model/doData/RoleDO.java
Normal file
26
src/main/java/com/jsl/oa/model/doData/RoleDO.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>role 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_role 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class RoleDO {
|
||||
private Long id;
|
||||
private String roleName;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
25
src/main/java/com/jsl/oa/model/doData/RolePermissionDO.java
Normal file
25
src/main/java/com/jsl/oa/model/doData/RolePermissionDO.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>role 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_role 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class RolePermissionDO {
|
||||
private Long rid;
|
||||
private Long pid;
|
||||
private Timestamp createdAt;
|
||||
}
|
26
src/main/java/com/jsl/oa/model/doData/RoleUserDO.java
Normal file
26
src/main/java/com/jsl/oa/model/doData/RoleUserDO.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>project_user 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 oa_project_user 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @since v1.1.0
|
||||
* @version v1.1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class RoleUserDO {
|
||||
private Long uid;
|
||||
private Long rid;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
|
@ -1,35 +1,42 @@
|
|||
package com.jsl.oa.model.doData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* <h1>users 数据表</h1>
|
||||
* <h1>user 数据表</h1>
|
||||
* <hr/>
|
||||
* 映射 users 数据表内容进入自定义实体类
|
||||
* 映射 oa_user 数据表内容进入自定义实体类
|
||||
*
|
||||
* @author 筱锋xiao_lfeng
|
||||
* @version v1.1.0
|
||||
* @since v1.0.0
|
||||
* @version v1.0.0
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class UserDO {
|
||||
private Integer id;
|
||||
private String userNum;
|
||||
private Long id;
|
||||
private Long jobId;
|
||||
private String username;
|
||||
private String password;
|
||||
private String sex;
|
||||
private Date age;
|
||||
private String unit;
|
||||
private String filed;
|
||||
private String hometown;
|
||||
private String kind;
|
||||
private String state;
|
||||
private String address;
|
||||
private String phone;
|
||||
private String email;
|
||||
private Short age;
|
||||
private String signature;
|
||||
private String avatar;
|
||||
private String nickname;
|
||||
private Short sex;
|
||||
private Boolean enabled;
|
||||
private Boolean accountNoExpired;
|
||||
private Boolean credentialsNoExpired;
|
||||
private Boolean recommend;
|
||||
private Boolean accountNoLocked;
|
||||
private String description;
|
||||
private Timestamp createdAt;
|
||||
private Timestamp updatedAt;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@ import com.jsl.oa.utils.BaseResponse;
|
|||
|
||||
import java.text.ParseException;
|
||||
|
||||
public interface UserService {
|
||||
BaseResponse userRegister(UserRegisterVO userRegisterVO) throws ParseException;
|
||||
|
||||
BaseResponse userLogin(UserLoginVO userLoginVO);
|
||||
public interface AuthService {
|
||||
BaseResponse authRegister(UserRegisterVO userRegisterVO) throws ParseException;
|
||||
BaseResponse authLogin(UserLoginVO userLoginVO);
|
||||
}
|
|
@ -5,7 +5,7 @@ import com.jsl.oa.model.voData.UserLoginVO;
|
|||
import com.jsl.oa.model.voData.UserRegisterVO;
|
||||
import com.jsl.oa.exception.BusinessException;
|
||||
import com.jsl.oa.mapper.UserMapper;
|
||||
import com.jsl.oa.services.UserService;
|
||||
import com.jsl.oa.services.AuthService;
|
||||
import com.jsl.oa.utils.BaseResponse;
|
||||
import com.jsl.oa.utils.ErrorCode;
|
||||
import com.jsl.oa.utils.Processing;
|
||||
|
@ -20,7 +20,7 @@ import java.text.SimpleDateFormat;
|
|||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserServiceImpl implements UserService {
|
||||
public class AuthServiceImpl implements AuthService {
|
||||
private final UserMapper userMapper;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ public class UserServiceImpl implements UserService {
|
|||
* @throws ParseException 日期转换异常
|
||||
*/
|
||||
@Override
|
||||
public BaseResponse userRegister(UserRegisterVO userRegisterVO) throws ParseException {
|
||||
public BaseResponse authRegister(UserRegisterVO userRegisterVO) throws ParseException {
|
||||
// 用户检查是否存在
|
||||
UserDO getUserByUsername = userMapper.getUserByUsername(userRegisterVO.getUsername());
|
||||
// 用户名已存在
|
||||
|
@ -50,7 +50,7 @@ public class UserServiceImpl implements UserService {
|
|||
// 数据上传
|
||||
Date getDate = new Date(new SimpleDateFormat("yyyy-MM-dd").parse(userRegisterVO.getAge()).getTime());
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserNum(userNum)
|
||||
userDO.πsetUserNum(userNum)
|
||||
.setUsername(userRegisterVO.getUsername())
|
||||
.setPassword(BCrypt.hashpw(userRegisterVO.getPassword(), BCrypt.gensalt()))
|
||||
.setSex(userRegisterVO.getSex())
|
||||
|
@ -70,7 +70,7 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse userLogin(UserLoginVO userLoginVO) {
|
||||
public BaseResponse authLogin(UserLoginVO userLoginVO) {
|
||||
String pwd = userLoginVO.getPassword();
|
||||
String encodePwd = userMapper.loginPassword(userLoginVO);
|
||||
if (encodePwd == null) {
|
|
@ -4,6 +4,10 @@ spring:
|
|||
username: organize_oa
|
||||
password: 123456
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
redis:
|
||||
database: 0
|
||||
host: localhost
|
||||
port: 6379
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
|
Loading…
Reference in New Issue
Block a user