-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($auth-center): provide remote service for
api-portal
: get role…
… list
- Loading branch information
1 parent
71daf55
commit a472f46
Showing
18 changed files
with
503 additions
and
248 deletions.
There are no files selected for viewing
19 changes: 15 additions & 4 deletions
19
...oteapi/authcenter/user/UserRemoteApi.java → ...portal/remoteapi/AuthCenterRemoteApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
package com.jmsoftware.apiportal.remoteapi.authcenter.user; | ||
package com.jmsoftware.apiportal.remoteapi; | ||
|
||
import com.jmsoftware.common.bean.ResponseBodyBean; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdPayload; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdResponse; | ||
import com.jmsoftware.common.domain.authcenter.user.GetUserByLoginTokenPayload; | ||
import com.jmsoftware.common.domain.authcenter.user.GetUserByLoginTokenResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
/** | ||
* <h1>UserRemoteApi</h1> | ||
* <h1>AuthCenterRemoteApi</h1> | ||
* <p> | ||
* Change description here. | ||
* | ||
* @author Johnny Miller (鍾俊), email: johnnysviva@outlook.com | ||
* @date 5/10/20 4:50 PM | ||
*/ | ||
@FeignClient(name = "auth-center") | ||
public interface UserRemoteApi { | ||
public interface AuthCenterRemoteApi { | ||
/** | ||
* Gets user by login token. | ||
* | ||
* @param payload the payload | ||
* @return the user by login token | ||
*/ | ||
@PostMapping("/user/get-user-by-login-token") | ||
@PostMapping("/user-remote-api/get-user-by-login-token") | ||
ResponseBodyBean<GetUserByLoginTokenResponse> getUserByLoginToken(@RequestBody GetUserByLoginTokenPayload payload); | ||
|
||
/** | ||
* Gets role list by user id. | ||
* | ||
* @param payload the payload | ||
* @return the role list by user id | ||
*/ | ||
@PostMapping("/role-remote-api/get-role-list-by-user-id") | ||
ResponseBodyBean<GetRoleListByUserIdResponse> getRoleListByUserId(@RequestBody GetRoleListByUserIdPayload payload); | ||
} |
1 change: 0 additions & 1 deletion
1
api-portal/src/main/java/com/jmsoftware/apiportal/remoteapi/authcenter/package-info.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
auth-center/src/main/java/com/jmsoftware/authcenter/role/controller/RoleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jmsoftware.authcenter.role.controller; | ||
|
||
import com.jmsoftware.authcenter.role.entity.RolePersistence; | ||
import com.jmsoftware.authcenter.role.service.RoleService; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* <h1>RoleController</h1> | ||
* <p> | ||
* Controller implementation of Role.(Role) | ||
* | ||
* @author Johnny Miller (鍾俊) | ||
* @date 2020-05-10 22:39:51 | ||
*/ | ||
@RestController | ||
@RequestMapping("role") | ||
public class RoleController { | ||
@Resource | ||
private RoleService roleService; | ||
|
||
@GetMapping("selectOne") | ||
public RolePersistence selectOne(Long id) { | ||
return this.roleService.queryById(id); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
auth-center/src/main/java/com/jmsoftware/authcenter/role/entity/RolePersistence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.jmsoftware.authcenter.role.entity; | ||
|
||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
/** | ||
* Role.(Role) Persistence object class | ||
* | ||
* @author Johnny Miller (鍾俊) | ||
* @since 2020-05-10 22:39:45 | ||
*/ | ||
@Data | ||
public class RolePersistence implements Serializable { | ||
private static final long serialVersionUID = -81197803690669820L; | ||
/** | ||
* Primary key | ||
*/ | ||
private Long id; | ||
/** | ||
* Role name | ||
*/ | ||
private String name; | ||
/** | ||
* Role description | ||
*/ | ||
private String description; | ||
/** | ||
* Created time | ||
*/ | ||
private Date createdTime; | ||
/** | ||
* Modified time | ||
*/ | ||
private Date modifiedTime; | ||
} |
75 changes: 75 additions & 0 deletions
75
auth-center/src/main/java/com/jmsoftware/authcenter/role/mapper/RoleMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.jmsoftware.authcenter.role.mapper; | ||
|
||
import com.jmsoftware.authcenter.role.entity.RolePersistence; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Param; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* <h1>RoleMapper</h1> | ||
* <p> | ||
* Mapper of Role.(Role) | ||
* | ||
* @author Johnny Miller (鍾俊) | ||
* @date 2020 -05-10 22:39:48 | ||
*/ | ||
@Mapper | ||
public interface RoleMapper { | ||
/** | ||
* Query by id role. | ||
* | ||
* @param id the id | ||
* @return the role | ||
*/ | ||
RolePersistence queryById(Long id); | ||
|
||
/** | ||
* Query all by limit list. | ||
* | ||
* @param offset the offset | ||
* @param limit the limit | ||
* @return the list | ||
*/ | ||
List<RolePersistence> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); | ||
|
||
/** | ||
* Query all list. | ||
* | ||
* @param rolePersistence the role | ||
* @return the list | ||
*/ | ||
List<RolePersistence> queryAll(RolePersistence rolePersistence); | ||
|
||
/** | ||
* Insert int. | ||
* | ||
* @param rolePersistence the role | ||
* @return the int | ||
*/ | ||
int insert(RolePersistence rolePersistence); | ||
|
||
/** | ||
* Update int. | ||
* | ||
* @param rolePersistence the role | ||
* @return the int | ||
*/ | ||
int update(RolePersistence rolePersistence); | ||
|
||
/** | ||
* Delete by id int. | ||
* | ||
* @param id the id | ||
* @return the int | ||
*/ | ||
int deleteById(Long id); | ||
|
||
/** | ||
* Select role list by user id list. | ||
* | ||
* @param userId the user id | ||
* @return the list | ||
*/ | ||
List<RolePersistence> selectRoleListByUserId(Long userId); | ||
} |
35 changes: 35 additions & 0 deletions
35
auth-center/src/main/java/com/jmsoftware/authcenter/role/remote/RoleRemoteApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.jmsoftware.authcenter.role.remote; | ||
|
||
import com.jmsoftware.authcenter.role.service.RoleService; | ||
import com.jmsoftware.common.bean.ResponseBodyBean; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdPayload; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdResponse; | ||
import io.swagger.annotations.Api; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.validation.Valid; | ||
|
||
/** | ||
* <h1>RoleRemoteApiController</h1> | ||
* <p> | ||
* Change description here. | ||
* | ||
* @author Johnny Miller (鍾俊), email: johnnysviva@outlook.com | ||
* @date 5/10/20 10:43 PM | ||
**/ | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/role-remote-api") | ||
@Api(tags = {"Role Remote API Controller"}) | ||
public class RoleRemoteApiController { | ||
private final RoleService roleService; | ||
|
||
@PostMapping("/get-role-list-by-user-id") | ||
public ResponseBodyBean<GetRoleListByUserIdResponse> getRoleListByUserId(@Valid @RequestBody GetRoleListByUserIdPayload payload) { | ||
return ResponseBodyBean.ofSuccess(roleService.getRoleListByUserId(payload)); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
auth-center/src/main/java/com/jmsoftware/authcenter/role/service/RoleService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.jmsoftware.authcenter.role.service; | ||
|
||
import com.jmsoftware.authcenter.role.entity.RolePersistence; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdPayload; | ||
import com.jmsoftware.common.domain.authcenter.role.GetRoleListByUserIdResponse; | ||
import lombok.NonNull; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* <h1>RoleService</h1> | ||
* <p> | ||
* Service of Role.(Role) | ||
* | ||
* @author Johnny Miller (鍾俊) | ||
* @date 2020 -05-10 22:39:49 | ||
*/ | ||
public interface RoleService { | ||
/** | ||
* Query by ID | ||
* | ||
* @param id the primary key ID | ||
* @return the entity | ||
*/ | ||
RolePersistence queryById(Long id); | ||
|
||
/** | ||
* Gets role list by user id. | ||
* | ||
* @param payload the payload | ||
* @return the role list by user id | ||
*/ | ||
GetRoleListByUserIdResponse getRoleListByUserId(GetRoleListByUserIdPayload payload); | ||
|
||
/** | ||
* Gets role list by user id. | ||
* | ||
* @param userId the user id | ||
* @return the role list by user id | ||
*/ | ||
List<RolePersistence> getRoleListByUserId(@NonNull Long userId); | ||
|
||
/** | ||
* Query all by limit | ||
* | ||
* @param offset the offset | ||
* @param limit the limit | ||
* @return the entity list | ||
*/ | ||
List<RolePersistence> queryAllByLimit(int offset, int limit); | ||
|
||
/** | ||
* Insert | ||
* | ||
* @param rolePersistence the entity | ||
* @return the entity | ||
*/ | ||
RolePersistence insert(RolePersistence rolePersistence); | ||
|
||
/** | ||
* Update | ||
* | ||
* @param rolePersistence the entity | ||
* @return the entity | ||
*/ | ||
RolePersistence update(RolePersistence rolePersistence); | ||
|
||
/** | ||
* Delete by ID | ||
* | ||
* @param id the primary key ID | ||
* @return the boolean | ||
*/ | ||
boolean deleteById(Long id); | ||
} |
Oops, something went wrong.