✨ 用户资料修改功能
This commit is contained in:
parent
cac7566c09
commit
07509807b9
@ -6,10 +6,13 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class UserInfoDTO implements Serializable {
|
public class UserInfoDTO implements Serializable {
|
||||||
|
|
||||||
private String idUser;
|
private Integer idUser;
|
||||||
|
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
@ -29,6 +32,8 @@ public class UserInfoDTO implements Serializable {
|
|||||||
|
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
|
private String signature;
|
||||||
|
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm")
|
@JSONField(format = "yyyy-MM-dd HH:mm")
|
||||||
private Date lastLoginTime;
|
private Date lastLoginTime;
|
||||||
|
|
||||||
|
@ -6,23 +6,104 @@ import com.rymcu.vertical.dto.UserInfoDTO;
|
|||||||
import com.rymcu.vertical.entity.User;
|
import com.rymcu.vertical.entity.User;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
public interface UserMapper extends Mapper<User> {
|
public interface UserMapper extends Mapper<User> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据账号获取获取用户信息
|
||||||
|
* @param account
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
User findByAccount(@Param("account") String account);
|
User findByAccount(@Param("account") String account);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户权限
|
||||||
|
* @param idUser
|
||||||
|
* @param idRole
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer insertUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
Integer insertUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据账号获取获取用户信息
|
||||||
|
* @param account
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
UserInfoDTO findUserInfoByAccount(@Param("account") String account);
|
UserInfoDTO findUserInfoByAccount(@Param("account") String account);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户昵称获取用户信息
|
||||||
|
* @param nickname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
UserDTO selectUserDTOByNickname(@Param("nickname") String nickname);
|
UserDTO selectUserDTOByNickname(@Param("nickname") String nickname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户密码
|
||||||
|
* @param account
|
||||||
|
* @param password
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer updatePasswordByAccount(@Param("account") String account, @Param("password") String password);
|
Integer updatePasswordByAccount(@Param("account") String account, @Param("password") String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户权限权重
|
||||||
|
* @param idUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer selectRoleWeightsByUser(@Param("idUser") Integer idUser);
|
Integer selectRoleWeightsByUser(@Param("idUser") Integer idUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户权限
|
||||||
|
* @param idUser
|
||||||
|
* @param idRole
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer updateUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
Integer updateUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户状态
|
||||||
|
* @param idUser
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer updateStatus(@Param("idUser") Integer idUser, @Param("status") String status);
|
Integer updateStatus(@Param("idUser") Integer idUser, @Param("status") String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据昵称获取重名用户数量
|
||||||
|
* @param nickname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer selectCountByNickName(@Param("nickname") String nickname);
|
Integer selectCountByNickName(@Param("nickname") String nickname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
* @param idUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
UserInfoDTO selectUserInfo(@Param("idUser") Integer idUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户信息
|
||||||
|
* @param idUser
|
||||||
|
* @param nickname
|
||||||
|
* @param avatarType
|
||||||
|
* @param avatarUrl
|
||||||
|
* @param email
|
||||||
|
* @param phone
|
||||||
|
* @param signature
|
||||||
|
* @param sex
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer updateUserInfo(@Param("idUser") Integer idUser, @Param("nickname") String nickname, @Param("avatarType") String avatarType, @Param("avatarUrl") String avatarUrl, @Param("email") String email, @Param("phone") String phone, @Param("signature") String signature, @Param("sex") String sex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证昵称是否重复
|
||||||
|
* @param idUser
|
||||||
|
* @param nickname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer checkNicknameByIdUser(@Param("idUser") Integer idUser, @Param("nickname") String nickname);
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package com.rymcu.vertical.service;
|
|||||||
|
|
||||||
import com.rymcu.vertical.core.service.Service;
|
import com.rymcu.vertical.core.service.Service;
|
||||||
import com.rymcu.vertical.dto.UserDTO;
|
import com.rymcu.vertical.dto.UserDTO;
|
||||||
|
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||||
import com.rymcu.vertical.entity.User;
|
import com.rymcu.vertical.entity.User;
|
||||||
import org.apache.ibatis.exceptions.TooManyResultsException;
|
import org.apache.ibatis.exceptions.TooManyResultsException;
|
||||||
|
|
||||||
@ -70,4 +71,26 @@ public interface UserService extends Service<User> {
|
|||||||
* @return Map
|
* @return Map
|
||||||
* */
|
* */
|
||||||
Map updateStatus(Integer idUser, String status);
|
Map updateStatus(Integer idUser, String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
* @param idUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map findUserInfo(Integer idUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户信息
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map updateUserInfo(UserInfoDTO user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证昵称是否重复
|
||||||
|
* @param idUser
|
||||||
|
* @param nickname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map checkNickname(Integer idUser, String nickname);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.rymcu.vertical.core.service.AbstractService;
|
|||||||
import com.rymcu.vertical.core.service.redis.RedisService;
|
import com.rymcu.vertical.core.service.redis.RedisService;
|
||||||
import com.rymcu.vertical.dto.TokenUser;
|
import com.rymcu.vertical.dto.TokenUser;
|
||||||
import com.rymcu.vertical.dto.UserDTO;
|
import com.rymcu.vertical.dto.UserDTO;
|
||||||
|
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||||
import com.rymcu.vertical.entity.Role;
|
import com.rymcu.vertical.entity.Role;
|
||||||
import com.rymcu.vertical.entity.User;
|
import com.rymcu.vertical.entity.User;
|
||||||
import com.rymcu.vertical.jwt.service.TokenManager;
|
import com.rymcu.vertical.jwt.service.TokenManager;
|
||||||
@ -12,6 +13,7 @@ import com.rymcu.vertical.mapper.UserMapper;
|
|||||||
import com.rymcu.vertical.service.UserService;
|
import com.rymcu.vertical.service.UserService;
|
||||||
import com.rymcu.vertical.util.BeanCopierUtil;
|
import com.rymcu.vertical.util.BeanCopierUtil;
|
||||||
import com.rymcu.vertical.util.Utils;
|
import com.rymcu.vertical.util.Utils;
|
||||||
|
import com.rymcu.vertical.web.api.common.UploadController;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.ibatis.exceptions.TooManyResultsException;
|
import org.apache.ibatis.exceptions.TooManyResultsException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -39,6 +41,8 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
@Resource
|
@Resource
|
||||||
private TokenManager tokenManager;
|
private TokenManager tokenManager;
|
||||||
|
|
||||||
|
private final static String avatarSvgType = "1";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User findByAccount(String account) throws TooManyResultsException{
|
public User findByAccount(String account) throws TooManyResultsException{
|
||||||
return userMapper.findByAccount(account);
|
return userMapper.findByAccount(account);
|
||||||
@ -133,7 +137,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map updateUserRole(Integer idUser, Integer idRole) {
|
public Map updateUserRole(Integer idUser, Integer idRole) {
|
||||||
Map map = new HashMap(1);
|
Map map = new HashMap(1);
|
||||||
Integer result = userMapper.updateUserRole(idUser,idRole);
|
Integer result = userMapper.updateUserRole(idUser,idRole);
|
||||||
@ -144,7 +148,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map updateStatus(Integer idUser, String status) {
|
public Map updateStatus(Integer idUser, String status) {
|
||||||
Map map = new HashMap(1);
|
Map map = new HashMap(1);
|
||||||
Integer result = userMapper.updateStatus(idUser,status);
|
Integer result = userMapper.updateStatus(idUser,status);
|
||||||
@ -153,4 +157,49 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map findUserInfo(Integer idUser) {
|
||||||
|
Map map = new HashMap(1);
|
||||||
|
UserInfoDTO user = userMapper.selectUserInfo(idUser);
|
||||||
|
if (user == null) {
|
||||||
|
map.put("message", "用户不存在!");
|
||||||
|
} else {
|
||||||
|
map.put("user", user);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map updateUserInfo(UserInfoDTO user) {
|
||||||
|
Map map = new HashMap(1);
|
||||||
|
Integer number = userMapper.checkNicknameByIdUser(user.getIdUser(), user.getNickname());
|
||||||
|
if (number > 0) {
|
||||||
|
map.put("message", "该昵称已使用!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(user.getAvatarType()) && avatarSvgType.equals(user.getAvatarType())) {
|
||||||
|
String avatarUrl = UploadController.uploadBase64File(user.getAvatarUrl(), 0);
|
||||||
|
user.setAvatarUrl(avatarUrl);
|
||||||
|
}
|
||||||
|
Integer result = userMapper.updateUserInfo(user.getIdUser(), user.getNickname(), user.getAvatarType(),user.getAvatarUrl(),
|
||||||
|
user.getEmail(),user.getPhone(),user.getSignature(), user.getSex());
|
||||||
|
if (result == 0) {
|
||||||
|
map.put("message", "操作失败!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
map.put("user",user);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map checkNickname(Integer idUser, String nickname) {
|
||||||
|
Map map = new HashMap(1);
|
||||||
|
Integer number = userMapper.checkNicknameByIdUser(idUser, nickname);
|
||||||
|
if (number > 0) {
|
||||||
|
map.put("message", "该昵称已使用!");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.rymcu.vertical.util.UserUtils;
|
|||||||
import com.rymcu.vertical.util.Utils;
|
import com.rymcu.vertical.util.Utils;
|
||||||
import com.rymcu.vertical.web.api.exception.ErrorCode;
|
import com.rymcu.vertical.web.api.exception.ErrorCode;
|
||||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -22,6 +23,10 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传控制器
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/upload")
|
@RequestMapping("/api/v1/upload")
|
||||||
public class UploadController {
|
public class UploadController {
|
||||||
@ -35,18 +40,7 @@ public class UploadController {
|
|||||||
if (multipartFile == null) {
|
if (multipartFile == null) {
|
||||||
return GlobalResultGenerator.genErrorResult("请选择要上传的文件");
|
return GlobalResultGenerator.genErrorResult("请选择要上传的文件");
|
||||||
}
|
}
|
||||||
String typePath = "";
|
String typePath = getTypePath(type);
|
||||||
switch (type){
|
|
||||||
case 0:
|
|
||||||
typePath = "avatar";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
typePath = "article";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
typePath = "tags";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//图片存储路径
|
//图片存储路径
|
||||||
String dir = ctxHeadPicPath+"/"+typePath;
|
String dir = ctxHeadPicPath+"/"+typePath;
|
||||||
File file = new File(dir);
|
File file = new File(dir);
|
||||||
@ -75,18 +69,7 @@ public class UploadController {
|
|||||||
|
|
||||||
@PostMapping("/file/batch")
|
@PostMapping("/file/batch")
|
||||||
public GlobalResult batchFileUpload(@RequestParam(value = "file[]", required = false)MultipartFile[] multipartFiles,@RequestParam(defaultValue = "1")Integer type,HttpServletRequest request){
|
public GlobalResult batchFileUpload(@RequestParam(value = "file[]", required = false)MultipartFile[] multipartFiles,@RequestParam(defaultValue = "1")Integer type,HttpServletRequest request){
|
||||||
String typePath = "";
|
String typePath = getTypePath(type);
|
||||||
switch (type){
|
|
||||||
case 0:
|
|
||||||
typePath = "avatar";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
typePath = "article";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
typePath = "tags";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//图片存储路径
|
//图片存储路径
|
||||||
String dir = ctxHeadPicPath+"/"+typePath;
|
String dir = ctxHeadPicPath+"/"+typePath;
|
||||||
File file = new File(dir);
|
File file = new File(dir);
|
||||||
@ -119,6 +102,24 @@ public class UploadController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(data);
|
return GlobalResultGenerator.genSuccessResult(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getTypePath(Integer type) {
|
||||||
|
String typePath;
|
||||||
|
switch (type){
|
||||||
|
case 0:
|
||||||
|
typePath = "avatar";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
typePath = "article";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
typePath = "tags";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
typePath = "images";
|
||||||
|
}
|
||||||
|
return typePath;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/simple/token")
|
@GetMapping("/simple/token")
|
||||||
public GlobalResult uploadSimpleToken(HttpServletRequest request) throws BaseApiException {
|
public GlobalResult uploadSimpleToken(HttpServletRequest request) throws BaseApiException {
|
||||||
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
|
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
|
||||||
@ -144,4 +145,29 @@ public class UploadController {
|
|||||||
map.put("uploadURL", UPLOAD_URL);
|
map.put("uploadURL", UPLOAD_URL);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String uploadBase64File(String fileStr, Integer type) {
|
||||||
|
if (StringUtils.isBlank(fileStr)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String typePath = getTypePath(type);
|
||||||
|
//图片存储路径
|
||||||
|
String dir = ctxHeadPicPath+"/"+typePath;
|
||||||
|
File file = new File(dir);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.mkdirs();// 创建文件根目录
|
||||||
|
}
|
||||||
|
|
||||||
|
String localPath = Utils.getProperty("resource.file-path")+"/"+typePath+"/";
|
||||||
|
String fileName = System.currentTimeMillis()+".png";
|
||||||
|
String savePath = file.getPath() + File.separator + fileName;
|
||||||
|
File saveFile = new File(savePath);
|
||||||
|
try {
|
||||||
|
FileCopyUtils.copy(Base64.decodeBase64(fileStr.substring(fileStr.indexOf(",") + 1)), saveFile);
|
||||||
|
fileStr = localPath+fileName;
|
||||||
|
} catch (IOException e) {
|
||||||
|
fileStr = "上传失败!";
|
||||||
|
}
|
||||||
|
return fileStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.rymcu.vertical.web.api.user;
|
||||||
|
|
||||||
|
import com.rymcu.vertical.core.result.GlobalResult;
|
||||||
|
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||||
|
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||||
|
import com.rymcu.vertical.service.UserService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/user-info")
|
||||||
|
public class UserInfoController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@GetMapping("/detail/{idUser}")
|
||||||
|
public GlobalResult detail(@PathVariable Integer idUser) {
|
||||||
|
Map map = userService.findUserInfo(idUser);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/check-nickname")
|
||||||
|
public GlobalResult checkNickname(@RequestParam Integer idUser, @RequestParam String nickname) {
|
||||||
|
Map map = userService.checkNickname(idUser,nickname);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/update")
|
||||||
|
public GlobalResult updateUserInfo(@RequestBody UserInfoDTO user) {
|
||||||
|
Map map = userService.updateUserInfo(user);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -21,6 +21,7 @@
|
|||||||
<result column="updated_time" property="updatedTime"/>
|
<result column="updated_time" property="updatedTime"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="UserInfoResultMapper" type="com.rymcu.vertical.dto.UserInfoDTO">
|
<resultMap id="UserInfoResultMapper" type="com.rymcu.vertical.dto.UserInfoDTO">
|
||||||
|
<result column="id" property="idUser"/>
|
||||||
<result column="account" property="account"/>
|
<result column="account" property="account"/>
|
||||||
<result column="nickname" property="nickname"/>
|
<result column="nickname" property="nickname"/>
|
||||||
<result column="sex" property="sex"/>
|
<result column="sex" property="sex"/>
|
||||||
@ -30,6 +31,7 @@
|
|||||||
<result column="phone" property="phone"/>
|
<result column="phone" property="phone"/>
|
||||||
<result column="status" property="status"/>
|
<result column="status" property="status"/>
|
||||||
<result column="last_login_time" property="lastLoginTime"/>
|
<result column="last_login_time" property="lastLoginTime"/>
|
||||||
|
<result column="signature" property="signature"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="DTOResultMapper" type="com.rymcu.vertical.dto.UserDTO">
|
<resultMap id="DTOResultMapper" type="com.rymcu.vertical.dto.UserDTO">
|
||||||
<result column="id" property="idUser"/>
|
<result column="id" property="idUser"/>
|
||||||
@ -50,12 +52,19 @@
|
|||||||
<update id="updateStatus">
|
<update id="updateStatus">
|
||||||
update vertical_user set status = #{status} where id = #{idUser}
|
update vertical_user set status = #{status} where id = #{idUser}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateUserInfo">
|
||||||
|
update vertical_user set nickname = #{nickname},email = #{email},signature = #{signature},avatar_type = #{avatarType},avatar_url = #{avatarUrl},sex = #{sex}
|
||||||
|
<if test="phone != null and phone != ''">
|
||||||
|
,phone = #{phone}
|
||||||
|
</if>
|
||||||
|
where id = #{idUser}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="findByAccount" resultMap="BaseResultMap">
|
<select id="findByAccount" resultMap="BaseResultMap">
|
||||||
select id, nickname, account, password, status from vertical_user where account = #{account} AND status = 0
|
select id, nickname, account, password, status from vertical_user where account = #{account} and status = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="findUserInfoByAccount" resultType="com.rymcu.vertical.dto.UserInfoDTO">
|
<select id="findUserInfoByAccount" resultMap="UserInfoResultMapper">
|
||||||
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, password, status, last_login_time from vertical_user when account = #{account}
|
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where account = #{account}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
||||||
select id, nickname, avatar_type, avatar_url, account from vertical_user where nickname = #{nickname} and status = 0
|
select id, nickname, avatar_type, avatar_url, account from vertical_user where nickname = #{nickname} and status = 0
|
||||||
@ -66,5 +75,11 @@
|
|||||||
<select id="selectCountByNickName" resultType="java.lang.Integer">
|
<select id="selectCountByNickName" resultType="java.lang.Integer">
|
||||||
select count(*) from vertical_user where nickname = #{nickname}
|
select count(*) from vertical_user where nickname = #{nickname}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectUserInfo" resultMap="UserInfoResultMapper">
|
||||||
|
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where id = #{idUser}
|
||||||
|
</select>
|
||||||
|
<select id="checkNicknameByIdUser" resultType="java.lang.Integer">
|
||||||
|
select count(*) from vertical_user where nickname = #{nickname} and id != #{idUser}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user