mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-07-14 06:06:38 +00:00
小说微服务开发完成,用户微服务开发中
This commit is contained in:
@ -4,11 +4,11 @@ package com.java2nb.novel.user.controller.api;
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户微服务API接口(内部调用)
|
||||
* @author xiongxiaoyang
|
||||
@ -33,6 +33,16 @@ public class UserApi {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名ID集合查询用户集合信息
|
||||
* @param ids 用户ID集合
|
||||
* @return 用户集合对象
|
||||
* */
|
||||
@GetMapping("queryById")
|
||||
List<User> queryById(@RequestBody List<Long> ids){
|
||||
return userService.queryById(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -5,6 +5,8 @@ import com.java2nb.novel.common.bean.UserDetails;
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.form.UserForm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务接口
|
||||
* @author xiongxiaoyang
|
||||
@ -29,4 +31,10 @@ public interface UserService {
|
||||
UserDetails login(UserForm form);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名ID集合查询用户集合信息
|
||||
* @param ids 用户ID集合
|
||||
* @return 用户集合对象
|
||||
* */
|
||||
List<User> queryById(List<Long> ids);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isIn;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
|
||||
/**
|
||||
@ -62,4 +63,14 @@ public class UserServiceImpl implements UserService {
|
||||
userDetails.setUsername(form.getUsername());
|
||||
return userDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> queryById(List<Long> ids) {
|
||||
return userMapper.selectMany(
|
||||
select(UserDynamicSqlSupport.id,UserDynamicSqlSupport.username,
|
||||
UserDynamicSqlSupport.userPhoto)
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.id,isIn(ids)).build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user