增加用户设置

This commit is contained in:
wanggeng 2021-11-12 17:59:19 +08:00
parent ec5d69fad2
commit 8f8e5231d2
3 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,52 @@
package cn.com.tenlion.usercenter.controller.app.api.userexpand;
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @ClassName: UserExpandController
* @Description: 用户拓展
* @Author: CodeFactory
* @Date: 2021-10-21 11:38:52
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "用户拓展接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/user-expand")
public class UserExpandAppController extends DefaultBaseController {
@Autowired
private IUserExpandService userExpandService;
@ApiOperation(value = "修改拓展属性", notes = "修改拓展属性接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "队伍类型ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{userId}")
@CheckRequestBodyAnnotation
public SuccessResult update(@PathVariable("userId") String userId, @RequestBody UserExpandVO userExpandVO) throws Exception {
userExpandService.update(userId, userExpandVO);
return new SuccessResult();
}
@ApiOperation(value = "拓展属性详情", notes = "拓展属性详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "teamTypeId", value = "队伍类型ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{userId}")
public UserExpandDTO get(@PathVariable("userId") String userId) {
return userExpandService.get(userId);
}
}

View File

@ -14,6 +14,10 @@ public class UserExpandDTO extends UserDTO {
private String areaCode;
private String areaName;
public void setUserDTO(UserDTO userDTO) {
super.setUserDTO(userDTO);
}
public String getAreaCode() {
return areaCode == null ? "" : areaCode.trim();
}

View File

@ -6,7 +6,10 @@ import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SearchException;
import ink.wgink.interfaces.user.IUserBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.map.HashMapUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,6 +28,8 @@ import java.util.Map;
@Service
public class UserExpandServiceImpl extends DefaultBaseService implements IUserExpandService {
@Autowired
private IUserBaseService userBaseService;
@Autowired
private IUserExpandDao userExpandDao;
@ -35,9 +40,18 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
@Override
public UserExpandDTO get(String userId) {
UserDTO userDTO = userBaseService.get(userId);
if (userDTO == null) {
throw new SearchException("用户不存在");
}
Map<String, Object> params = getHashMap(2);
params.put("userId", userId);
return userExpandDao.get(params);
UserExpandDTO userExpandDTO = userExpandDao.get(params);
if (userExpandDTO == null) {
userExpandDTO = new UserExpandDTO();
}
userExpandDTO.setUserDTO(userDTO);
return userExpandDTO;
}
@Override