提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.controller.admin.tenant.vo.tenant; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.ObjectUtil; |
|
4 |
import com.fasterxml.jackson.annotation.JsonIgnore; |
|
5 |
import io.swagger.v3.oas.annotations.media.Schema; |
|
6 |
import lombok.Data; |
|
7 |
import org.hibernate.validator.constraints.Length; |
|
8 |
|
|
9 |
import javax.validation.constraints.AssertTrue; |
|
10 |
import javax.validation.constraints.NotNull; |
|
11 |
import javax.validation.constraints.Pattern; |
|
12 |
import javax.validation.constraints.Size; |
|
13 |
import java.time.LocalDateTime; |
|
14 |
|
|
15 |
@Schema(description = "管理后台 - 租户创建/修改 Request VO") |
|
16 |
@Data |
|
17 |
public class TenantSaveReqVO { |
|
18 |
|
|
19 |
@Schema(description = "租户编号", example = "1024") |
|
20 |
private Long id; |
|
21 |
|
|
22 |
@Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "平台") |
|
23 |
@NotNull(message = "租户名不能为空") |
|
24 |
private String name; |
|
25 |
|
|
26 |
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "iailab") |
|
27 |
@NotNull(message = "联系人不能为空") |
|
28 |
private String contactName; |
|
29 |
|
|
30 |
@Schema(description = "联系手机", example = "15601691300") |
|
31 |
private String contactMobile; |
|
32 |
|
|
33 |
@Schema(description = "租户状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
|
34 |
@NotNull(message = "租户状态") |
|
35 |
private Integer status; |
|
36 |
|
|
37 |
@Schema(description = "绑定域名", example = "https://www.baidu.com") |
|
38 |
private String website; |
|
39 |
|
|
40 |
@Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
|
41 |
@NotNull(message = "租户套餐编号不能为空") |
|
42 |
private Long packageId; |
|
43 |
|
c37148
|
44 |
@Schema(description = "数据源", example = "1024") |
潘 |
45 |
@NotNull(message = "数据源") |
|
46 |
private Long dataSourceConfigId; |
|
47 |
|
e7c126
|
48 |
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) |
H |
49 |
@NotNull(message = "过期时间不能为空") |
|
50 |
private LocalDateTime expireTime; |
|
51 |
|
|
52 |
@Schema(description = "账号数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
|
53 |
@NotNull(message = "账号数量不能为空") |
|
54 |
private Integer accountCount; |
|
55 |
|
|
56 |
// ========== 仅【创建】时,需要传递的字段 ========== |
|
57 |
|
|
58 |
@Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "iailab") |
|
59 |
@Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") |
|
60 |
@Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") |
|
61 |
private String username; |
|
62 |
|
|
63 |
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") |
|
64 |
@Length(min = 4, max = 16, message = "密码长度为 4-16 位") |
|
65 |
private String password; |
|
66 |
|
|
67 |
@AssertTrue(message = "用户账号、密码不能为空") |
|
68 |
@JsonIgnore |
|
69 |
public boolean isUsernameValid() { |
|
70 |
return id != null // 修改时,不需要传递 |
|
71 |
|| (ObjectUtil.isAllNotEmpty(username, password)); // 新增时,必须都传递 username、password |
|
72 |
} |
|
73 |
|
|
74 |
} |