forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
279 additions
and
10 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
...us-tenant/src/main/java/cn/iocoder/springboot/lab12/mybatis/dataobject/UserProfileDO.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,78 @@ | ||
package cn.iocoder.springboot.lab12.mybatis.dataobject; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableLogic; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
|
||
/** | ||
* 用户拓展 DO | ||
*/ | ||
@TableName(value = "user_profile") | ||
public class UserProfileDO { | ||
|
||
/** | ||
* 编号 | ||
*/ | ||
private Integer id; | ||
/** | ||
* 用户编号 | ||
*/ | ||
private Integer userId; | ||
/** | ||
* 性别 | ||
*/ | ||
private Integer gender; | ||
/** | ||
* 是否删除 | ||
*/ | ||
@TableLogic | ||
private Integer deleted; | ||
/** | ||
* 租户编号 | ||
*/ | ||
private Integer tenantId; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public UserProfileDO setId(Integer id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public Integer getGender() { | ||
return gender; | ||
} | ||
|
||
public UserProfileDO setGender(Integer gender) { | ||
this.gender = gender; | ||
return this; | ||
} | ||
|
||
public Integer getDeleted() { | ||
return deleted; | ||
} | ||
|
||
public UserProfileDO setDeleted(Integer deleted) { | ||
this.deleted = deleted; | ||
return this; | ||
} | ||
|
||
public Integer getTenantId() { | ||
return tenantId; | ||
} | ||
|
||
public UserProfileDO setTenantId(Integer tenantId) { | ||
this.tenantId = tenantId; | ||
return this; | ||
} | ||
|
||
public Integer getUserId() { | ||
return userId; | ||
} | ||
|
||
public UserProfileDO setUserId(Integer userId) { | ||
this.userId = userId; | ||
return this; | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
...us-tenant/src/main/java/cn/iocoder/springboot/lab12/mybatis/mapper/UserProfileMapper.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,9 @@ | ||
package cn.iocoder.springboot.lab12.mybatis.mapper; | ||
|
||
import cn.iocoder.springboot.lab12.mybatis.dataobject.UserProfileDO; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface UserProfileMapper extends BaseMapper<UserProfileDO> { | ||
} |
116 changes: 116 additions & 0 deletions
116
...ybatis-plus-tenant/src/main/java/cn/iocoder/springboot/lab12/mybatis/vo/UserDetailVO.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,116 @@ | ||
package cn.iocoder.springboot.lab12.mybatis.vo; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableLogic; | ||
|
||
import java.util.Date; | ||
|
||
public class UserDetailVO { | ||
|
||
/** | ||
* 用户编号 | ||
*/ | ||
private Integer id; | ||
/** | ||
* 账号 | ||
*/ | ||
private String username; | ||
/** | ||
* 密码(明文) | ||
* | ||
* ps:生产环境下,千万不要明文噢 | ||
*/ | ||
private String password; | ||
/** | ||
* 性别 | ||
*/ | ||
private Integer gender; | ||
/** | ||
* 创建时间 | ||
*/ | ||
private Date createTime; | ||
/** | ||
* 是否删除 | ||
*/ | ||
@TableLogic | ||
private Integer deleted; | ||
/** | ||
* 租户编号 | ||
*/ | ||
private Integer tenantId; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public UserDetailVO setId(Integer id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public UserDetailVO setUsername(String username) { | ||
this.username = username; | ||
return this; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public UserDetailVO setPassword(String password) { | ||
this.password = password; | ||
return this; | ||
} | ||
|
||
public Integer getGender() { | ||
return gender; | ||
} | ||
|
||
public UserDetailVO setGender(Integer gender) { | ||
this.gender = gender; | ||
return this; | ||
} | ||
|
||
public Date getCreateTime() { | ||
return createTime; | ||
} | ||
|
||
public UserDetailVO setCreateTime(Date createTime) { | ||
this.createTime = createTime; | ||
return this; | ||
} | ||
|
||
public Integer getDeleted() { | ||
return deleted; | ||
} | ||
|
||
public UserDetailVO setDeleted(Integer deleted) { | ||
this.deleted = deleted; | ||
return this; | ||
} | ||
|
||
public Integer getTenantId() { | ||
return tenantId; | ||
} | ||
|
||
public UserDetailVO setTenantId(Integer tenantId) { | ||
this.tenantId = tenantId; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "UserDetailVO{" + | ||
"id=" + id + | ||
", username='" + username + '\'' + | ||
", password='" + password + '\'' + | ||
", gender=" + gender + | ||
", createTime=" + createTime + | ||
", deleted=" + deleted + | ||
", tenantId=" + tenantId + | ||
'}'; | ||
} | ||
} |
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
30 changes: 20 additions & 10 deletions
30
lab-12-mybatis/lab-12-mybatis-plus-tenant/src/main/resources/sql/users.sql
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,10 +1,20 @@ | ||
CREATE TABLE `users` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
`username` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账号', | ||
`password` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '密码', | ||
`create_time` datetime DEFAULT NULL COMMENT '创建时间', | ||
`deleted` bit(1) DEFAULT NULL COMMENT '是否删除。0-未删除;1-删除', | ||
`tenant_id` int(11) NOT NULL COMMENT '租户编号', | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `idx_username` (`username`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
CREATE TABLE `users` | ||
( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
`username` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账号', | ||
`password` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '密码', | ||
`create_time` datetime DEFAULT NULL COMMENT '创建时间', | ||
`deleted` bit(1) DEFAULT NULL COMMENT '是否删除。0-未删除;1-删除', | ||
`tenant_id` int(11) NOT NULL COMMENT '租户编号', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
|
||
CREATE TABLE `user_profile` | ||
( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
`user_id` int(11) NOT NULL COMMENT '用户编号', | ||
`gender` int(11) NOT NULL COMMENT '性别', | ||
`deleted` bit(1) DEFAULT NULL COMMENT '是否删除。0-未删除;1-删除', | ||
`tenant_id` int(11) NOT NULL COMMENT '租户编号', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; |
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