功能增加
This commit is contained in:
parent
238c1e1718
commit
d7afcc1e18
@ -1,9 +1,55 @@
|
|||||||
package com.jsl.oa.controllers;
|
package com.jsl.oa.controllers;
|
||||||
|
|
||||||
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
|
import com.jsl.oa.services.ProjectService;
|
||||||
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
|
import com.jsl.oa.utils.ErrorCode;
|
||||||
|
import com.jsl.oa.utils.Processing;
|
||||||
|
import com.jsl.oa.utils.ResultUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ProjectController {
|
public class ProjectController {
|
||||||
|
|
||||||
|
private final ProjectService projectService;
|
||||||
|
|
||||||
|
@PostMapping("/project/add")
|
||||||
|
public BaseResponse projectAdd(@RequestBody @Validated ProjectInfoVO projectAdd, BindingResult bindingResult){
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
|
}
|
||||||
|
return projectService.projectAdd(projectAdd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/project/edit")
|
||||||
|
public BaseResponse projectEdit(@RequestBody @Validated ProjectInfoVO projectEdit, BindingResult bindingResult){
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
|
}
|
||||||
|
return projectService.projectEdit(projectEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/project/cut/user")
|
||||||
|
public BaseResponse projectGetUserInCutting(@RequestParam Long uid){
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (uid == null) {
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
|
}
|
||||||
|
return projectService.projectGetUserInCutting(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/project/cut/user/add")
|
||||||
|
public BaseResponse projectAddUserForCutting(@RequestParam Long uid,@RequestParam Long pid){
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (uid == null || pid == null) {
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
|
}
|
||||||
|
return projectService.projectAddUserForCutting(uid,pid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,32 +18,30 @@ public class UserController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号删除
|
* 用户账号删除
|
||||||
* @param userDeleteVO
|
* @param id
|
||||||
* @param bindingResult
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PutMapping("/user/delete")
|
@PutMapping("/user/delete")
|
||||||
public BaseResponse userDelete(@RequestBody @Validated UserDeleteVO userDeleteVO, BindingResult bindingResult){
|
public BaseResponse userDelete(@RequestParam Long id){
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (bindingResult.hasErrors()) {
|
if (id == null) {
|
||||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
}
|
}
|
||||||
return userService.userDelete(userDeleteVO);
|
else return userService.userDelete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号锁定
|
* 用户账号锁定
|
||||||
* @param userLockVO
|
* @param id
|
||||||
* @param bindingResult
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PutMapping("/user/lock")
|
@PutMapping("/user/lock")
|
||||||
public BaseResponse userLock(@RequestBody @Validated UserLockVO userLockVO, BindingResult bindingResult){
|
public BaseResponse userLock(@RequestParam Long id){
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (bindingResult.hasErrors()) {
|
if (id == null) {
|
||||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
}
|
}
|
||||||
return userService.userLock(userLockVO);
|
return userService.userLock(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
38
src/main/java/com/jsl/oa/dao/ProjectDAO.java
Normal file
38
src/main/java/com/jsl/oa/dao/ProjectDAO.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package com.jsl.oa.dao;
|
||||||
|
|
||||||
|
import com.jsl.oa.mapper.ProjectMapper;
|
||||||
|
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
||||||
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ProjectDAO {
|
||||||
|
|
||||||
|
private final ProjectMapper projectMapper;
|
||||||
|
public void projectAdd(ProjectInfoVO projectAdd) {
|
||||||
|
projectMapper.projectAdd(projectAdd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void projectEdit(ProjectInfoVO projectEdit) {
|
||||||
|
projectMapper.projectEdit(projectEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExistProject(Long id) {
|
||||||
|
if(projectMapper.getProjectById(id)==null) {
|
||||||
|
return false;
|
||||||
|
}else return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProjectCuttingDO> projectGetUserInCutting(Long uid) {
|
||||||
|
return projectMapper.projectGetUserInCutting(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void projectAddUserForCutting(Long uid, Long pid) {
|
||||||
|
projectMapper.projectAddUserInCutting(uid,pid);
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,7 @@ package com.jsl.oa.dao;
|
|||||||
|
|
||||||
import com.jsl.oa.mapper.UserMapper;
|
import com.jsl.oa.mapper.UserMapper;
|
||||||
import com.jsl.oa.model.doData.UserDO;
|
import com.jsl.oa.model.doData.UserDO;
|
||||||
import com.jsl.oa.model.voData.UserDeleteVO;
|
|
||||||
import com.jsl.oa.model.voData.UserEditProfileVO;
|
import com.jsl.oa.model.voData.UserEditProfileVO;
|
||||||
import com.jsl.oa.model.voData.UserLockVO;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -46,18 +44,18 @@ public class UserDAO {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 用户账号删除
|
* 用户账号删除
|
||||||
* @param userDeleteVO
|
* @param id
|
||||||
*/
|
*/
|
||||||
public void userDelete(UserDeleteVO userDeleteVO) {
|
public void userDelete(Long id) {
|
||||||
userMapper.userDelete(userDeleteVO);
|
userMapper.userDelete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号锁定
|
* 用户账号锁定
|
||||||
* @param userLockVO
|
* @param id
|
||||||
*/
|
*/
|
||||||
public void userLock(UserLockVO userLockVO) {
|
public void userLock(Long id) {
|
||||||
userMapper.userLock(userLockVO);
|
userMapper.userLock(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void userEditProfile(UserEditProfileVO userEditProfileVO) {
|
public void userEditProfile(UserEditProfileVO userEditProfileVO) {
|
||||||
|
32
src/main/java/com/jsl/oa/mapper/ProjectMapper.java
Normal file
32
src/main/java/com/jsl/oa/mapper/ProjectMapper.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.jsl.oa.mapper;
|
||||||
|
|
||||||
|
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
||||||
|
import com.jsl.oa.model.doData.ProjectDO;
|
||||||
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ProjectMapper {
|
||||||
|
|
||||||
|
@Insert("insert into organize_oa.oa_project " +
|
||||||
|
"(name, description, introduction, core_code, git,type, reward) " +
|
||||||
|
"value (#{name},#{description},#{introduction},#{coreCode},#{git},#{type},#{reward})")
|
||||||
|
void projectAdd(ProjectInfoVO projectAdd);
|
||||||
|
|
||||||
|
|
||||||
|
void projectEdit(ProjectInfoVO projectEdit);
|
||||||
|
|
||||||
|
@Select("select * from organize_oa.oa_project where id=#{id}")
|
||||||
|
ProjectDO getProjectById(Long id);
|
||||||
|
|
||||||
|
@Select("select * from organize_oa.oa_project_cutting where id in" +
|
||||||
|
"(select pid from organize_oa.oa_project_user where uid=#{uid})")
|
||||||
|
List<ProjectCuttingDO> projectGetUserInCutting(Long uid);
|
||||||
|
|
||||||
|
@Insert("insert into organize_oa.oa_project_user(uid, pid)value (#{uid},#{pid})")
|
||||||
|
void projectAddUserInCutting(Long uid, Long pid);
|
||||||
|
}
|
@ -1,10 +1,7 @@
|
|||||||
package com.jsl.oa.mapper;
|
package com.jsl.oa.mapper;
|
||||||
|
|
||||||
import com.jsl.oa.model.doData.UserDO;
|
import com.jsl.oa.model.doData.UserDO;
|
||||||
import com.jsl.oa.model.voData.UserDeleteVO;
|
|
||||||
import com.jsl.oa.model.voData.UserEditProfileVO;
|
import com.jsl.oa.model.voData.UserEditProfileVO;
|
||||||
import com.jsl.oa.model.voData.UserLockVO;
|
|
||||||
import com.jsl.oa.model.voData.UserLoginVO;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
@ -25,10 +22,10 @@ public interface UserMapper {
|
|||||||
boolean insertUser(UserDO userDO);
|
boolean insertUser(UserDO userDO);
|
||||||
|
|
||||||
@Update("UPDATE organize_oa.oa_user SET enabled = 0 ,updated_at = CURRENT_TIMESTAMP WHERE id = #{id} ")
|
@Update("UPDATE organize_oa.oa_user SET enabled = 0 ,updated_at = CURRENT_TIMESTAMP WHERE id = #{id} ")
|
||||||
void userDelete(UserDeleteVO userDeleteVO);
|
void userDelete(Long id);
|
||||||
|
|
||||||
@Update("UPDATE organize_oa.oa_user SET account_no_locked = 1 ,updated_at = CURRENT_TIMESTAMP WHERE id = #{id} ")
|
@Update("UPDATE organize_oa.oa_user SET account_no_locked = 1 ,updated_at = CURRENT_TIMESTAMP WHERE id = #{id} ")
|
||||||
void userLock(UserLockVO userLockVO);
|
void userLock(Long id);
|
||||||
|
|
||||||
@Select("SELECT * FROM organize_oa.oa_user WHERE id = #{id}")
|
@Select("SELECT * FROM organize_oa.oa_user WHERE id = #{id}")
|
||||||
UserDO getUserById(Long id);
|
UserDO getUserById(Long id);
|
||||||
|
@ -21,7 +21,7 @@ public class ProjectDO {
|
|||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String introduction;
|
private String introduction;
|
||||||
private Boolean codeOpen;
|
private Short codeOpen;
|
||||||
private String coreCode;
|
private String coreCode;
|
||||||
private String git;
|
private String git;
|
||||||
private Short difficultyLevel;
|
private Short difficultyLevel;
|
||||||
|
42
src/main/java/com/jsl/oa/model/voData/ProjectInfoVO.java
Normal file
42
src/main/java/com/jsl/oa/model/voData/ProjectInfoVO.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package com.jsl.oa.model.voData;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProjectInfoVO {
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotBlank(message = "项目名不为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@NotBlank(message = "简介不能为空")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@NotBlank(message = "描述不能为空")
|
||||||
|
private String introduction;
|
||||||
|
|
||||||
|
//@NotNull(message = "填写是否开放")
|
||||||
|
private Short codeOpen;
|
||||||
|
|
||||||
|
private String coreCode;
|
||||||
|
|
||||||
|
private String git;
|
||||||
|
|
||||||
|
//@NotNull(message = "难度等级不能为空")
|
||||||
|
private Short difficultyLevel;
|
||||||
|
|
||||||
|
@NotNull(message = "项目类型不能为空")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private Long reward;
|
||||||
|
|
||||||
|
//@NotNull(message = "项目状态不能为空")
|
||||||
|
private Short status;
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
package com.jsl.oa.model.voData;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public class UserDeleteVO {
|
|
||||||
@NotNull(message = "id不能为空")
|
|
||||||
private Long id;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.jsl.oa.model.voData;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public class UserLockVO {
|
|
||||||
@NotNull(message = "id不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
}
|
|
14
src/main/java/com/jsl/oa/services/ProjectService.java
Normal file
14
src/main/java/com/jsl/oa/services/ProjectService.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.jsl.oa.services;
|
||||||
|
|
||||||
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
|
|
||||||
|
public interface ProjectService {
|
||||||
|
BaseResponse projectAdd(ProjectInfoVO projectAdd);
|
||||||
|
|
||||||
|
BaseResponse projectEdit(ProjectInfoVO projectEdit);
|
||||||
|
|
||||||
|
BaseResponse projectGetUserInCutting(Long uid);
|
||||||
|
|
||||||
|
BaseResponse projectAddUserForCutting(Long uid, Long pid);
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
package com.jsl.oa.services;
|
package com.jsl.oa.services;
|
||||||
|
|
||||||
import com.jsl.oa.model.doData.UserDO;
|
import com.jsl.oa.model.doData.UserDO;
|
||||||
import com.jsl.oa.model.voData.UserDeleteVO;
|
|
||||||
import com.jsl.oa.model.voData.UserEditProfileVO;
|
import com.jsl.oa.model.voData.UserEditProfileVO;
|
||||||
import com.jsl.oa.model.voData.UserLockVO;
|
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,17 +27,17 @@ public interface UserService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号删除
|
* 用户账号删除
|
||||||
* @param userDeleteVO
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BaseResponse userDelete(UserDeleteVO userDeleteVO);
|
BaseResponse userDelete(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号锁定
|
* 用户账号锁定
|
||||||
* @param userLockVO
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BaseResponse userLock(UserLockVO userLockVO);
|
BaseResponse userLock(Long id);
|
||||||
|
|
||||||
BaseResponse userEditProfile(UserEditProfileVO userEditProfileVO);
|
BaseResponse userEditProfile(UserEditProfileVO userEditProfileVO);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.jsl.oa.services.impl;
|
||||||
|
|
||||||
|
import com.jsl.oa.dao.ProjectDAO;
|
||||||
|
import com.jsl.oa.dao.UserDAO;
|
||||||
|
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
||||||
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
|
import com.jsl.oa.services.ProjectService;
|
||||||
|
import com.jsl.oa.services.UserService;
|
||||||
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
|
import com.jsl.oa.utils.ErrorCode;
|
||||||
|
import com.jsl.oa.utils.ResultUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ProjectServiceImpl implements ProjectService {
|
||||||
|
|
||||||
|
private final ProjectDAO projectDAO;
|
||||||
|
private final UserDAO userDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse projectAdd(ProjectInfoVO projectAdd) {
|
||||||
|
|
||||||
|
projectDAO.projectAdd(projectAdd);
|
||||||
|
return ResultUtil.success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse projectEdit(ProjectInfoVO projectEdit) {
|
||||||
|
//判断项目是否存在
|
||||||
|
if(projectDAO.isExistProject(projectEdit.getId())) {
|
||||||
|
projectDAO.projectEdit(projectEdit);
|
||||||
|
return ResultUtil.success("修改成功");
|
||||||
|
}else return ResultUtil.error(ErrorCode.PROJECT_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse projectGetUserInCutting(Long uid) {
|
||||||
|
if(userDAO.isExistUser(uid)) {
|
||||||
|
List<ProjectCuttingDO> projectCuttingDOList =projectDAO.projectGetUserInCutting(uid);
|
||||||
|
return ResultUtil.success(projectCuttingDOList);
|
||||||
|
}
|
||||||
|
else return ResultUtil.error(ErrorCode.USER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse projectAddUserForCutting(Long uid, Long pid) {
|
||||||
|
if(userDAO.isExistUser(uid)){
|
||||||
|
projectDAO.projectAddUserForCutting(uid,pid);
|
||||||
|
return ResultUtil.success();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -2,20 +2,15 @@ package com.jsl.oa.services.impl;
|
|||||||
|
|
||||||
import com.jsl.oa.dao.UserDAO;
|
import com.jsl.oa.dao.UserDAO;
|
||||||
import com.jsl.oa.model.doData.UserDO;
|
import com.jsl.oa.model.doData.UserDO;
|
||||||
import com.jsl.oa.model.voData.UserDeleteVO;
|
|
||||||
import com.jsl.oa.model.voData.UserEditProfileVO;
|
import com.jsl.oa.model.voData.UserEditProfileVO;
|
||||||
import com.jsl.oa.model.voData.UserLockVO;
|
|
||||||
import com.jsl.oa.services.UserService;
|
import com.jsl.oa.services.UserService;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
import com.jsl.oa.utils.ErrorCode;
|
import com.jsl.oa.utils.ErrorCode;
|
||||||
import com.jsl.oa.utils.ResultUtil;
|
import com.jsl.oa.utils.ResultUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserServiceImpl implements UserService {
|
public class UserServiceImpl implements UserService {
|
||||||
@ -28,25 +23,25 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse userDelete(UserDeleteVO userDeleteVO) {
|
public BaseResponse userDelete(Long id) {
|
||||||
//判断用户是否存在
|
//判断用户是否存在
|
||||||
if(userDAO.isExistUser(userDeleteVO.getId())) {
|
if(userDAO.isExistUser(id)){
|
||||||
userDAO.userDelete(userDeleteVO);
|
userDAO.userDelete(id);
|
||||||
return ResultUtil.success("删除成功");
|
return ResultUtil.success("删除成功");
|
||||||
}else return ResultUtil.error(ErrorCode.USER_NOT_EXIST);
|
}else return ResultUtil.error(ErrorCode.USER_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse userLock(@NotNull UserLockVO userLockVO) {
|
public BaseResponse userLock(Long id) {
|
||||||
//判断用户是否存在
|
//判断用户是否存在
|
||||||
if(userDAO.isExistUser(userLockVO.getId())) {
|
if(userDAO.isExistUser(id)) {
|
||||||
userDAO.userLock(userLockVO);
|
userDAO.userLock(id);
|
||||||
return ResultUtil.success("锁定成功");
|
return ResultUtil.success("锁定成功");
|
||||||
}else return ResultUtil.error(ErrorCode.USER_NOT_EXIST);
|
}else return ResultUtil.error(ErrorCode.USER_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse userEditProfile(@NotNull UserEditProfileVO userEditProfileVO) {
|
public BaseResponse userEditProfile(UserEditProfileVO userEditProfileVO) {
|
||||||
if(userDAO.isExistUser(userEditProfileVO.getId())) {
|
if(userDAO.isExistUser(userEditProfileVO.getId())) {
|
||||||
if(userEditProfileVO.getPassword()!=null) {
|
if(userEditProfileVO.getPassword()!=null) {
|
||||||
userEditProfileVO.setPassword(BCrypt.hashpw(userEditProfileVO.getPassword(), BCrypt.gensalt()));
|
userEditProfileVO.setPassword(BCrypt.hashpw(userEditProfileVO.getPassword(), BCrypt.gensalt()));
|
||||||
|
@ -16,7 +16,8 @@ public enum ErrorCode {
|
|||||||
EMAIL_LOGIN_NOT_SUPPORT("EmailLoginNotSupport", 40300, "请使用邮箱登陆"),
|
EMAIL_LOGIN_NOT_SUPPORT("EmailLoginNotSupport", 40300, "请使用邮箱登陆"),
|
||||||
DATABASE_INSERT_ERROR("DatabaseInsertError", 50010, "数据库插入错误"),
|
DATABASE_INSERT_ERROR("DatabaseInsertError", 50010, "数据库插入错误"),
|
||||||
DATABASE_UPDATE_ERROR("DatabaseUpdateError", 50011, "数据库更新错误"),
|
DATABASE_UPDATE_ERROR("DatabaseUpdateError", 50011, "数据库更新错误"),
|
||||||
DATABASE_DELETE_ERROR("DatabaseDeleteError", 50012, "数据库删除错误");
|
DATABASE_DELETE_ERROR("DatabaseDeleteError", 50012, "数据库删除错误"),
|
||||||
|
PROJECT_NOT_EXIST("ProjectNotExist", 40016, "项目不存在");
|
||||||
|
|
||||||
private final String output;
|
private final String output;
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
|
44
src/main/resources/com/jsl/oa/mapper/ProjectMapper.xml
Normal file
44
src/main/resources/com/jsl/oa/mapper/ProjectMapper.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?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.jsl.oa.mapper.ProjectMapper">
|
||||||
|
<update id="projectEdit">
|
||||||
|
update organize_oa.oa_project
|
||||||
|
<set>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
name = #{name},
|
||||||
|
</if>
|
||||||
|
<if test="description != null and description != ''">
|
||||||
|
description = #{description},
|
||||||
|
</if>
|
||||||
|
<if test="introduction != null and introduction != ''">
|
||||||
|
introduction = #{introduction},
|
||||||
|
</if>
|
||||||
|
<if test="codeOpen != null and codeOpen != ''">
|
||||||
|
code_open = #{codeOpen},
|
||||||
|
</if>
|
||||||
|
<if test="coreCode != null and coreCode != ''">
|
||||||
|
core_code = #{coreCode},
|
||||||
|
</if>
|
||||||
|
<if test="git != null and git != ''">
|
||||||
|
git = #{git},
|
||||||
|
</if>
|
||||||
|
<if test="difficultyLevel != null and difficultyLevel != ''">
|
||||||
|
difficulty_level = #{difficultyLevel},
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
type = #{type},
|
||||||
|
</if>
|
||||||
|
<if test="reward != null and reward != ''">
|
||||||
|
reward = #{reward},
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
status = #{status},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user