fix(entity): 按线上库结构重建实体,修复 prod 查询 500

- CodeGenerator 支持 CODEGEN_DB_BASE_URL/CODEGEN_SCHEMA_M0/M2/SVC
  环境变量覆盖(默认仍 dev 库),并开启文件覆盖
- m0/m2 实体按生产 xiaoqu_complex/xiaoqu_franchisee 重新生成:
  User 移除线上不存在的 emailMask/mobileEnc/mobileBidx/mobileMask/
  idcardEnc/idcardBidx/idcardMask/tenantResolveStatus/idcardResolveStatus
  等 9 个字段;Agent/Properyt 字段对齐线上实际列
- svc 实体无实质变化(Flyway 管理,各环境一致)
- 修复 /api/admin/users 在 prod 报 Unknown column 'email_mask' 的 500
This commit is contained in:
xiaoqu
2026-09-08 15:48:07 +08:00
parent 6b2edcf06c
commit b8cc1992b7
27 changed files with 125 additions and 178 deletions
@@ -15,7 +15,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -62,21 +62,11 @@ public class Agent implements Serializable {
*/
private String name;
/**
* 渠道编号(Z:总部;F:分公司;D:代理)
*/
private String channelNo;
/**
* 上级id
*/
private Long supervisorId;
/**
* 上级代理
*/
private String supervisorName;
/**
* 企业地址
*/
@@ -137,6 +127,11 @@ public class Agent implements Serializable {
*/
private Integer level;
/**
* 渠道编号(Z:总部;F:分公司;D:代理)
*/
private String channelNo;
/**
* 户名
*/
@@ -192,6 +187,36 @@ public class Agent implements Serializable {
*/
private String shortName;
/**
* 金蝶供应商编号
*/
private String supplierNo;
/**
* 开票通讯地址
*/
private String invoiceAddress;
/**
* 开票联系电话
*/
private String invoiceContact;
/**
* 组织内码
*/
private String saleOrgInternalId;
/**
* 客户分组
*/
private String custerGroupNo;
/**
* 金蝶内码
*/
private Long jindieInternalId;
/**
* 金蝶客户编号
*/
@@ -212,41 +237,16 @@ public class Agent implements Serializable {
*/
private String saleOrgId;
/**
* 金蝶内码
*/
private Long jindieInternalId;
/**
* 组织内码
*/
private String saleOrgInternalId;
/**
* 客户分组
*/
private String custerGroupNo;
/**
* 金蝶供应商编号
*/
private String supplierNo;
/**
* 开票通讯地址
*/
private String invoiceAddress;
/**
* 开票联系电话
*/
private String invoiceContact;
/**
* 金蝶客户名称
*/
private String jinideName;
/**
* 上级代理
*/
private String supervisorName;
/**
* 最后开票时间
*/
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -15,7 +15,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -15,7 +15,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -28,15 +28,10 @@ public class Properyt implements Serializable {
private Long id;
/**
* 销售id
* 创建id
*/
private Long createId;
/**
* 销售名称
*/
private String createName;
/**
* 创建时间
*/
@@ -62,11 +57,6 @@ public class Properyt implements Serializable {
*/
private Integer type;
/**
* 金蝶客户名称
*/
private String jinideName;
/**
* 企业名称
*/
@@ -77,11 +67,6 @@ public class Properyt implements Serializable {
*/
private Long agentId;
/**
* 代理名称
*/
private String agentName;
/**
* 企业地址
*/
@@ -178,14 +163,14 @@ public class Properyt implements Serializable {
private String invoiceName;
/**
* 金蝶客户编号
* 身份编码
*/
private String identifier;
/**
* 金蝶内码
* 金蝶客户名称
*/
private Long jindieInternalId;
private String jinideName;
/**
* 开票通讯地址
@@ -197,6 +182,21 @@ public class Properyt implements Serializable {
*/
private String invoiceContact;
/**
* 金蝶内码
*/
private Long jindieInternalId;
/**
* 销售名称
*/
private String createName;
/**
* 代理名称
*/
private String agentName;
/**
* 最后开票时间
*/
@@ -15,7 +15,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -43,7 +43,7 @@ public class User implements Serializable {
private Date modifyTime;
/**
* 数据状态(0:启用:1:删除)
* 数据状态
*/
private Integer softDelete;
@@ -72,6 +72,11 @@ public class User implements Serializable {
*/
private String password;
/**
* 代理ID
*/
private Long agentId;
/**
* 所属公司名称
*/
@@ -103,7 +108,7 @@ public class User implements Serializable {
private Integer approle;
/**
* 系统权限0:管理权限;1:普通权限
* 角色类别(管理员,主管,其他)
*/
private Integer roleType;
@@ -112,11 +117,6 @@ public class User implements Serializable {
*/
private Long districtId;
/**
* 代理ID
*/
private Long agentId;
/**
* 物业ID
*/
@@ -128,7 +128,7 @@ public class User implements Serializable {
private Long supervisorId;
/**
* 考勤状态0:上班;1:下班;2:请假;3休息
* 工作状态
*/
private Integer workStatus;
@@ -142,8 +142,6 @@ public class User implements Serializable {
*/
private String email;
private String emailMask;
/**
* 身份证号
*/
@@ -175,7 +173,7 @@ public class User implements Serializable {
private Integer backHardFlag;
/**
* 权限id
* 权限组id
*/
private Long authorityId;
@@ -227,7 +225,7 @@ public class User implements Serializable {
private String modifyName;
/**
* 物业权限id
* 物业平台权限组id
*/
private Long propertyAuthorityId;
@@ -237,48 +235,24 @@ public class User implements Serializable {
private String dingUserId;
/**
* 工作中状态0:作业;1:转场;2:空闲;3:休息
* 工作状态
*/
private Integer workAtStatus;
/**
* 年龄
*/
private Integer age;
/**
* 试用期保护0:未启用;1:启用
*/
private Integer probationProtection;
/**
* 备注
*/
private String note;
/**
* 上班时间
*/
private String onTime;
/**
* 下班时间
*/
private String offTime;
/**
* 出纸机权限
*/
private Integer czjAuth;
/**
* 空感权限
*/
private Integer kgAuth;
/**
* 信标权限
*/
private Integer xbAuth;
/**
@@ -311,16 +285,6 @@ public class User implements Serializable {
*/
private Integer productOpAuth;
/**
* 金蝶人员销售订单编号
*/
private String jindieSalerid;
/**
* 泡沫机APP显示0:关闭;1:打开;
*/
private Integer foamFunctionAuth;
/**
* 金蝶内码
*/
@@ -351,6 +315,16 @@ public class User implements Serializable {
*/
private Integer flowAuth;
/**
* 泡沫机APP显示0:关闭;1:打开;
*/
private Integer foamFunctionAuth;
/**
* 金蝶人员销售订单编号
*/
private String jindieSalerid;
/**
* xiaoqu-ai 用户ID
*/
@@ -360,44 +334,4 @@ public class User implements Serializable {
* 同步到 xiaoqu-ai 的时间
*/
private Date xiaoquAiSyncedAt;
/**
* 0待回填/1已解析/2歧义/3悬空;property_id非空→初始UPDATE=1
*/
private Byte tenantResolveStatus;
/**
* 0正常/1身份待核(冲突fail-closed锁B3人证比对;⊥tenant_resolve_status,不进PEP单路)
*/
private Byte idcardResolveStatus;
/**
* AES-256-GCM(IV‖ct‖tag);canonical后加密;明文绝不落盘
*/
private byte[] idcardEnc;
/**
* keyed HMAC-SHA256(canonical idcard);等值/dedup/唯一
*/
private byte[] idcardBidx;
/**
* 存储预算掩码 前3后4(默认零解密展示)
*/
private String idcardMask;
/**
* AES-256-GCM
*/
private byte[] mobileEnc;
/**
* keyed HMAC-SHA256(canonical mobile);等值查找(非唯一)
*/
private byte[] mobileBidx;
/**
* 展示掩码 前3后4
*/
private String mobileMask;
}
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -38,7 +38,7 @@ public class AdminUser implements Serializable {
private String account;
/**
* PBKDF2 加盐密码哈希
* PBKDF2 加盐密码哈希
*/
private String passwordHash;
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -48,7 +48,7 @@ public class AgentApiKey implements Serializable {
private String keyHash;
/**
* ak 明文 AES-GCM 加密密文(二次获取用),空=历史数据未存
* ak 明文 AES-GCM 加密密文(Base64: iv‖cipher‖tag),空=历史数据未存
*/
private String keyCipher;
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -16,7 +16,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -15,7 +15,7 @@ import java.util.Date;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
@Getter
@Setter
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m0.AgentManageDistrictAuth;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AgentManageDistrictAuthMapper extends BaseMapper<AgentManageDistrictAuth> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m0.Agent;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AgentMapper extends BaseMapper<Agent> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m0.Authority;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AuthorityMapper extends BaseMapper<Authority> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m0.Properyt;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface ProperytMapper extends BaseMapper<Properyt> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m0.User;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface UserMapper extends BaseMapper<User> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.m2.WarehouseAgentAuth;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface WarehouseAgentAuthMapper extends BaseMapper<WarehouseAgentAuth> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.AdminUser;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AdminUserMapper extends BaseMapper<AdminUser> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.AgentApiKey;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AgentApiKeyMapper extends BaseMapper<AgentApiKey> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.AgentScope;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AgentScopeMapper extends BaseMapper<AgentScope> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.AuditLog;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface AuditLogMapper extends BaseMapper<AuditLog> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.ScopeTool;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface ScopeToolMapper extends BaseMapper<ScopeTool> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.TokenScope;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface TokenScopeMapper extends BaseMapper<TokenScope> {
@@ -9,7 +9,7 @@ import me.iiv.agent.entity.svc.Tool;
* </p>
*
* @author codegen
* @since 2026-09-03
* @since 2026-09-08
*/
public interface ToolMapper extends BaseMapper<Tool> {
@@ -21,24 +21,35 @@ import java.util.Arrays;
* 运行方式:
* ./mvnw -q test-compile org.codehaus.mojo:exec-maven-plugin:3.5.0:java \
* -Dexec.mainClass=me.iiv.agent.codegen.CodeGenerator -Dexec.classpathScope=test
*
* 环境变量(按线上库生成时覆盖):
* CODEGEN_DB_BASE_URL 默认 jdbc:mysql://192.168.1.181:3306/(生产可走 SSH 隧道 jdbc:mysql://127.0.0.1:13306/)
* CODEGEN_SCHEMA_M0 默认 xiaoqu_comples_d(生产 xiaoqu_complex)
* CODEGEN_SCHEMA_M2 默认 xiaoqu_franchisee_d(生产 xiaoqu_franchisee)
* CODEGEN_SCHEMA_SVC 默认 xiaoqu_agent_svc_d(svc 表结构由 Flyway 管理,各环境一致,一般无需覆盖)
*/
public class CodeGenerator {
private static final String BASE_URL = "jdbc:mysql://192.168.1.181:3306/";
private static final String BASE_URL = envOr("CODEGEN_DB_BASE_URL", "jdbc:mysql://192.168.1.181:3306/");
private static final String URL_PARAMS = "?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true";
private static final String USERNAME = requiredEnv("CODEGEN_DB_USERNAME");
private static final String PASSWORD = requiredEnv("CODEGEN_DB_PASSWORD");
private static final String OUTPUT_DIR = System.getProperty("user.dir") + "/src/main/java";
public static void main(String[] args) {
generate("xiaoqu_comples_d", "m0",
generate(envOr("CODEGEN_SCHEMA_M0", "xiaoqu_comples_d"), "m0",
"user", "agent", "authority", "properyt", "agent_manage_district_auth");
generate("xiaoqu_franchisee_d", "m2",
generate(envOr("CODEGEN_SCHEMA_M2", "xiaoqu_franchisee_d"), "m2",
"warehouse_agent_auth");
generate("xiaoqu_agent_svc_d", "svc",
generate(envOr("CODEGEN_SCHEMA_SVC", "xiaoqu_agent_svc_d"), "svc",
"agent_api_key", "agent_scope", "tool", "scope_tool", "token_scope", "audit_log", "admin_user");
}
private static String envOr(String name, String defaultValue) {
String value = System.getenv(name);
return value == null || value.isBlank() ? defaultValue : value;
}
private static String requiredEnv(String name) {
String value = System.getenv(name);
if (value == null || value.isBlank()) {
@@ -64,8 +75,10 @@ public class CodeGenerator {
.addInclude(Arrays.asList(tables))
.entityBuilder()
.enableLombok()
.enableFileOverride()
.idType(IdType.AUTO)
.mapperBuilder()
.enableFileOverride()
.serviceBuilder()
.disableService()
.disableServiceImpl()