chore(project): 删除项目中的所有文件
- 移除 .gitignore 配置文件 - 删除 Prettier 配置文件 - 删除 AdminApplications.vue 管理员应用页面组件 - 移除 API 服务配置文件 - 删除 App.vue 根组件 - 移除 applicationController API 接口定义 - 删除 bossApplicationDecisionController 决策控制器 - 移除 BossApplications.vue 招聘方应用页面 - 删除 BossCompany.vue 公司管理页面 - 移除 bossController API 控制器 - 删除 Bosses.vue 招聘方列表页面 - 移除 companyController 公司控制器 - 删除 Pinia 计数器存储 - 移除环境类型定义文件 - 删除 VSCode 扩展推荐配置 - 清空 HomeView.vue 首页组件
This commit is contained in:
@@ -15,6 +15,7 @@ import com.zds.boss.exception.BusinessException;
|
||||
import com.zds.boss.exception.ErrorCode;
|
||||
import com.zds.boss.exception.ThrowUtils;
|
||||
import com.zds.boss.model.dto.user.UserLoginRequest;
|
||||
import com.zds.boss.model.dto.user.UserProfileUpdateRequest;
|
||||
import com.zds.boss.model.dto.user.UserQueryRequest;
|
||||
import com.zds.boss.model.dto.user.UserRegisterRequest;
|
||||
import com.zds.boss.model.dto.user.UserUpdateRequest;
|
||||
@@ -156,6 +157,54 @@ public class UserController {
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/update/profile")
|
||||
public BaseResponse<Boolean> updateUserProfile(@RequestBody UserProfileUpdateRequest updateRequest, HttpServletRequest request) {
|
||||
ThrowUtils.throwIf(updateRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
boolean isAdmin = UserRoleEnum.ADMIN.getValue().equals(loginUser.getUserRole());
|
||||
|
||||
Long targetUserId = loginUser.getId();
|
||||
if (isAdmin && updateRequest.getId() != null && updateRequest.getId() > 0) {
|
||||
targetUserId = updateRequest.getId();
|
||||
}
|
||||
|
||||
User targetUser = userService.getById(targetUserId);
|
||||
ThrowUtils.throwIf(targetUser == null, ErrorCode.NOT_FOUND_ERROR);
|
||||
|
||||
User userToUpdate = new User();
|
||||
userToUpdate.setId(targetUserId);
|
||||
|
||||
if (updateRequest.getPhone() != null) {
|
||||
userToUpdate.setPhone(updateRequest.getPhone());
|
||||
}
|
||||
if (updateRequest.getEmail() != null) {
|
||||
userToUpdate.setEmail(updateRequest.getEmail());
|
||||
}
|
||||
if (updateRequest.getUserProfile() != null) {
|
||||
userToUpdate.setUserProfile(updateRequest.getUserProfile());
|
||||
}
|
||||
|
||||
if (updateRequest.getUserPassword() != null) {
|
||||
String newPassword = updateRequest.getUserPassword();
|
||||
if (newPassword.length() < 8 || newPassword.length() > 15) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户密码长度应为 8-15 位");
|
||||
}
|
||||
if (!isAdmin) {
|
||||
ThrowUtils.throwIf(updateRequest.getOldPassword() == null, ErrorCode.PARAMS_ERROR, "旧密码不能为空");
|
||||
String oldPasswordEncrypt = userService.getEncryptPassword(updateRequest.getOldPassword());
|
||||
if (!oldPasswordEncrypt.equals(targetUser.getUserPassword())) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "旧密码错误");
|
||||
}
|
||||
}
|
||||
userToUpdate.setUserPassword(userService.getEncryptPassword(newPassword));
|
||||
}
|
||||
|
||||
boolean result = userService.updateById(userToUpdate);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取用户封装列表
|
||||
*
|
||||
|
||||
@@ -1,8 +1,89 @@
|
||||
package com.zds.boss.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zds.boss.model.dto.application.ApplicationQueryRequest;
|
||||
import com.zds.boss.model.entity.Application;
|
||||
import com.zds.boss.model.vo.ApplicationVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface ApplicationMapper extends BaseMapper<Application> {
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select
|
||||
a.id,
|
||||
a.user_id as userId,
|
||||
u.username as userName,
|
||||
a.resume_id as resumeId,
|
||||
a.job_id as jobId,
|
||||
a.boss_id as bossId,
|
||||
a.status,
|
||||
a.applied_at as appliedAt,
|
||||
a.updated_at as updatedAt
|
||||
from application a
|
||||
left join user u on u.id = a.user_id
|
||||
<where>
|
||||
<if test="query != null and query.id != null">
|
||||
and a.id = #{query.id}
|
||||
</if>
|
||||
<if test="query != null and query.userId != null">
|
||||
and a.user_id = #{query.userId}
|
||||
</if>
|
||||
<if test="query != null and query.resumeId != null">
|
||||
and a.resume_id = #{query.resumeId}
|
||||
</if>
|
||||
<if test="query != null and query.jobId != null">
|
||||
and a.job_id = #{query.jobId}
|
||||
</if>
|
||||
<if test="query != null and query.bossId != null">
|
||||
and a.boss_id = #{query.bossId}
|
||||
</if>
|
||||
<if test="query != null and query.status != null">
|
||||
and a.status = #{query.status}
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'id' or query.sortField == 'a.id')">
|
||||
order by a.id
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'userId' or query.sortField == 'user_id' or query.sortField == 'a.user_id')">
|
||||
order by a.user_id
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'resumeId' or query.sortField == 'resume_id' or query.sortField == 'a.resume_id')">
|
||||
order by a.resume_id
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'jobId' or query.sortField == 'job_id' or query.sortField == 'a.job_id')">
|
||||
order by a.job_id
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'bossId' or query.sortField == 'boss_id' or query.sortField == 'a.boss_id')">
|
||||
order by a.boss_id
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'status' or query.sortField == 'a.status')">
|
||||
order by a.status
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'appliedAt' or query.sortField == 'applied_at' or query.sortField == 'a.applied_at')">
|
||||
order by a.applied_at
|
||||
</when>
|
||||
<when test="query != null and query.sortField != null and (query.sortField == 'updatedAt' or query.sortField == 'updated_at' or query.sortField == 'a.updated_at')">
|
||||
order by a.updated_at
|
||||
</when>
|
||||
<otherwise>
|
||||
order by a.applied_at
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="query != null and query.sortOrder != null and query.sortOrder == 'ascend'">
|
||||
asc
|
||||
</when>
|
||||
<otherwise>
|
||||
desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</script>
|
||||
""")
|
||||
IPage<ApplicationVO> selectApplicationVOByPage(Page<ApplicationVO> page, @Param("query") ApplicationQueryRequest query);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zds.boss.model.dto.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class UserProfileUpdateRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String oldPassword;
|
||||
|
||||
private String userPassword;
|
||||
|
||||
private String email;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String userProfile;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Date;
|
||||
public class ApplicationVO implements Serializable {
|
||||
private Long id;
|
||||
private Long userId;
|
||||
private String userName;
|
||||
private Long resumeId;
|
||||
private Long jobId;
|
||||
private Long bossId;
|
||||
|
||||
@@ -190,9 +190,8 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
|
||||
public Page<ApplicationVO> listApplicationVOByPage(ApplicationQueryRequest query) {
|
||||
long current = query.getCurrent();
|
||||
long size = query.getPageSize();
|
||||
Page<Application> page = this.page(new Page<>(current, size), getQueryWrapper(query));
|
||||
Page<ApplicationVO> voPage = new Page<>(current, size, page.getTotal());
|
||||
voPage.setRecords(getApplicationVOList(page.getRecords()));
|
||||
Page<ApplicationVO> voPage = new Page<>(current, size);
|
||||
this.baseMapper.selectApplicationVOByPage(voPage, query);
|
||||
return voPage;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user