Skip to content

Commit

Permalink
feat: 用户信息新增学校字段
Browse files Browse the repository at this point in the history
  • Loading branch information
juzi214032 committed Jul 26, 2020
1 parent 8170cd4 commit e4b2cc5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.juzi.oerp.model.dto.UpdateUserDTO;
import com.juzi.oerp.model.dto.param.PageParamDTO;
import com.juzi.oerp.model.vo.UserInfoVO;
import com.juzi.oerp.model.vo.response.DeleteResponseVO;
import com.juzi.oerp.model.vo.response.MessageResponseVO;
import com.juzi.oerp.model.vo.response.ResponseVO;
import com.juzi.oerp.service.UserService;
Expand Down Expand Up @@ -67,9 +66,9 @@ public ResponseVO<UserInfoVO> getUserByUserId(@PathVariable Integer userId) {
*/
@DeleteMapping("/{userId}")
@ApiOperation("删除用户")
public ResponseVO<Object> deleteUserByUserId(@PathVariable Integer userId) {
public MessageResponseVO deleteUserByUserId(@PathVariable Integer userId) {
userService.deleteUserByUserId(userId);
return new DeleteResponseVO();
return new MessageResponseVO(20012);
}

/**
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/com/juzi/oerp/controller/user/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.juzi.oerp.common.store.LocalUserStore;
import com.juzi.oerp.model.dto.UpdateUserInfoDTO;
import com.juzi.oerp.model.dto.param.PageParamDTO;
import com.juzi.oerp.model.dto.param.UpdateUserInfoParamDTO;
import com.juzi.oerp.model.po.UserInfoPO;
import com.juzi.oerp.model.po.UserPO;
import com.juzi.oerp.model.vo.UserInfoVO;
import com.juzi.oerp.model.vo.UserApplyExamVO;
import com.juzi.oerp.model.vo.UserInfoVO;
import com.juzi.oerp.model.vo.response.ResponseVO;
import com.juzi.oerp.model.vo.response.UpdatedResponseVO;
import com.juzi.oerp.service.UserInfoService;
Expand All @@ -26,7 +26,7 @@
* @author Juzi
* @date 2020/7/19 20:48
*/
@Api(tags = "用户信息")
@Api(tags = "个人中心")
@RequestMapping("/user")
@RestController("userUserController")
public class UserController {
Expand All @@ -38,7 +38,7 @@ public class UserController {
private UserService userService;

@GetMapping
@ApiOperation(value = "个人信息", notes = "获取当前已登录用户的个人信息")
@ApiOperation(value = "获取个人信息", notes = "获取当前已登录用户的个人信息")
public ResponseVO<UserInfoVO> getUserInfo() {
Integer userId = LocalUserStore.getLocalUser();
UserPO userPO = userService.getById(userId);
Expand All @@ -47,18 +47,19 @@ public ResponseVO<UserInfoVO> getUserInfo() {
}

@PutMapping
@ApiOperation(value = "修改个人信息")
public UpdatedResponseVO updateUserInfo(@RequestBody UpdateUserInfoDTO updateUserInfoDTO) {
@ApiOperation("修改个人信息")
public UpdatedResponseVO updateUserInfo(@RequestBody UpdateUserInfoParamDTO updateUserInfoParamDTO) {
Integer userId = LocalUserStore.getLocalUser();
UserInfoPO userInfoPO = new UserInfoPO();
userInfoPO.setUserId(userId);
BeanUtils.copyProperties(updateUserInfoDTO, userInfoPO);
BeanUtils.copyProperties(updateUserInfoParamDTO, userInfoPO);

userInfoService.updateById(userInfoPO);
return new UpdatedResponseVO();
}

@GetMapping("/apply")
@ApiOperation("获取报名信息")
public ResponseVO<Page<UserApplyExamVO>> getUserApplyExam(@RequestBody PageParamDTO pageParamDTO){
Page<UserApplyExamVO> result = userInfoService.queryUserApplyExam(pageParamDTO);
return new ResponseVO<>(result);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.juzi.oerp.model.dto;
package com.juzi.oerp.model.dto.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
Expand All @@ -12,7 +12,7 @@
*/
@Data
@ApiModel(description = "修改用户信息参数")
public class UpdateUserInfoDTO {
public class UpdateUserInfoParamDTO {

@ApiModelProperty("姓名")
private String name;
Expand All @@ -23,6 +23,9 @@ public class UpdateUserInfoDTO {
@ApiModelProperty("性别")
private Integer gender;

@ApiModelProperty("学校")
private String school;

@ApiModelProperty("学历")
private String education;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/juzi/oerp/model/po/UserInfoPO.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class UserInfoPO {
@ApiModelProperty("身份证号码")
private String identityNo;

@ApiModelProperty("学校")
private String school;

@ApiModelProperty("学历")
private String education;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/juzi/oerp/model/vo/UserInfoVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class UserInfoVO {
@ApiModelProperty("性别")
private Integer gender;

@ApiModelProperty("学校")
private String school;

@ApiModelProperty("学历")
private String education;

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/code-message.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ codeMessage[20008]=\u624B\u673A\u53F7\u6B63\u786E
codeMessage[20009]=\u624B\u673A\u53F7\u5DF2\u9A8C\u8BC1
codeMessage[20010]=\u4FEE\u6539\u6210\u529F
codeMessage[20011]=\u521B\u5EFA\u6210\u529F
codeMessage[20012]=\u5220\u9664\u6210\u529F


codeMessage[40001]=\u624B\u673A\u53F7\u5DF2\u88AB\u6CE8\u518C\uFF0C\u8BF7\u66F4\u6362\u624B\u673A\u53F7\u518D\u8BD5
Expand Down
41 changes: 22 additions & 19 deletions src/main/resources/mybatis/xml/dao/UserDAO.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
user_info.avatar_url,
user_info.`name`,
user_info.gender,
user_info.education,
user_info.school,
user_info.education,
user_info.identity_no,
user_info.birthday
FROM
Expand All @@ -31,26 +32,28 @@
<select id="getUserByUserId" resultType="com.juzi.oerp.model.vo.UserInfoVO">
SELECT
`user`.id AS userId,
`user`.username,
`user`.role,
`user`.`status`,
`user`.create_time,
`user`.update_time,
`user`.phone_number,
user_info.nickname,
user_info.avatar_url,
user_info.`name`,
user_info.gender,
user_info.identity_no,
user_info.birthday
`user`.username,
`user`.role,
`user`.`status`,
`user`.create_time,
`user`.update_time,
`user`.phone_number,
user_info.nickname,
user_info.avatar_url,
user_info.`name`,
user_info.gender,
user_info.school,
user_info.education,
user_info.identity_no,
user_info.birthday
FROM
`user`
LEFT JOIN
user_info
ON
`user`.id = user_info.user_id
`user`
LEFT JOIN
user_info
ON
`user`.id = user_info.user_id
WHERE
`user`.id = #{userId,jdbcType=INTEGER}
`user`.id = #{userId,jdbcType=INTEGER}
</select>
<select id="getUserApplyExam" resultType="com.juzi.oerp.model.vo.UserApplyExamVO">
SELECT
Expand Down

0 comments on commit e4b2cc5

Please sign in to comment.