增加文档,调整目录结构
This commit is contained in:
parent
9b8708039a
commit
6719277a05
@ -0,0 +1,103 @@
|
|||||||
|
# 用户属性拓展
|
||||||
|
|
||||||
|
描述:拓展用户账号的属性,根据需要完善用户属性
|
||||||
|
|
||||||
|
## 如何实现
|
||||||
|
|
||||||
|
### 1. 创建实体类
|
||||||
|
|
||||||
|
继承`ink.wgink.pojo.dtos.user.UserDTO`
|
||||||
|
|
||||||
|
示例
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class UserExpandDTO extends UserDTO {
|
||||||
|
|
||||||
|
private String userExpandId;
|
||||||
|
// TODO 其他属性
|
||||||
|
|
||||||
|
public String getUserExpandId() {
|
||||||
|
return userExpandId == null ? "" : userExpandId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserExpandId(String userExpandId) {
|
||||||
|
this.userExpandId = userExpandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO get set
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 添加Dao层接口
|
||||||
|
|
||||||
|
接口中有数据持久化的方法
|
||||||
|
|
||||||
|
示例
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 添加Mapper
|
||||||
|
|
||||||
|
示例
|
||||||
|
|
||||||
|
```xml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 创建接口
|
||||||
|
|
||||||
|
创建的接口继承`ink.wgink.interfaces.user.IUserExpandBaseService`。
|
||||||
|
|
||||||
|
接口接收泛型`<UserExpandDTO extends UserDTO>`
|
||||||
|
|
||||||
|
接口中有如下方法
|
||||||
|
|
||||||
|
- getRoute:获取列表路径
|
||||||
|
- get:通过用户ID获取详情
|
||||||
|
- getByUsername:通过用户名获取详情
|
||||||
|
- listByUserIds:通过用户ID列表获取列表
|
||||||
|
- listByUsernames:通过用户名列表获取列表
|
||||||
|
- list:列表
|
||||||
|
- listPage:分页列表
|
||||||
|
- listPageByIds:通过用户ID列表获取分页列表
|
||||||
|
- listPageByExcludeIds:查询用户ID列表之外的分页列表
|
||||||
|
- countDateRange:统计开始与结束时间内的总量
|
||||||
|
- count:统计总量
|
||||||
|
- listByKeywords:通过关键字获取列表
|
||||||
|
|
||||||
|
根据业务添加对应的方法,如:update(更新)
|
||||||
|
|
||||||
|
示例
|
||||||
|
|
||||||
|
```java
|
||||||
|
public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param userExpandVO
|
||||||
|
*/
|
||||||
|
void update(String userId, UserExpandVO userExpandVO);
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 实现接口
|
||||||
|
|
||||||
|
根据需要实现对应的方法
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Service
|
||||||
|
public class UserExpandServiceImpl extends DefaultBaseService implements IUserExpandService {
|
||||||
|
|
||||||
|
// TODO 其他方法省略
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(String userId, UserExpandVO userExpandVO) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user