[新增]按id数组查询用户信息的接口
All checks were successful
CI / Docker-Build (push) Successful in 2m14s

This commit is contained in:
thesai 2024-09-24 16:43:07 +08:00
parent ac87b0dbe9
commit 235f4dce5b
3 changed files with 178 additions and 145 deletions

View File

@ -4,15 +4,25 @@ import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.user.*;
import club.joylink.rtss.vo.client.user.MobileInfoVO;
import club.joylink.rtss.vo.client.user.RetrievePwdVO;
import club.joylink.rtss.vo.client.user.UpdateEmailVO;
import club.joylink.rtss.vo.client.user.UpdateMobileVO;
import club.joylink.rtss.vo.client.user.UpdatePasswordVO;
import club.joylink.rtss.vo.user.AccountCreateVO;
import club.joylink.rtss.vo.user.AccountRegisterVO;
import club.joylink.rtss.vo.user.UserRegisterCheck;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统账户接口
@ -25,7 +35,8 @@ public class SysAccountController {
private ISysUserService iSysUserService;
@PostMapping("/register")
public void register(@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
public void register(
@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
this.iSysUserService.register(accountCreateVO);
}
@ -38,9 +49,9 @@ public class SysAccountController {
}
/**
*根据姓名或电话号查询用户
* 根据姓名或电话号查询用户
*/
@GetMapping(path="/nameOrMobile")
@GetMapping(path = "/nameOrMobile")
public List<AccountVO> queryUserByNameOrMobile(String query) {
List<AccountVO> list = this.iSysUserService.queryUserByNameOrMobile(query);
return list;
@ -63,7 +74,7 @@ public class SysAccountController {
}
/**
*根据用户id获取用户信息
* 根据用户id获取用户信息
*/
@GetMapping(path = "/{id}")
public AccountVO getUserBaseInfoById(@PathVariable Long id) {
@ -71,7 +82,7 @@ public class SysAccountController {
}
/**
*修改用户信息
* 修改用户信息
*/
@PutMapping(path = "/{id}")
public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) {
@ -79,7 +90,7 @@ public class SysAccountController {
}
/**
*微信关注事件
* 微信关注事件
*/
@GetMapping(path = "/wxsubscribe")
public void wxSubscribe(@RequestParam String wxId) {
@ -87,7 +98,7 @@ public class SysAccountController {
}
/**
*批量修改用户的openId为unionId
* 批量修改用户的openId为unionId
*/
@PutMapping(path = "/batchchange/unionid")
public void batchChangeOpenId2UnionId() {
@ -95,7 +106,7 @@ public class SysAccountController {
}
/**
*更新用户真实姓名
* 更新用户真实姓名
*/
@PutMapping(path = "/{id}/name")
public void updateName(@PathVariable Long id, String name) {
@ -103,7 +114,7 @@ public class SysAccountController {
}
/**
*更新用户昵称
* 更新用户昵称
*/
@PutMapping(path = "/{id}/nickname")
public void updateNickname(@PathVariable Long id, String nickname) {
@ -111,7 +122,7 @@ public class SysAccountController {
}
/**
*用户上传头像
* 用户上传头像
*/
@PostMapping(path = "/{id}/avatar")
public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) {
@ -119,7 +130,7 @@ public class SysAccountController {
}
/**
*发送手机验证码
* 发送手机验证码
*/
@PostMapping(path = "/mobile/code")
public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) {
@ -127,7 +138,7 @@ public class SysAccountController {
}
/**
*发送邮箱验证码
* 发送邮箱验证码
*/
@PostMapping(path = "/email/code")
public String sendEmailValidCode(String email) {
@ -135,26 +146,29 @@ public class SysAccountController {
}
/**
*更新用户手机号
* 更新用户手机号
*/
@PutMapping(path = "/{id}/mobile")
public void updateMobile(@PathVariable Long id, @RequestBody @Validated UpdateMobileVO updateMobileVO) {
public void updateMobile(@PathVariable Long id,
@RequestBody @Validated UpdateMobileVO updateMobileVO) {
this.iSysUserService.updateMobile(id, updateMobileVO);
}
/**
*更新用户邮箱
* 更新用户邮箱
*/
@PutMapping(path = "/{id}/email")
public void updateEmail(@PathVariable Long id, @RequestBody @Validated UpdateEmailVO updateEmailVO) {
public void updateEmail(@PathVariable Long id,
@RequestBody @Validated UpdateEmailVO updateEmailVO) {
this.iSysUserService.updateEmail(id, updateEmailVO);
}
/**
*更新用户登陆密码
* 更新用户登陆密码
*/
@PutMapping(path = "/{id}/password")
public void updatePassword(@PathVariable Long id, @RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
public void updatePassword(@PathVariable Long id,
@RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
this.iSysUserService.updatePassword(id, updatePasswordVO);
}
@ -162,7 +176,8 @@ public class SysAccountController {
* 按条件分页查询指定来源的账号
*/
@GetMapping("/page/criteria/{source}")
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) {
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO,
@PathVariable String source) {
queryVO.setSource(source);
return this.iSysUserService.queryPagedUser(queryVO);
}
@ -182,4 +197,12 @@ public class SysAccountController {
public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) {
iSysUserService.retrievePwd(vo);
}
/**
* 根据用户id列表获取用户信息
*/
@PostMapping("/list/ids")
public List<AccountVO> listByIds(@RequestBody List<Long> ids) {
return iSysUserService.listByIds(ids);
}
}

View File

@ -363,4 +363,6 @@ public interface ISysUserService {
boolean isSameMobileExist(String mobile);
boolean isSameEmailExist(String email);
List<AccountVO> listByIds(List<Long> ids);
}

View File

@ -1112,6 +1112,14 @@ public class SysUserService implements ISysUserService {
return sysAccountDAO.countByExample(example) > 0;
}
@Override
public List<AccountVO> listByIds(List<Long> ids) {
SysAccountExample example = new SysAccountExample();
example.createCriteria().andIdIn(ids);
List<SysAccount> sysAccounts = sysAccountDAO.selectByExample(example);
return AccountVO.convertFromDB(sysAccounts);
}
/**
* 查询包含组织信息的用户信息
*/