feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>everything-is-suitable-db</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Everything Is Suitable DB</name>
|
||||
<description>Database access layer for Everything Is Suitable API</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-sys</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-statistics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>r2dbc-postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-database-postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.r2dbc</groupId>
|
||||
<artifactId>r2dbc-h2</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package io.destiny.db.config;
|
||||
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(FlywayProperties.class)
|
||||
@ConditionalOnProperty(prefix = "spring.flyway", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class FlywayConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FlywayConfig.class);
|
||||
|
||||
@Bean
|
||||
public Flyway flyway(FlywayProperties properties, Environment env) {
|
||||
String activeProfile = env.getProperty("spring.profiles.active", "");
|
||||
|
||||
if (!properties.isEnabled()) {
|
||||
log.info("Flyway is disabled, skipping initialization");
|
||||
return null;
|
||||
}
|
||||
|
||||
log.info("Initializing Flyway configuration...");
|
||||
|
||||
FluentConfiguration config = Flyway.configure()
|
||||
.baselineOnMigrate(properties.isBaselineOnMigrate())
|
||||
.baselineVersion(properties.getBaselineVersion())
|
||||
.validateOnMigrate(properties.isValidateOnMigrate())
|
||||
.cleanDisabled(properties.isCleanDisabled())
|
||||
.outOfOrder(properties.isOutOfOrder())
|
||||
.placeholderReplacement(properties.isPlaceholderReplacement());
|
||||
|
||||
if (activeProfile.contains("test")) {
|
||||
log.info("Test profile detected, using test-specific Flyway configuration");
|
||||
config.locations("classpath:db/migration");
|
||||
config.cleanDisabled(false);
|
||||
} else {
|
||||
config.locations(properties.getLocations());
|
||||
}
|
||||
|
||||
if (properties.getUrl() != null && properties.getUsername() != null && properties.getPassword() != null) {
|
||||
log.info("Using JDBC URL from spring.flyway configuration: {}", properties.getUrl());
|
||||
config.dataSource(properties.getUrl(), properties.getUsername(), properties.getPassword());
|
||||
} else {
|
||||
log.error("spring.flyway configuration is incomplete. Required: url, username, password");
|
||||
throw new IllegalStateException("Flyway configuration failed: No database connection available");
|
||||
}
|
||||
|
||||
Flyway flyway = config.load();
|
||||
|
||||
log.info("Starting Flyway migration...");
|
||||
try {
|
||||
flyway.migrate();
|
||||
log.info("Flyway migration completed successfully");
|
||||
} catch (Exception e) {
|
||||
log.error("Flyway migration failed", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return flyway;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package io.destiny.db.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "spring.flyway")
|
||||
public class FlywayProperties {
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
private String[] locations = new String[]{"classpath:db/migration"};
|
||||
|
||||
private boolean baselineOnMigrate = true;
|
||||
|
||||
private String baselineVersion = "0";
|
||||
|
||||
private boolean validateOnMigrate = false;
|
||||
|
||||
private boolean cleanDisabled = true;
|
||||
|
||||
private boolean outOfOrder = false;
|
||||
|
||||
private boolean placeholderReplacement = true;
|
||||
|
||||
private String url;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String[] getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
public void setLocations(String[] locations) {
|
||||
this.locations = locations;
|
||||
}
|
||||
|
||||
public boolean isBaselineOnMigrate() {
|
||||
return baselineOnMigrate;
|
||||
}
|
||||
|
||||
public void setBaselineOnMigrate(boolean baselineOnMigrate) {
|
||||
this.baselineOnMigrate = baselineOnMigrate;
|
||||
}
|
||||
|
||||
public String getBaselineVersion() {
|
||||
return baselineVersion;
|
||||
}
|
||||
|
||||
public void setBaselineVersion(String baselineVersion) {
|
||||
this.baselineVersion = baselineVersion;
|
||||
}
|
||||
|
||||
public boolean isValidateOnMigrate() {
|
||||
return validateOnMigrate;
|
||||
}
|
||||
|
||||
public void setValidateOnMigrate(boolean validateOnMigrate) {
|
||||
this.validateOnMigrate = validateOnMigrate;
|
||||
}
|
||||
|
||||
public boolean isCleanDisabled() {
|
||||
return cleanDisabled;
|
||||
}
|
||||
|
||||
public void setCleanDisabled(boolean cleanDisabled) {
|
||||
this.cleanDisabled = cleanDisabled;
|
||||
}
|
||||
|
||||
public boolean isOutOfOrder() {
|
||||
return outOfOrder;
|
||||
}
|
||||
|
||||
public void setOutOfOrder(boolean outOfOrder) {
|
||||
this.outOfOrder = outOfOrder;
|
||||
}
|
||||
|
||||
public boolean isPlaceholderReplacement() {
|
||||
return placeholderReplacement;
|
||||
}
|
||||
|
||||
public void setPlaceholderReplacement(boolean placeholderReplacement) {
|
||||
this.placeholderReplacement = placeholderReplacement;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package io.destiny.db.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.r2dbc.config.EnableR2dbcAuditing;
|
||||
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;
|
||||
import org.springframework.r2dbc.connection.R2dbcTransactionManager;
|
||||
import org.springframework.transaction.ReactiveTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.transaction.reactive.TransactionalOperator;
|
||||
|
||||
@Configuration
|
||||
@EnableR2dbcAuditing
|
||||
@EnableR2dbcRepositories(basePackages = {"io.destiny.db.repository", "io.destiny.client.core.repository", "io.destiny.db.dao"})
|
||||
@EnableTransactionManagement
|
||||
public class R2dbcConfig {
|
||||
|
||||
@Bean
|
||||
public ReactiveTransactionManager transactionManager(org.springframework.r2dbc.core.DatabaseClient databaseClient) {
|
||||
return new R2dbcTransactionManager(databaseClient.getConnectionFactory());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TransactionalOperator transactionalOperator(ReactiveTransactionManager transactionManager) {
|
||||
return TransactionalOperator.create(transactionManager);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.BirthInfoEntity;
|
||||
import io.destiny.biz.domain.BirthInfo;
|
||||
import io.destiny.biz.enums.EarthlyBranch;
|
||||
import io.destiny.biz.enums.HeavenlyStem;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BirthInfoConverter {
|
||||
|
||||
public BirthInfoEntity toEntity(BirthInfo domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
BirthInfoEntity entity = new BirthInfoEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setBirthTime(domain.getBirthTime());
|
||||
entity.setYearStem(domain.getYearStem() != null ? domain.getYearStem().name() : null);
|
||||
entity.setMonthStem(domain.getMonthStem() != null ? domain.getMonthStem().name() : null);
|
||||
entity.setDayStem(domain.getDayStem() != null ? domain.getDayStem().name() : null);
|
||||
entity.setHourStem(domain.getHourStem() != null ? domain.getHourStem().name() : null);
|
||||
entity.setYearBranch(domain.getYearBranch() != null ? domain.getYearBranch().name() : null);
|
||||
entity.setMonthBranch(domain.getMonthBranch() != null ? domain.getMonthBranch().name() : null);
|
||||
entity.setDayBranch(domain.getDayBranch() != null ? domain.getDayBranch().name() : null);
|
||||
entity.setHourBranch(domain.getHourBranch() != null ? domain.getHourBranch().name() : null);
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public BirthInfo toDomain(BirthInfoEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
BirthInfo domain = new BirthInfo();
|
||||
domain.setId(entity.getId());
|
||||
domain.setBirthTime(entity.getBirthTime());
|
||||
domain.setYearStem(entity.getYearStem() != null ? HeavenlyStem.valueOf(entity.getYearStem()) : null);
|
||||
domain.setMonthStem(entity.getMonthStem() != null ? HeavenlyStem.valueOf(entity.getMonthStem()) : null);
|
||||
domain.setDayStem(entity.getDayStem() != null ? HeavenlyStem.valueOf(entity.getDayStem()) : null);
|
||||
domain.setHourStem(entity.getHourStem() != null ? HeavenlyStem.valueOf(entity.getHourStem()) : null);
|
||||
domain.setYearBranch(entity.getYearBranch() != null ? EarthlyBranch.valueOf(entity.getYearBranch()) : null);
|
||||
domain.setMonthBranch(entity.getMonthBranch() != null ? EarthlyBranch.valueOf(entity.getMonthBranch()) : null);
|
||||
domain.setDayBranch(entity.getDayBranch() != null ? EarthlyBranch.valueOf(entity.getDayBranch()) : null);
|
||||
domain.setHourBranch(entity.getHourBranch() != null ? EarthlyBranch.valueOf(entity.getHourBranch()) : null);
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.client.core.domain.ClientLoginLog;
|
||||
import io.destiny.common.primitive.IpAddress;
|
||||
import io.destiny.db.entity.ClientLoginLogEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ClientLoginLogConverter {
|
||||
|
||||
public ClientLoginLog toDomain(ClientLoginLogEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
ClientLoginLog domain = new ClientLoginLog();
|
||||
domain.setId(entity.getId());
|
||||
domain.setClientUserId(entity.getClientUserId());
|
||||
domain.setIpAddress(IpAddress.of(entity.getIpAddress()));
|
||||
domain.setLoginTime(entity.getLoginTime());
|
||||
domain.setLogoutTime(entity.getLogoutTime());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
public ClientLoginLogEntity toEntity(ClientLoginLog domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
ClientLoginLogEntity entity = new ClientLoginLogEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setClientUserId(domain.getClientUserId());
|
||||
entity.setIpAddress(domain.getIpAddress() != null ? domain.getIpAddress().getValue() : null);
|
||||
entity.setLoginTime(domain.getLoginTime());
|
||||
entity.setLogoutTime(domain.getLogoutTime());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.client.core.domain.ClientUser;
|
||||
import io.destiny.common.primitive.EmailAddress;
|
||||
import io.destiny.common.primitive.PhoneNumber;
|
||||
import io.destiny.db.entity.ClientUserEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ClientUserConverter {
|
||||
|
||||
public ClientUserEntity toEntity(ClientUser domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
ClientUserEntity entity = new ClientUserEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUsername(domain.getUsername());
|
||||
entity.setPassword(domain.getPassword());
|
||||
entity.setEmail(domain.getEmail() != null ? domain.getEmail().getValue() : null);
|
||||
entity.setPhone(domain.getPhone() != null ? domain.getPhone().getValue() : null);
|
||||
entity.setGender(domain.getGender());
|
||||
entity.setBirthTime(domain.getBirthTime());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public ClientUser toDomain(ClientUserEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
ClientUser domain = new ClientUser();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUsername(entity.getUsername());
|
||||
domain.setPassword(entity.getPassword());
|
||||
domain.setEmail(entity.getEmail() != null ? EmailAddress.of(entity.getEmail()) : null);
|
||||
domain.setPhone(entity.getPhone() != null ? PhoneNumber.of(entity.getPhone()) : null);
|
||||
domain.setGender(entity.getGender());
|
||||
domain.setBirthTime(entity.getBirthTime());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.destiny.db.entity.DailyFortuneEntity;
|
||||
import io.destiny.biz.domain.DailyFortune;
|
||||
import io.destiny.biz.domain.PalaceFortune;
|
||||
import io.destiny.biz.enums.PalaceType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class DailyFortuneConverter {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public DailyFortuneConverter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public DailyFortuneEntity toEntity(DailyFortune domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
DailyFortuneEntity entity = new DailyFortuneEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUserId(domain.getUserId());
|
||||
entity.setFortuneDate(domain.getFortuneDate());
|
||||
entity.setOverallLuck(domain.getOverallLuck());
|
||||
entity.setOverallScore(domain.getOverallScore());
|
||||
entity.setPalaceFortunes(serializePalaceFortunes(domain.getPalaceFortunes()));
|
||||
entity.setCareerAdvice(domain.getCareerAdvice());
|
||||
entity.setWealthAdvice(domain.getWealthAdvice());
|
||||
entity.setRelationshipAdvice(domain.getRelationshipAdvice());
|
||||
entity.setHealthAdvice(domain.getHealthAdvice());
|
||||
entity.setLuckyColor(domain.getLuckyColor());
|
||||
entity.setLuckyNumber(domain.getLuckyNumber());
|
||||
entity.setLuckyDirection(domain.getLuckyDirection());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DailyFortune toDomain(DailyFortuneEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
DailyFortune domain = new DailyFortune();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUserId(entity.getUserId());
|
||||
domain.setFortuneDate(entity.getFortuneDate());
|
||||
domain.setOverallLuck(entity.getOverallLuck());
|
||||
domain.setOverallScore(entity.getOverallScore() != null ? entity.getOverallScore() : 0);
|
||||
domain.setPalaceFortunes(deserializePalaceFortunes(entity.getPalaceFortunes()));
|
||||
domain.setCareerAdvice(entity.getCareerAdvice());
|
||||
domain.setWealthAdvice(entity.getWealthAdvice());
|
||||
domain.setRelationshipAdvice(entity.getRelationshipAdvice());
|
||||
domain.setHealthAdvice(entity.getHealthAdvice());
|
||||
domain.setLuckyColor(entity.getLuckyColor());
|
||||
domain.setLuckyNumber(entity.getLuckyNumber());
|
||||
domain.setLuckyDirection(entity.getLuckyDirection());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
private String serializePalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
|
||||
if (palaceFortunes == null || palaceFortunes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(palaceFortunes);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<PalaceType, PalaceFortune> deserializePalaceFortunes(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<Map<PalaceType, PalaceFortune>>() {});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.ExportTaskEntity;
|
||||
import io.destiny.statistics.core.domain.ExportTask;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ExportTaskConverter {
|
||||
|
||||
public ExportTask toDomain(ExportTaskEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
ExportTask domain = new ExportTask();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUserId(entity.getUserId());
|
||||
domain.setType(entity.getType());
|
||||
domain.setFormat(entity.getFormat());
|
||||
domain.setStartDate(entity.getStartDate());
|
||||
domain.setEndDate(entity.getEndDate());
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setFileData(entity.getFileData());
|
||||
domain.setFilePath(entity.getFilePath());
|
||||
domain.setFileName(entity.getFileName());
|
||||
domain.setFileSize(entity.getFileSize());
|
||||
domain.setErrorMessage(entity.getErrorMessage());
|
||||
domain.setError(entity.getError());
|
||||
domain.setCompletedAt(entity.getCompletedAt());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
public ExportTaskEntity toEntity(ExportTask domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
ExportTaskEntity entity = new ExportTaskEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUserId(domain.getUserId());
|
||||
entity.setType(domain.getType());
|
||||
entity.setFormat(domain.getFormat());
|
||||
entity.setStartDate(domain.getStartDate());
|
||||
entity.setEndDate(domain.getEndDate());
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setFileData(domain.getFileData());
|
||||
entity.setFilePath(domain.getFilePath());
|
||||
entity.setFileName(domain.getFileName());
|
||||
entity.setFileSize(domain.getFileSize());
|
||||
entity.setErrorMessage(domain.getErrorMessage());
|
||||
entity.setError(domain.getError());
|
||||
entity.setCompletedAt(domain.getCompletedAt());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.destiny.db.entity.MonthlyFortuneEntity;
|
||||
import io.destiny.biz.domain.MonthlyFortune;
|
||||
import io.destiny.biz.domain.PalaceFortune;
|
||||
import io.destiny.biz.enums.PalaceType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class MonthlyFortuneConverter {
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public MonthlyFortuneConverter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public MonthlyFortuneEntity toEntity(MonthlyFortune domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
MonthlyFortuneEntity entity = new MonthlyFortuneEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUserId(domain.getUserId());
|
||||
entity.setFortuneMonth(domain.getFortuneMonth());
|
||||
entity.setOverallLuck(domain.getOverallLuck());
|
||||
entity.setOverallScore(domain.getOverallScore());
|
||||
entity.setPalaceFortunes(serializePalaceFortunes(domain.getPalaceFortunes()));
|
||||
entity.setCareerAdvice(domain.getCareerAdvice());
|
||||
entity.setWealthAdvice(domain.getWealthAdvice());
|
||||
entity.setRelationshipAdvice(domain.getRelationshipAdvice());
|
||||
entity.setHealthAdvice(domain.getHealthAdvice());
|
||||
entity.setLuckyColor(domain.getLuckyColor());
|
||||
entity.setLuckyNumber(domain.getLuckyNumber());
|
||||
entity.setLuckyDirection(domain.getLuckyDirection());
|
||||
entity.setKeyFocus(domain.getKeyFocus());
|
||||
entity.setCautionAdvice(domain.getCautionAdvice());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public MonthlyFortune toDomain(MonthlyFortuneEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
MonthlyFortune domain = new MonthlyFortune();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUserId(entity.getUserId());
|
||||
domain.setFortuneMonth(entity.getFortuneMonth());
|
||||
domain.setOverallLuck(entity.getOverallLuck());
|
||||
domain.setOverallScore(entity.getOverallScore() != null ? entity.getOverallScore() : 0);
|
||||
domain.setPalaceFortunes(deserializePalaceFortunes(entity.getPalaceFortunes()));
|
||||
domain.setCareerAdvice(entity.getCareerAdvice());
|
||||
domain.setWealthAdvice(entity.getWealthAdvice());
|
||||
domain.setRelationshipAdvice(entity.getRelationshipAdvice());
|
||||
domain.setHealthAdvice(entity.getHealthAdvice());
|
||||
domain.setLuckyColor(entity.getLuckyColor());
|
||||
domain.setLuckyNumber(entity.getLuckyNumber());
|
||||
domain.setLuckyDirection(entity.getLuckyDirection());
|
||||
domain.setKeyFocus(entity.getKeyFocus());
|
||||
domain.setCautionAdvice(entity.getCautionAdvice());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
private String serializePalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
|
||||
if (palaceFortunes == null || palaceFortunes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(palaceFortunes);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<PalaceType, PalaceFortune> deserializePalaceFortunes(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<Map<PalaceType, PalaceFortune>>() {});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.OperationLogEntity;
|
||||
import io.destiny.sys.core.domain.OperationLog;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OperationLogConverter {
|
||||
|
||||
public OperationLogEntity toEntity(OperationLog domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
OperationLogEntity entity = new OperationLogEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setOperationTime(domain.getOperationTime());
|
||||
entity.setModuleName(domain.getModuleName());
|
||||
entity.setOperationDesc(domain.getOperationDesc());
|
||||
entity.setOperator(domain.getOperator());
|
||||
entity.setRequestMethod(domain.getRequestMethod());
|
||||
entity.setRequestPath(domain.getRequestPath());
|
||||
entity.setRequestParams(domain.getRequestParams());
|
||||
entity.setResponseResult(domain.getResponseResult());
|
||||
entity.setIpAddress(domain.getIpAddress());
|
||||
entity.setExecutionTime(domain.getExecutionTime());
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setExceptionMessage(domain.getExceptionMessage());
|
||||
entity.setDiffJson(domain.getDiffJson());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public OperationLog toDomain(OperationLogEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
OperationLog domain = new OperationLog();
|
||||
domain.setId(entity.getId());
|
||||
domain.setOperationTime(entity.getOperationTime());
|
||||
domain.setModuleName(entity.getModuleName());
|
||||
domain.setOperationDesc(entity.getOperationDesc());
|
||||
domain.setOperator(entity.getOperator());
|
||||
domain.setRequestMethod(entity.getRequestMethod());
|
||||
domain.setRequestPath(entity.getRequestPath());
|
||||
domain.setRequestParams(entity.getRequestParams());
|
||||
domain.setResponseResult(entity.getResponseResult());
|
||||
domain.setIpAddress(entity.getIpAddress());
|
||||
domain.setExecutionTime(entity.getExecutionTime());
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setExceptionMessage(entity.getExceptionMessage());
|
||||
domain.setDiffJson(entity.getDiffJson());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.destiny.db.entity.PalaceEntity;
|
||||
import io.destiny.biz.domain.Palace;
|
||||
import io.destiny.biz.domain.StarInfo;
|
||||
import io.destiny.biz.enums.EarthlyBranch;
|
||||
import io.destiny.biz.enums.PalaceType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class PalaceConverter {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public PalaceConverter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public PalaceEntity toEntity(Palace domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
PalaceEntity entity = new PalaceEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setPalaceType(domain.getPalaceType() != null ? domain.getPalaceType().name() : null);
|
||||
entity.setEarthlyBranch(domain.getEarthlyBranch() != null ? domain.getEarthlyBranch().name() : null);
|
||||
entity.setMajorStars(serializeStars(domain.getMajorStars()));
|
||||
entity.setMinorStars(serializeStringList(domain.getMinorStars()));
|
||||
entity.setAnalysis(domain.getAnalysis());
|
||||
entity.setScore(domain.getScore());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Palace toDomain(PalaceEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
Palace domain = new Palace();
|
||||
domain.setId(entity.getId());
|
||||
domain.setPalaceType(entity.getPalaceType() != null ? PalaceType.valueOf(entity.getPalaceType()) : null);
|
||||
domain.setEarthlyBranch(
|
||||
entity.getEarthlyBranch() != null ? EarthlyBranch.valueOf(entity.getEarthlyBranch()) : null);
|
||||
domain.setMajorStars(deserializeStars(entity.getMajorStars()));
|
||||
domain.setMinorStars(deserializeStringList(entity.getMinorStars()));
|
||||
domain.setAnalysis(entity.getAnalysis());
|
||||
domain.setScore(entity.getScore() != null ? entity.getScore() : 0);
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
private String serializeStars(List<StarInfo> stars) {
|
||||
if (stars == null || stars.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(stars);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize stars", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<StarInfo> deserializeStars(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<List<StarInfo>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize stars", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String serializeStringList(List<String> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(list);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize string list", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> deserializeStringList(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<List<String>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize string list", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.client.core.domain.SmsVerificationCode;
|
||||
import io.destiny.db.entity.SmsVerificationCodeEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class SmsVerificationCodeConverter {
|
||||
|
||||
public SmsVerificationCodeEntity toEntity(SmsVerificationCode domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
SmsVerificationCodeEntity entity = new SmsVerificationCodeEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setPhone(domain.getPhone());
|
||||
entity.setCode(domain.getCode());
|
||||
entity.setType(domain.getType());
|
||||
entity.setExpireTime(domain.getExpireTime());
|
||||
entity.setVerified(domain.getVerified());
|
||||
entity.setVerifyCount(domain.getVerifyCount());
|
||||
entity.setCreatedAt(domain.getCreatedAt() != null ? domain.getCreatedAt() : LocalDateTime.now());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt() != null ? domain.getUpdatedAt() : LocalDateTime.now());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public SmsVerificationCode toDomain(SmsVerificationCodeEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
SmsVerificationCode domain = new SmsVerificationCode();
|
||||
domain.setId(entity.getId());
|
||||
domain.setPhone(entity.getPhone());
|
||||
domain.setCode(entity.getCode());
|
||||
domain.setType(entity.getType());
|
||||
domain.setExpireTime(entity.getExpireTime());
|
||||
domain.setVerified(entity.getVerified());
|
||||
domain.setVerifyCount(entity.getVerifyCount());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.client.core.domain.Subscription;
|
||||
import io.destiny.db.entity.SubscriptionEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SubscriptionConverter {
|
||||
|
||||
public Subscription toDomain(SubscriptionEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
Subscription domain = new Subscription();
|
||||
domain.setId(entity.getId());
|
||||
domain.setClientUserId(entity.getClientUserId());
|
||||
domain.setPlanType(entity.getPlanType());
|
||||
domain.setStartDate(entity.getStartDate());
|
||||
domain.setEndDate(entity.getEndDate());
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setAmount(entity.getAmount());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
public SubscriptionEntity toEntity(Subscription domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
SubscriptionEntity entity = new SubscriptionEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setClientUserId(domain.getClientUserId());
|
||||
entity.setPlanType(domain.getPlanType());
|
||||
entity.setStartDate(domain.getStartDate());
|
||||
entity.setEndDate(domain.getEndDate());
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setAmount(domain.getAmount());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.SysMenuEntity;
|
||||
import io.destiny.sys.core.domain.SysMenu;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SysMenuConverter {
|
||||
|
||||
public SysMenuEntity toEntity(SysMenu domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
SysMenuEntity entity = new SysMenuEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setMenuName(domain.getMenuName());
|
||||
entity.setParentId(domain.getParentId());
|
||||
entity.setOrderNum(domain.getOrderNum());
|
||||
entity.setMenuType(domain.getMenuType());
|
||||
entity.setPerms(domain.getPerms());
|
||||
entity.setComponent(domain.getComponent());
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setCreateBy(domain.getCreateBy());
|
||||
entity.setUpdateBy(domain.getUpdateBy());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public SysMenu toDomain(SysMenuEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
SysMenu domain = new SysMenu();
|
||||
domain.setId(entity.getId());
|
||||
domain.setMenuName(entity.getMenuName());
|
||||
domain.setParentId(entity.getParentId());
|
||||
domain.setOrderNum(entity.getOrderNum());
|
||||
domain.setMenuType(entity.getMenuType());
|
||||
domain.setPerms(entity.getPerms());
|
||||
domain.setComponent(entity.getComponent());
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setCreateBy(entity.getCreateBy());
|
||||
domain.setUpdateBy(entity.getUpdateBy());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.SysRoleEntity;
|
||||
import io.destiny.sys.core.domain.SysRole;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SysRoleConverter {
|
||||
|
||||
public SysRoleEntity toEntity(SysRole domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
SysRoleEntity entity = new SysRoleEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setRoleName(domain.getRoleName());
|
||||
entity.setRoleKey(domain.getRoleKey());
|
||||
entity.setRoleSort(domain.getRoleSort());
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setCreateBy(domain.getCreateBy());
|
||||
entity.setUpdateBy(domain.getUpdateBy());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public SysRole toDomain(SysRoleEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
SysRole domain = new SysRole();
|
||||
domain.setId(entity.getId());
|
||||
domain.setRoleName(entity.getRoleName());
|
||||
domain.setRoleKey(entity.getRoleKey());
|
||||
domain.setRoleSort(entity.getRoleSort());
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setCreateBy(entity.getCreateBy());
|
||||
domain.setUpdateBy(entity.getUpdateBy());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.db.entity.SysUserEntity;
|
||||
import io.destiny.sys.core.domain.SysUser;
|
||||
import io.destiny.common.primitive.PhoneNumber;
|
||||
import io.destiny.common.primitive.EmailAddress;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SysUserConverter {
|
||||
|
||||
public SysUserEntity toEntity(SysUser domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
SysUserEntity entity = new SysUserEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUsername(domain.getUsername());
|
||||
entity.setPassword(domain.getPassword());
|
||||
entity.setEmail(domain.getEmail() != null ? domain.getEmail().getValue() : null);
|
||||
entity.setPhone(domain.getPhone() != null ? domain.getPhone().getValue() : null);
|
||||
entity.setStatus(domain.getStatus());
|
||||
entity.setCreateBy(domain.getCreateBy());
|
||||
entity.setUpdateBy(domain.getUpdateBy());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public SysUser toDomain(SysUserEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
SysUser domain = new SysUser();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUsername(entity.getUsername());
|
||||
domain.setPassword(entity.getPassword());
|
||||
domain.setEmail(entity.getEmail() != null ? EmailAddress.of(entity.getEmail()) : null);
|
||||
domain.setPhone(entity.getPhone() != null ? PhoneNumber.of(entity.getPhone()) : null);
|
||||
domain.setStatus(entity.getStatus());
|
||||
domain.setCreateBy(entity.getCreateBy());
|
||||
domain.setUpdateBy(entity.getUpdateBy());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import io.destiny.client.core.domain.UserBinding;
|
||||
import io.destiny.db.entity.UserBindingEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class UserBindingConverter {
|
||||
|
||||
public UserBindingEntity toEntity(UserBinding domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
UserBindingEntity entity = new UserBindingEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUserId(domain.getUserId());
|
||||
entity.setPlatform(domain.getPlatform());
|
||||
entity.setPlatformOpenId(domain.getPlatformOpenId());
|
||||
entity.setPlatformUnionId(domain.getPlatformUnionId());
|
||||
entity.setCreatedAt(domain.getCreatedAt() != null ? domain.getCreatedAt() : LocalDateTime.now());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt() != null ? domain.getUpdatedAt() : LocalDateTime.now());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public UserBinding toDomain(UserBindingEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
UserBinding domain = new UserBinding();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUserId(entity.getUserId());
|
||||
domain.setPlatform(entity.getPlatform());
|
||||
domain.setPlatformOpenId(entity.getPlatformOpenId());
|
||||
domain.setPlatformUnionId(entity.getPlatformUnionId());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.destiny.db.entity.YearlyFortuneEntity;
|
||||
import io.destiny.biz.domain.YearlyFortune;
|
||||
import io.destiny.biz.domain.PalaceFortune;
|
||||
import io.destiny.biz.enums.PalaceType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class YearlyFortuneConverter {
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public YearlyFortuneConverter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public YearlyFortuneEntity toEntity(YearlyFortune domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
YearlyFortuneEntity entity = new YearlyFortuneEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setUserId(domain.getUserId());
|
||||
entity.setFortuneYear(domain.getFortuneYear());
|
||||
entity.setOverallLuck(domain.getOverallLuck());
|
||||
entity.setOverallScore(domain.getOverallScore());
|
||||
entity.setPalaceFortunes(serializePalaceFortunes(domain.getPalaceFortunes()));
|
||||
entity.setCareerAdvice(domain.getCareerAdvice());
|
||||
entity.setWealthAdvice(domain.getWealthAdvice());
|
||||
entity.setRelationshipAdvice(domain.getRelationshipAdvice());
|
||||
entity.setHealthAdvice(domain.getHealthAdvice());
|
||||
entity.setLuckyColor(domain.getLuckyColor());
|
||||
entity.setLuckyNumber(domain.getLuckyNumber());
|
||||
entity.setLuckyDirection(domain.getLuckyDirection());
|
||||
entity.setKeyFocus(domain.getKeyFocus());
|
||||
entity.setCautionAdvice(domain.getCautionAdvice());
|
||||
entity.setYearlyTheme(domain.getYearlyTheme());
|
||||
entity.setMajorOpportunity(domain.getMajorOpportunity());
|
||||
entity.setMajorChallenge(domain.getMajorChallenge());
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public YearlyFortune toDomain(YearlyFortuneEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
YearlyFortune domain = new YearlyFortune();
|
||||
domain.setId(entity.getId());
|
||||
domain.setUserId(entity.getUserId());
|
||||
domain.setFortuneYear(entity.getFortuneYear());
|
||||
domain.setOverallLuck(entity.getOverallLuck());
|
||||
domain.setOverallScore(entity.getOverallScore() != null ? entity.getOverallScore() : 0);
|
||||
domain.setPalaceFortunes(deserializePalaceFortunes(entity.getPalaceFortunes()));
|
||||
domain.setCareerAdvice(entity.getCareerAdvice());
|
||||
domain.setWealthAdvice(entity.getWealthAdvice());
|
||||
domain.setRelationshipAdvice(entity.getRelationshipAdvice());
|
||||
domain.setHealthAdvice(entity.getHealthAdvice());
|
||||
domain.setLuckyColor(entity.getLuckyColor());
|
||||
domain.setLuckyNumber(entity.getLuckyNumber());
|
||||
domain.setLuckyDirection(entity.getLuckyDirection());
|
||||
domain.setKeyFocus(entity.getKeyFocus());
|
||||
domain.setCautionAdvice(entity.getCautionAdvice());
|
||||
domain.setYearlyTheme(entity.getYearlyTheme());
|
||||
domain.setMajorOpportunity(entity.getMajorOpportunity());
|
||||
domain.setMajorChallenge(entity.getMajorChallenge());
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
private String serializePalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
|
||||
if (palaceFortunes == null || palaceFortunes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(palaceFortunes);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<PalaceType, PalaceFortune> deserializePalaceFortunes(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<Map<PalaceType, PalaceFortune>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize palaceFortunes", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package io.destiny.db.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.destiny.db.entity.ZiweiChartEntity;
|
||||
import io.destiny.biz.domain.ZiweiChart;
|
||||
import io.destiny.biz.enums.EarthlyBranch;
|
||||
import io.destiny.biz.enums.HeavenlyStem;
|
||||
import io.destiny.biz.util.PatternRecognitionUtil;
|
||||
import io.destiny.biz.util.SanFangSiZhengUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ZiweiChartConverter {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public ZiweiChartConverter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public ZiweiChartEntity toEntity(ZiweiChart domain) {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
ZiweiChartEntity entity = new ZiweiChartEntity();
|
||||
entity.setId(domain.getId());
|
||||
entity.setBirthInfoId(domain.getBirthInfo() != null ? domain.getBirthInfo().getId() : null);
|
||||
entity.setYearStem(domain.getYearStem() != null ? domain.getYearStem().name() : null);
|
||||
entity.setMingGongBranch(domain.getMingGongBranch() != null ? domain.getMingGongBranch().name() : null);
|
||||
entity.setShenGongBranch(domain.getShenGongBranch() != null ? domain.getShenGongBranch().name() : null);
|
||||
entity.setSummary(domain.getSummary());
|
||||
entity.setOverallLuck(domain.getOverallLuck());
|
||||
entity.setSanFangSiZheng(serializeSanFangSiZheng(domain.getSanFangSiZheng()));
|
||||
entity.setPatterns(serializePatterns(domain.getPatterns()));
|
||||
entity.setCreatedAt(domain.getCreatedAt());
|
||||
entity.setUpdatedAt(domain.getUpdatedAt());
|
||||
entity.setDeletedAt(domain.getDeletedAt());
|
||||
return entity;
|
||||
}
|
||||
|
||||
public ZiweiChart toDomain(ZiweiChartEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
ZiweiChart domain = new ZiweiChart();
|
||||
domain.setId(entity.getId());
|
||||
domain.setYearStem(entity.getYearStem() != null ? HeavenlyStem.valueOf(entity.getYearStem()) : null);
|
||||
domain.setMingGongBranch(entity.getMingGongBranch() != null ? EarthlyBranch.valueOf(entity.getMingGongBranch()) : null);
|
||||
domain.setShenGongBranch(entity.getShenGongBranch() != null ? EarthlyBranch.valueOf(entity.getShenGongBranch()) : null);
|
||||
domain.setSummary(entity.getSummary());
|
||||
domain.setOverallLuck(entity.getOverallLuck());
|
||||
domain.setSanFangSiZheng(deserializeSanFangSiZheng(entity.getSanFangSiZheng()));
|
||||
domain.setPatterns(deserializePatterns(entity.getPatterns()));
|
||||
domain.setCreatedAt(entity.getCreatedAt());
|
||||
domain.setUpdatedAt(entity.getUpdatedAt());
|
||||
domain.setDeletedAt(entity.getDeletedAt());
|
||||
return domain;
|
||||
}
|
||||
|
||||
private String serializeSanFangSiZheng(SanFangSiZhengUtil.SanFangSiZheng sanFangSiZheng) {
|
||||
if (sanFangSiZheng == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(sanFangSiZheng);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize sanFangSiZheng", e);
|
||||
}
|
||||
}
|
||||
|
||||
private SanFangSiZhengUtil.SanFangSiZheng deserializeSanFangSiZheng(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<SanFangSiZhengUtil.SanFangSiZheng>() {});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize sanFangSiZheng", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String serializePatterns(List<PatternRecognitionUtil.Pattern> patterns) {
|
||||
if (patterns == null || patterns.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsString(patterns);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to serialize patterns", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<PatternRecognitionUtil.Pattern> deserializePatterns(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<List<PatternRecognitionUtil.Pattern>>() {});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("Failed to deserialize patterns", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.BirthInfoEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface BirthInfoDao extends R2dbcRepository<BirthInfoEntity, Long> {
|
||||
Mono<BirthInfoEntity> findByBirthTimeAndDeletedAtIsNull(java.time.LocalDateTime birthTime);
|
||||
|
||||
Flux<BirthInfoEntity> findByYearBranchAndMonthBranchAndDayBranchAndHourBranchAndDeletedAtIsNull(String yearBranch,
|
||||
String monthBranch,
|
||||
String dayBranch, String hourBranch);
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.ClientLoginLogEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@Repository
|
||||
public interface ClientLoginLogDao extends R2dbcRepository<ClientLoginLogEntity, Long> {
|
||||
|
||||
Flux<ClientLoginLogEntity> findByClientUserIdAndDeletedAtIsNull(Long clientUserId);
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import io.destiny.db.entity.ClientUserEntity;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface ClientUserDao extends R2dbcRepository<ClientUserEntity, Long> {
|
||||
|
||||
Mono<ClientUserEntity> findByPhoneAndDeletedAtIsNull(String phone);
|
||||
|
||||
Mono<ClientUserEntity> findByUsernameAndDeletedAtIsNull(String username);
|
||||
|
||||
Mono<ClientUserEntity> findByWechatOpenIdAndDeletedAtIsNull(String wechatOpenId);
|
||||
|
||||
Mono<ClientUserEntity> findByDouyinOpenIdAndDeletedAtIsNull(String douyinOpenId);
|
||||
|
||||
Mono<ClientUserEntity> findByWechatUnionIdAndDeletedAtIsNull(String wechatUnionId);
|
||||
|
||||
Mono<ClientUserEntity> findByDouyinUnionIdAndDeletedAtIsNull(String douyinUnionId);
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.DailyFortuneEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Repository
|
||||
public interface DailyFortuneDao extends R2dbcRepository<DailyFortuneEntity, Long> {
|
||||
Mono<DailyFortuneEntity> findByUserIdAndFortuneDateAndDeletedAtIsNull(Long userId, LocalDate fortuneDate);
|
||||
|
||||
Flux<DailyFortuneEntity> findByUserIdAndDeletedAtIsNull(Long userId);
|
||||
|
||||
Flux<DailyFortuneEntity> findByFortuneDateAndDeletedAtIsNull(LocalDate fortuneDate);
|
||||
|
||||
Flux<DailyFortuneEntity> findByUserIdAndFortuneDateBetweenAndDeletedAtIsNull(Long userId, LocalDate startDate, LocalDate endDate);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.ExportTaskEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@Repository
|
||||
public interface ExportTaskDao extends R2dbcRepository<ExportTaskEntity, Long> {
|
||||
|
||||
Flux<ExportTaskEntity> findByUserIdAndDeletedAtIsNull(Long userId);
|
||||
|
||||
Flux<ExportTaskEntity> findByTypeAndDeletedAtIsNull(String type);
|
||||
|
||||
Flux<ExportTaskEntity> findByFormatAndDeletedAtIsNull(String format);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.MonthlyFortuneEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
@Repository
|
||||
public interface MonthlyFortuneDao extends R2dbcRepository<MonthlyFortuneEntity, Long> {
|
||||
Mono<MonthlyFortuneEntity> findByUserIdAndFortuneMonthAndDeletedAtIsNull(Long userId, YearMonth fortuneMonth);
|
||||
|
||||
Flux<MonthlyFortuneEntity> findByUserIdAndDeletedAtIsNull(Long userId);
|
||||
|
||||
Flux<MonthlyFortuneEntity> findByUserIdAndFortuneMonthBetweenAndDeletedAtIsNull(Long userId, YearMonth startMonth, YearMonth endMonth);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.OperationLogEntity;
|
||||
import org.springframework.data.r2dbc.repository.Query;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface OperationLogDao extends R2dbcRepository<OperationLogEntity, Long> {
|
||||
|
||||
@Query("SELECT * FROM sys_operation_log WHERE id = :id AND deleted_at IS NULL")
|
||||
Mono<OperationLogEntity> findByIdAndDeletedAtIsNull(Long id);
|
||||
|
||||
@Query("SELECT * FROM sys_operation_log WHERE deleted_at IS NULL " +
|
||||
"AND (:operator IS NULL OR operator = :operator) " +
|
||||
"AND (:moduleName IS NULL OR module_name = :moduleName) " +
|
||||
"AND (:status IS NULL OR status = :status) " +
|
||||
"AND (:startTime IS NULL OR operation_time >= :startTime) " +
|
||||
"AND (:endTime IS NULL OR operation_time <= :endTime) " +
|
||||
"ORDER BY operation_time DESC " +
|
||||
"LIMIT :pageSize OFFSET :offset")
|
||||
Flux<OperationLogEntity> findByConditions(String operator, String moduleName, String status,
|
||||
java.time.LocalDateTime startTime, java.time.LocalDateTime endTime,
|
||||
int pageSize, int offset);
|
||||
|
||||
@Query("SELECT COUNT(*) FROM sys_operation_log WHERE deleted_at IS NULL " +
|
||||
"AND (:operator IS NULL OR operator = :operator) " +
|
||||
"AND (:moduleName IS NULL OR module_name = :moduleName) " +
|
||||
"AND (:status IS NULL OR status = :status) " +
|
||||
"AND (:startTime IS NULL OR operation_time >= :startTime) " +
|
||||
"AND (:endTime IS NULL OR operation_time <= :endTime)")
|
||||
Mono<Long> countByConditions(String operator, String moduleName, String status,
|
||||
java.time.LocalDateTime startTime, java.time.LocalDateTime endTime);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.PalaceEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface PalaceDao extends R2dbcRepository<PalaceEntity, Long> {
|
||||
Flux<PalaceEntity> findByZiweiChartIdAndDeletedAtIsNull(Long ziweiChartId);
|
||||
|
||||
Mono<PalaceEntity> findByZiweiChartIdAndPalaceTypeAndDeletedAtIsNull(Long ziweiChartId, String palaceType);
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SmsVerificationCodeEntity;
|
||||
import org.springframework.data.r2dbc.repository.Query;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
public interface SmsVerificationCodeDao extends R2dbcRepository<SmsVerificationCodeEntity, Long> {
|
||||
|
||||
@Query("SELECT * FROM sms_verification_code WHERE phone = :phone AND type = :type AND deleted_at IS NULL ORDER BY created_at DESC LIMIT 1")
|
||||
Mono<SmsVerificationCodeEntity> findLatestByPhoneAndType(String phone, String type);
|
||||
|
||||
@Query("SELECT COUNT(*) FROM sms_verification_code WHERE phone = :phone AND created_at > :createdAt AND deleted_at IS NULL")
|
||||
Mono<Long> countByPhoneAndCreatedAtAfter(String phone, LocalDateTime createdAt);
|
||||
|
||||
@Query("DELETE FROM sms_verification_code WHERE expire_time < :expireTime")
|
||||
Mono<Integer> deleteExpiredBefore(LocalDateTime expireTime);
|
||||
|
||||
@Query("UPDATE sms_verification_code SET verified = TRUE, updated_at = :updatedAt WHERE id = :id")
|
||||
Mono<Void> markAsVerified(Long id, LocalDateTime updatedAt);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SubscriptionEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@Repository
|
||||
public interface SubscriptionDao extends R2dbcRepository<SubscriptionEntity, Long> {
|
||||
|
||||
Flux<SubscriptionEntity> findByStatusAndDeletedAtIsNull(String status);
|
||||
|
||||
Flux<SubscriptionEntity> findByClientUserIdAndDeletedAtIsNull(Long clientUserId);
|
||||
|
||||
Flux<SubscriptionEntity> findByPlanTypeAndDeletedAtIsNull(String planType);
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SysMenuEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SysMenuDao extends R2dbcRepository<SysMenuEntity, Long> {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SysRoleEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface SysRoleDao extends R2dbcRepository<SysRoleEntity, Long> {
|
||||
|
||||
Mono<SysRoleEntity> findByRoleKeyAndDeletedAtIsNull(String roleKey);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SysRoleMenuEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@Repository
|
||||
public interface SysRoleMenuDao extends R2dbcRepository<SysRoleMenuEntity, Long> {
|
||||
|
||||
Flux<SysRoleMenuEntity> findByRoleId(Long roleId);
|
||||
|
||||
Flux<SysRoleMenuEntity> findByMenuId(Long menuId);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SysUserEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface SysUserDao extends R2dbcRepository<SysUserEntity, Long> {
|
||||
|
||||
Mono<SysUserEntity> findByUsernameAndDeletedAtIsNull(String username);
|
||||
|
||||
Flux<SysUserEntity> findByDeletedAtIsNull();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.SysUserRoleEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@Repository
|
||||
public interface SysUserRoleDao extends R2dbcRepository<SysUserRoleEntity, Long> {
|
||||
|
||||
Flux<SysUserRoleEntity> findByUserId(Long userId);
|
||||
|
||||
Flux<SysUserRoleEntity> findByRoleId(Long roleId);
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.UserBindingEntity;
|
||||
import org.springframework.data.r2dbc.repository.Query;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
public interface UserBindingDao extends R2dbcRepository<UserBindingEntity, Long> {
|
||||
|
||||
@Query("SELECT * FROM user_binding WHERE user_id = :userId AND platform = :platform AND deleted_at IS NULL")
|
||||
Mono<UserBindingEntity> findByUserIdAndPlatformAndDeletedAtIsNull(Long userId, String platform);
|
||||
|
||||
@Query("SELECT * FROM user_binding WHERE platform = :platform AND platform_open_id = :platformOpenId AND deleted_at IS NULL")
|
||||
Mono<UserBindingEntity> findByPlatformAndOpenIdAndDeletedAtIsNull(String platform, String platformOpenId);
|
||||
|
||||
@Query("SELECT * FROM user_binding WHERE user_id = :userId AND deleted_at IS NULL")
|
||||
Flux<UserBindingEntity> findByUserIdAndDeletedAtIsNull(Long userId);
|
||||
|
||||
@Query("SELECT * FROM user_binding WHERE platform = :platform AND platform_union_id = :platformUnionId AND deleted_at IS NULL")
|
||||
Mono<UserBindingEntity> findByPlatformAndUnionIdAndDeletedAtIsNull(String platform, String platformUnionId);
|
||||
|
||||
@Query("UPDATE user_binding SET deleted_at = :deletedAt, updated_at = :updatedAt WHERE user_id = :userId AND platform = :platform")
|
||||
Mono<Integer> deleteByUserIdAndPlatform(Long userId, String platform, LocalDateTime deletedAt, LocalDateTime updatedAt);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.YearlyFortuneEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Year;
|
||||
|
||||
@Repository
|
||||
public interface YearlyFortuneDao extends R2dbcRepository<YearlyFortuneEntity, Long> {
|
||||
Mono<YearlyFortuneEntity> findByUserIdAndFortuneYearAndDeletedAtIsNull(Long userId, Year fortuneYear);
|
||||
|
||||
Flux<YearlyFortuneEntity> findByUserIdAndDeletedAtIsNull(Long userId);
|
||||
|
||||
Flux<YearlyFortuneEntity> findByUserIdAndFortuneYearBetweenAndDeletedAtIsNull(Long userId, Year startYear, Year endYear);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package io.destiny.db.dao;
|
||||
|
||||
import io.destiny.db.entity.ZiweiChartEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface ZiweiChartDao extends R2dbcRepository<ZiweiChartEntity, Long> {
|
||||
Mono<ZiweiChartEntity> findByBirthInfoIdAndDeletedAtIsNull(Long birthInfoId);
|
||||
|
||||
Flux<ZiweiChartEntity> findByYearStemAndDeletedAtIsNull(String yearStem);
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table
|
||||
public abstract class BaseEntity {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
@CreatedDate
|
||||
@Column("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@LastModifiedDate
|
||||
@Column("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Column("deleted_at")
|
||||
private LocalDateTime deletedAt;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getDeletedAt() {
|
||||
return deletedAt;
|
||||
}
|
||||
|
||||
public void setDeletedAt(LocalDateTime deletedAt) {
|
||||
this.deletedAt = deletedAt;
|
||||
}
|
||||
|
||||
}
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table("birth_info")
|
||||
public class BirthInfoEntity extends BaseEntity {
|
||||
|
||||
@Column("birth_time")
|
||||
private LocalDateTime birthTime;
|
||||
|
||||
@Column("year_stem")
|
||||
private String yearStem;
|
||||
|
||||
@Column("month_stem")
|
||||
private String monthStem;
|
||||
|
||||
@Column("day_stem")
|
||||
private String dayStem;
|
||||
|
||||
@Column("hour_stem")
|
||||
private String hourStem;
|
||||
|
||||
@Column("year_branch")
|
||||
private String yearBranch;
|
||||
|
||||
@Column("month_branch")
|
||||
private String monthBranch;
|
||||
|
||||
@Column("day_branch")
|
||||
private String dayBranch;
|
||||
|
||||
@Column("hour_branch")
|
||||
private String hourBranch;
|
||||
|
||||
@Column("year_palace_name")
|
||||
private String yearPalaceName;
|
||||
|
||||
@Column("year_palace_stars")
|
||||
private String yearPalaceStars;
|
||||
|
||||
@Column("month_palace_name")
|
||||
private String monthPalaceName;
|
||||
|
||||
@Column("month_palace_stars")
|
||||
private String monthPalaceStars;
|
||||
|
||||
@Column("day_palace_name")
|
||||
private String dayPalaceName;
|
||||
|
||||
@Column("day_palace_stars")
|
||||
private String dayPalaceStars;
|
||||
|
||||
@Column("hour_palace_name")
|
||||
private String hourPalaceName;
|
||||
|
||||
@Column("hour_palace_stars")
|
||||
private String hourPalaceStars;
|
||||
|
||||
public LocalDateTime getBirthTime() {
|
||||
return birthTime;
|
||||
}
|
||||
|
||||
public void setBirthTime(LocalDateTime birthTime) {
|
||||
this.birthTime = birthTime;
|
||||
}
|
||||
|
||||
public String getYearStem() {
|
||||
return yearStem;
|
||||
}
|
||||
|
||||
public void setYearStem(String yearStem) {
|
||||
this.yearStem = yearStem;
|
||||
}
|
||||
|
||||
public String getMonthStem() {
|
||||
return monthStem;
|
||||
}
|
||||
|
||||
public void setMonthStem(String monthStem) {
|
||||
this.monthStem = monthStem;
|
||||
}
|
||||
|
||||
public String getDayStem() {
|
||||
return dayStem;
|
||||
}
|
||||
|
||||
public void setDayStem(String dayStem) {
|
||||
this.dayStem = dayStem;
|
||||
}
|
||||
|
||||
public String getHourStem() {
|
||||
return hourStem;
|
||||
}
|
||||
|
||||
public void setHourStem(String hourStem) {
|
||||
this.hourStem = hourStem;
|
||||
}
|
||||
|
||||
public String getYearBranch() {
|
||||
return yearBranch;
|
||||
}
|
||||
|
||||
public void setYearBranch(String yearBranch) {
|
||||
this.yearBranch = yearBranch;
|
||||
}
|
||||
|
||||
public String getMonthBranch() {
|
||||
return monthBranch;
|
||||
}
|
||||
|
||||
public void setMonthBranch(String monthBranch) {
|
||||
this.monthBranch = monthBranch;
|
||||
}
|
||||
|
||||
public String getDayBranch() {
|
||||
return dayBranch;
|
||||
}
|
||||
|
||||
public void setDayBranch(String dayBranch) {
|
||||
this.dayBranch = dayBranch;
|
||||
}
|
||||
|
||||
public String getHourBranch() {
|
||||
return hourBranch;
|
||||
}
|
||||
|
||||
public void setHourBranch(String hourBranch) {
|
||||
this.hourBranch = hourBranch;
|
||||
}
|
||||
|
||||
public String getYearPalaceName() {
|
||||
return yearPalaceName;
|
||||
}
|
||||
|
||||
public void setYearPalaceName(String yearPalaceName) {
|
||||
this.yearPalaceName = yearPalaceName;
|
||||
}
|
||||
|
||||
public String getYearPalaceStars() {
|
||||
return yearPalaceStars;
|
||||
}
|
||||
|
||||
public void setYearPalaceStars(String yearPalaceStars) {
|
||||
this.yearPalaceStars = yearPalaceStars;
|
||||
}
|
||||
|
||||
public String getMonthPalaceName() {
|
||||
return monthPalaceName;
|
||||
}
|
||||
|
||||
public void setMonthPalaceName(String monthPalaceName) {
|
||||
this.monthPalaceName = monthPalaceName;
|
||||
}
|
||||
|
||||
public String getMonthPalaceStars() {
|
||||
return monthPalaceStars;
|
||||
}
|
||||
|
||||
public void setMonthPalaceStars(String monthPalaceStars) {
|
||||
this.monthPalaceStars = monthPalaceStars;
|
||||
}
|
||||
|
||||
public String getDayPalaceName() {
|
||||
return dayPalaceName;
|
||||
}
|
||||
|
||||
public void setDayPalaceName(String dayPalaceName) {
|
||||
this.dayPalaceName = dayPalaceName;
|
||||
}
|
||||
|
||||
public String getDayPalaceStars() {
|
||||
return dayPalaceStars;
|
||||
}
|
||||
|
||||
public void setDayPalaceStars(String dayPalaceStars) {
|
||||
this.dayPalaceStars = dayPalaceStars;
|
||||
}
|
||||
|
||||
public String getHourPalaceName() {
|
||||
return hourPalaceName;
|
||||
}
|
||||
|
||||
public void setHourPalaceName(String hourPalaceName) {
|
||||
this.hourPalaceName = hourPalaceName;
|
||||
}
|
||||
|
||||
public String getHourPalaceStars() {
|
||||
return hourPalaceStars;
|
||||
}
|
||||
|
||||
public void setHourPalaceStars(String hourPalaceStars) {
|
||||
this.hourPalaceStars = hourPalaceStars;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table("client_login_log")
|
||||
public class ClientLoginLogEntity extends BaseEntity {
|
||||
|
||||
@Column("client_user_id")
|
||||
private Long clientUserId;
|
||||
|
||||
@Column("ip_address")
|
||||
private String ipAddress;
|
||||
|
||||
@Column("login_time")
|
||||
private LocalDateTime loginTime;
|
||||
|
||||
@Column("logout_time")
|
||||
private LocalDateTime logoutTime;
|
||||
|
||||
public Long getClientUserId() {
|
||||
return clientUserId;
|
||||
}
|
||||
|
||||
public void setClientUserId(Long clientUserId) {
|
||||
this.clientUserId = clientUserId;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public LocalDateTime getLoginTime() {
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(LocalDateTime loginTime) {
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getLogoutTime() {
|
||||
return logoutTime;
|
||||
}
|
||||
|
||||
public void setLogoutTime(LocalDateTime logoutTime) {
|
||||
this.logoutTime = logoutTime;
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table("client_user")
|
||||
public class ClientUserEntity extends BaseEntity {
|
||||
|
||||
@Column("username")
|
||||
private String username;
|
||||
|
||||
@Column("password")
|
||||
private String password;
|
||||
|
||||
@Column("email")
|
||||
private String email;
|
||||
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
|
||||
@Column("gender")
|
||||
private String gender;
|
||||
|
||||
@Column("birth_time")
|
||||
private LocalDateTime birthTime;
|
||||
|
||||
@Column("wechat_open_id")
|
||||
private String wechatOpenId;
|
||||
|
||||
@Column("wechat_union_id")
|
||||
private String wechatUnionId;
|
||||
|
||||
@Column("douyin_open_id")
|
||||
private String douyinOpenId;
|
||||
|
||||
@Column("douyin_union_id")
|
||||
private String douyinUnionId;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public LocalDateTime getBirthTime() {
|
||||
return birthTime;
|
||||
}
|
||||
|
||||
public void setBirthTime(LocalDateTime birthTime) {
|
||||
this.birthTime = birthTime;
|
||||
}
|
||||
|
||||
public String getWechatOpenId() {
|
||||
return wechatOpenId;
|
||||
}
|
||||
|
||||
public void setWechatOpenId(String wechatOpenId) {
|
||||
this.wechatOpenId = wechatOpenId;
|
||||
}
|
||||
|
||||
public String getWechatUnionId() {
|
||||
return wechatUnionId;
|
||||
}
|
||||
|
||||
public void setWechatUnionId(String wechatUnionId) {
|
||||
this.wechatUnionId = wechatUnionId;
|
||||
}
|
||||
|
||||
public String getDouyinOpenId() {
|
||||
return douyinOpenId;
|
||||
}
|
||||
|
||||
public void setDouyinOpenId(String douyinOpenId) {
|
||||
this.douyinOpenId = douyinOpenId;
|
||||
}
|
||||
|
||||
public String getDouyinUnionId() {
|
||||
return douyinUnionId;
|
||||
}
|
||||
|
||||
public void setDouyinUnionId(String douyinUnionId) {
|
||||
this.douyinUnionId = douyinUnionId;
|
||||
}
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Table("daily_fortune")
|
||||
public class DailyFortuneEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("fortune_date")
|
||||
private LocalDate fortuneDate;
|
||||
|
||||
@Column("overall_luck")
|
||||
private String overallLuck;
|
||||
|
||||
@Column("overall_score")
|
||||
private Integer overallScore;
|
||||
|
||||
@Column("palace_fortunes")
|
||||
private String palaceFortunes;
|
||||
|
||||
@Column("career_advice")
|
||||
private String careerAdvice;
|
||||
|
||||
@Column("wealth_advice")
|
||||
private String wealthAdvice;
|
||||
|
||||
@Column("relationship_advice")
|
||||
private String relationshipAdvice;
|
||||
|
||||
@Column("health_advice")
|
||||
private String healthAdvice;
|
||||
|
||||
@Column("lucky_color")
|
||||
private String luckyColor;
|
||||
|
||||
@Column("lucky_number")
|
||||
private String luckyNumber;
|
||||
|
||||
@Column("lucky_direction")
|
||||
private String luckyDirection;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public LocalDate getFortuneDate() {
|
||||
return fortuneDate;
|
||||
}
|
||||
|
||||
public void setFortuneDate(LocalDate fortuneDate) {
|
||||
this.fortuneDate = fortuneDate;
|
||||
}
|
||||
|
||||
public String getOverallLuck() {
|
||||
return overallLuck;
|
||||
}
|
||||
|
||||
public void setOverallLuck(String overallLuck) {
|
||||
this.overallLuck = overallLuck;
|
||||
}
|
||||
|
||||
public Integer getOverallScore() {
|
||||
return overallScore;
|
||||
}
|
||||
|
||||
public void setOverallScore(Integer overallScore) {
|
||||
this.overallScore = overallScore;
|
||||
}
|
||||
|
||||
public String getPalaceFortunes() {
|
||||
return palaceFortunes;
|
||||
}
|
||||
|
||||
public void setPalaceFortunes(String palaceFortunes) {
|
||||
this.palaceFortunes = palaceFortunes;
|
||||
}
|
||||
|
||||
public String getCareerAdvice() {
|
||||
return careerAdvice;
|
||||
}
|
||||
|
||||
public void setCareerAdvice(String careerAdvice) {
|
||||
this.careerAdvice = careerAdvice;
|
||||
}
|
||||
|
||||
public String getWealthAdvice() {
|
||||
return wealthAdvice;
|
||||
}
|
||||
|
||||
public void setWealthAdvice(String wealthAdvice) {
|
||||
this.wealthAdvice = wealthAdvice;
|
||||
}
|
||||
|
||||
public String getRelationshipAdvice() {
|
||||
return relationshipAdvice;
|
||||
}
|
||||
|
||||
public void setRelationshipAdvice(String relationshipAdvice) {
|
||||
this.relationshipAdvice = relationshipAdvice;
|
||||
}
|
||||
|
||||
public String getHealthAdvice() {
|
||||
return healthAdvice;
|
||||
}
|
||||
|
||||
public void setHealthAdvice(String healthAdvice) {
|
||||
this.healthAdvice = healthAdvice;
|
||||
}
|
||||
|
||||
public String getLuckyColor() {
|
||||
return luckyColor;
|
||||
}
|
||||
|
||||
public void setLuckyColor(String luckyColor) {
|
||||
this.luckyColor = luckyColor;
|
||||
}
|
||||
|
||||
public String getLuckyNumber() {
|
||||
return luckyNumber;
|
||||
}
|
||||
|
||||
public void setLuckyNumber(String luckyNumber) {
|
||||
this.luckyNumber = luckyNumber;
|
||||
}
|
||||
|
||||
public String getLuckyDirection() {
|
||||
return luckyDirection;
|
||||
}
|
||||
|
||||
public void setLuckyDirection(String luckyDirection) {
|
||||
this.luckyDirection = luckyDirection;
|
||||
}
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table("export_task")
|
||||
public class ExportTaskEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("type")
|
||||
private String type;
|
||||
|
||||
@Column("format")
|
||||
private String format;
|
||||
|
||||
@Column("start_date")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Column("end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("file_data")
|
||||
private byte[] fileData;
|
||||
|
||||
@Column("file_path")
|
||||
private String filePath;
|
||||
|
||||
@Column("file_name")
|
||||
private String fileName;
|
||||
|
||||
@Column("file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@Column("error_message")
|
||||
private String errorMessage;
|
||||
|
||||
@Column("error")
|
||||
private String error;
|
||||
|
||||
@Column("completed_at")
|
||||
private LocalDateTime completedAt;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public byte[] getFileData() {
|
||||
return fileData;
|
||||
}
|
||||
|
||||
public void setFileData(byte[] fileData) {
|
||||
this.fileData = fileData;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public LocalDateTime getCompletedAt() {
|
||||
return completedAt;
|
||||
}
|
||||
|
||||
public void setCompletedAt(LocalDateTime completedAt) {
|
||||
this.completedAt = completedAt;
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
@Table("monthly_fortune")
|
||||
public class MonthlyFortuneEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("fortune_month")
|
||||
private YearMonth fortuneMonth;
|
||||
|
||||
@Column("overall_luck")
|
||||
private String overallLuck;
|
||||
|
||||
@Column("overall_score")
|
||||
private Integer overallScore;
|
||||
|
||||
@Column("palace_fortunes")
|
||||
private String palaceFortunes;
|
||||
|
||||
@Column("career_advice")
|
||||
private String careerAdvice;
|
||||
|
||||
@Column("wealth_advice")
|
||||
private String wealthAdvice;
|
||||
|
||||
@Column("relationship_advice")
|
||||
private String relationshipAdvice;
|
||||
|
||||
@Column("health_advice")
|
||||
private String healthAdvice;
|
||||
|
||||
@Column("lucky_color")
|
||||
private String luckyColor;
|
||||
|
||||
@Column("lucky_number")
|
||||
private String luckyNumber;
|
||||
|
||||
@Column("lucky_direction")
|
||||
private String luckyDirection;
|
||||
|
||||
@Column("key_focus")
|
||||
private String keyFocus;
|
||||
|
||||
@Column("caution_advice")
|
||||
private String cautionAdvice;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public YearMonth getFortuneMonth() {
|
||||
return fortuneMonth;
|
||||
}
|
||||
|
||||
public void setFortuneMonth(YearMonth fortuneMonth) {
|
||||
this.fortuneMonth = fortuneMonth;
|
||||
}
|
||||
|
||||
public String getOverallLuck() {
|
||||
return overallLuck;
|
||||
}
|
||||
|
||||
public void setOverallLuck(String overallLuck) {
|
||||
this.overallLuck = overallLuck;
|
||||
}
|
||||
|
||||
public Integer getOverallScore() {
|
||||
return overallScore;
|
||||
}
|
||||
|
||||
public void setOverallScore(Integer overallScore) {
|
||||
this.overallScore = overallScore;
|
||||
}
|
||||
|
||||
public String getPalaceFortunes() {
|
||||
return palaceFortunes;
|
||||
}
|
||||
|
||||
public void setPalaceFortunes(String palaceFortunes) {
|
||||
this.palaceFortunes = palaceFortunes;
|
||||
}
|
||||
|
||||
public String getCareerAdvice() {
|
||||
return careerAdvice;
|
||||
}
|
||||
|
||||
public void setCareerAdvice(String careerAdvice) {
|
||||
this.careerAdvice = careerAdvice;
|
||||
}
|
||||
|
||||
public String getWealthAdvice() {
|
||||
return wealthAdvice;
|
||||
}
|
||||
|
||||
public void setWealthAdvice(String wealthAdvice) {
|
||||
this.wealthAdvice = wealthAdvice;
|
||||
}
|
||||
|
||||
public String getRelationshipAdvice() {
|
||||
return relationshipAdvice;
|
||||
}
|
||||
|
||||
public void setRelationshipAdvice(String relationshipAdvice) {
|
||||
this.relationshipAdvice = relationshipAdvice;
|
||||
}
|
||||
|
||||
public String getHealthAdvice() {
|
||||
return healthAdvice;
|
||||
}
|
||||
|
||||
public void setHealthAdvice(String healthAdvice) {
|
||||
this.healthAdvice = healthAdvice;
|
||||
}
|
||||
|
||||
public String getLuckyColor() {
|
||||
return luckyColor;
|
||||
}
|
||||
|
||||
public void setLuckyColor(String luckyColor) {
|
||||
this.luckyColor = luckyColor;
|
||||
}
|
||||
|
||||
public String getLuckyNumber() {
|
||||
return luckyNumber;
|
||||
}
|
||||
|
||||
public void setLuckyNumber(String luckyNumber) {
|
||||
this.luckyNumber = luckyNumber;
|
||||
}
|
||||
|
||||
public String getLuckyDirection() {
|
||||
return luckyDirection;
|
||||
}
|
||||
|
||||
public void setLuckyDirection(String luckyDirection) {
|
||||
this.luckyDirection = luckyDirection;
|
||||
}
|
||||
|
||||
public String getKeyFocus() {
|
||||
return keyFocus;
|
||||
}
|
||||
|
||||
public void setKeyFocus(String keyFocus) {
|
||||
this.keyFocus = keyFocus;
|
||||
}
|
||||
|
||||
public String getCautionAdvice() {
|
||||
return cautionAdvice;
|
||||
}
|
||||
|
||||
public void setCautionAdvice(String cautionAdvice) {
|
||||
this.cautionAdvice = cautionAdvice;
|
||||
}
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_operation_log")
|
||||
public class OperationLogEntity extends BaseEntity {
|
||||
|
||||
@Column("operation_time")
|
||||
private java.time.LocalDateTime operationTime;
|
||||
|
||||
@Column("module_name")
|
||||
private String moduleName;
|
||||
|
||||
@Column("operation_desc")
|
||||
private String operationDesc;
|
||||
|
||||
@Column("operator")
|
||||
private String operator;
|
||||
|
||||
@Column("operator_id")
|
||||
private Long operatorId;
|
||||
|
||||
@Column("request_method")
|
||||
private String requestMethod;
|
||||
|
||||
@Column("request_path")
|
||||
private String requestPath;
|
||||
|
||||
@Column("request_params")
|
||||
private String requestParams;
|
||||
|
||||
@Column("response_result")
|
||||
private String responseResult;
|
||||
|
||||
@Column("ip_address")
|
||||
private String ipAddress;
|
||||
|
||||
@Column("execution_time")
|
||||
private Long executionTime;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("exception_message")
|
||||
private String exceptionMessage;
|
||||
|
||||
@Column("diff_json")
|
||||
private String diffJson;
|
||||
|
||||
public java.time.LocalDateTime getOperationTime() {
|
||||
return operationTime;
|
||||
}
|
||||
|
||||
public void setOperationTime(java.time.LocalDateTime operationTime) {
|
||||
this.operationTime = operationTime;
|
||||
}
|
||||
|
||||
public String getModuleName() {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public String getOperationDesc() {
|
||||
return operationDesc;
|
||||
}
|
||||
|
||||
public void setOperationDesc(String operationDesc) {
|
||||
this.operationDesc = operationDesc;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public Long getOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorId(Long operatorId) {
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public String getRequestMethod() {
|
||||
return requestMethod;
|
||||
}
|
||||
|
||||
public void setRequestMethod(String requestMethod) {
|
||||
this.requestMethod = requestMethod;
|
||||
}
|
||||
|
||||
public String getRequestPath() {
|
||||
return requestPath;
|
||||
}
|
||||
|
||||
public void setRequestPath(String requestPath) {
|
||||
this.requestPath = requestPath;
|
||||
}
|
||||
|
||||
public String getRequestParams() {
|
||||
return requestParams;
|
||||
}
|
||||
|
||||
public void setRequestParams(String requestParams) {
|
||||
this.requestParams = requestParams;
|
||||
}
|
||||
|
||||
public String getResponseResult() {
|
||||
return responseResult;
|
||||
}
|
||||
|
||||
public void setResponseResult(String responseResult) {
|
||||
this.responseResult = responseResult;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public Long getExecutionTime() {
|
||||
return executionTime;
|
||||
}
|
||||
|
||||
public void setExecutionTime(Long executionTime) {
|
||||
this.executionTime = executionTime;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getExceptionMessage() {
|
||||
return exceptionMessage;
|
||||
}
|
||||
|
||||
public void setExceptionMessage(String exceptionMessage) {
|
||||
this.exceptionMessage = exceptionMessage;
|
||||
}
|
||||
|
||||
public String getDiffJson() {
|
||||
return diffJson;
|
||||
}
|
||||
|
||||
public void setDiffJson(String diffJson) {
|
||||
this.diffJson = diffJson;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("palace")
|
||||
public class PalaceEntity extends BaseEntity {
|
||||
|
||||
@Column("ziwei_chart_id")
|
||||
private Long ziweiChartId;
|
||||
|
||||
@Column("palace_type")
|
||||
private String palaceType;
|
||||
|
||||
@Column("earthly_branch")
|
||||
private String earthlyBranch;
|
||||
|
||||
@Column("major_stars")
|
||||
private String majorStars;
|
||||
|
||||
@Column("minor_stars")
|
||||
private String minorStars;
|
||||
|
||||
@Column("analysis")
|
||||
private String analysis;
|
||||
|
||||
@Column("score")
|
||||
private Integer score;
|
||||
|
||||
public Long getZiweiChartId() {
|
||||
return ziweiChartId;
|
||||
}
|
||||
|
||||
public void setZiweiChartId(Long ziweiChartId) {
|
||||
this.ziweiChartId = ziweiChartId;
|
||||
}
|
||||
|
||||
public String getPalaceType() {
|
||||
return palaceType;
|
||||
}
|
||||
|
||||
public void setPalaceType(String palaceType) {
|
||||
this.palaceType = palaceType;
|
||||
}
|
||||
|
||||
public String getEarthlyBranch() {
|
||||
return earthlyBranch;
|
||||
}
|
||||
|
||||
public void setEarthlyBranch(String earthlyBranch) {
|
||||
this.earthlyBranch = earthlyBranch;
|
||||
}
|
||||
|
||||
public String getMajorStars() {
|
||||
return majorStars;
|
||||
}
|
||||
|
||||
public void setMajorStars(String majorStars) {
|
||||
this.majorStars = majorStars;
|
||||
}
|
||||
|
||||
public String getMinorStars() {
|
||||
return minorStars;
|
||||
}
|
||||
|
||||
public void setMinorStars(String minorStars) {
|
||||
this.minorStars = minorStars;
|
||||
}
|
||||
|
||||
public String getAnalysis() {
|
||||
return analysis;
|
||||
}
|
||||
|
||||
public void setAnalysis(String analysis) {
|
||||
this.analysis = analysis;
|
||||
}
|
||||
|
||||
public Integer getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Integer score) {
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Table("sms_verification_code")
|
||||
public class SmsVerificationCodeEntity extends BaseEntity {
|
||||
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
|
||||
@Column("code")
|
||||
private String code;
|
||||
|
||||
@Column("type")
|
||||
private String type;
|
||||
|
||||
@Column("expire_time")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@Column("verified")
|
||||
private Boolean verified;
|
||||
|
||||
@Column("verify_count")
|
||||
private Integer verifyCount;
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public LocalDateTime getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(LocalDateTime expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public Boolean getVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
public void setVerified(Boolean verified) {
|
||||
this.verified = verified;
|
||||
}
|
||||
|
||||
public Integer getVerifyCount() {
|
||||
return verifyCount;
|
||||
}
|
||||
|
||||
public void setVerifyCount(Integer verifyCount) {
|
||||
this.verifyCount = verifyCount;
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Table("subscription")
|
||||
public class SubscriptionEntity extends BaseEntity {
|
||||
|
||||
@Column("client_user_id")
|
||||
private Long clientUserId;
|
||||
|
||||
@Column("plan_type")
|
||||
private String planType;
|
||||
|
||||
@Column("start_date")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Column("end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column("auto_renewal")
|
||||
private Boolean autoRenewal;
|
||||
|
||||
@Column("trial_days")
|
||||
private Integer trialDays;
|
||||
|
||||
@Column("renewal_count")
|
||||
private Integer renewalCount;
|
||||
|
||||
public Long getClientUserId() {
|
||||
return clientUserId;
|
||||
}
|
||||
|
||||
public void setClientUserId(Long clientUserId) {
|
||||
this.clientUserId = clientUserId;
|
||||
}
|
||||
|
||||
public String getPlanType() {
|
||||
return planType;
|
||||
}
|
||||
|
||||
public void setPlanType(String planType) {
|
||||
this.planType = planType;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Boolean getAutoRenewal() {
|
||||
return autoRenewal;
|
||||
}
|
||||
|
||||
public void setAutoRenewal(Boolean autoRenewal) {
|
||||
this.autoRenewal = autoRenewal;
|
||||
}
|
||||
|
||||
public Integer getTrialDays() {
|
||||
return trialDays;
|
||||
}
|
||||
|
||||
public void setTrialDays(Integer trialDays) {
|
||||
this.trialDays = trialDays;
|
||||
}
|
||||
|
||||
public Integer getRenewalCount() {
|
||||
return renewalCount;
|
||||
}
|
||||
|
||||
public void setRenewalCount(Integer renewalCount) {
|
||||
this.renewalCount = renewalCount;
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_menu")
|
||||
public class SysMenuEntity extends BaseEntity {
|
||||
|
||||
@Column("menu_name")
|
||||
private String menuName;
|
||||
|
||||
@Column("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
@Column("order_num")
|
||||
private Integer orderNum;
|
||||
|
||||
@Column("menu_type")
|
||||
private String menuType;
|
||||
|
||||
@Column("perms")
|
||||
private String perms;
|
||||
|
||||
@Column("component")
|
||||
private String component;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
public String getMenuName() {
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public String getMenuType() {
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType) {
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getPerms() {
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms(String perms) {
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_role")
|
||||
public class SysRoleEntity extends BaseEntity {
|
||||
|
||||
@Column("role_name")
|
||||
private String roleName;
|
||||
|
||||
@Column("role_key")
|
||||
private String roleKey;
|
||||
|
||||
@Column("role_sort")
|
||||
private Integer roleSort;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getRoleKey() {
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
public void setRoleKey(String roleKey) {
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
|
||||
public Integer getRoleSort() {
|
||||
return roleSort;
|
||||
}
|
||||
|
||||
public void setRoleSort(Integer roleSort) {
|
||||
this.roleSort = roleSort;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_role_menu")
|
||||
public class SysRoleMenuEntity extends BaseEntity {
|
||||
|
||||
@Column("role_id")
|
||||
private Long roleId;
|
||||
|
||||
@Column("menu_id")
|
||||
private Long menuId;
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_user")
|
||||
public class SysUserEntity extends BaseEntity {
|
||||
|
||||
@Column("username")
|
||||
private String username;
|
||||
|
||||
@Column("password")
|
||||
private String password;
|
||||
|
||||
@Column("email")
|
||||
private String email;
|
||||
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
|
||||
@Column("status")
|
||||
private String status;
|
||||
|
||||
@Column("create_by")
|
||||
private String createBy;
|
||||
|
||||
@Column("update_by")
|
||||
private String updateBy;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("sys_user_role")
|
||||
public class SysUserRoleEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("role_id")
|
||||
private Long roleId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("user_binding")
|
||||
public class UserBindingEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("platform")
|
||||
private String platform;
|
||||
|
||||
@Column("platform_open_id")
|
||||
private String platformOpenId;
|
||||
|
||||
@Column("platform_union_id")
|
||||
private String platformUnionId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getPlatformOpenId() {
|
||||
return platformOpenId;
|
||||
}
|
||||
|
||||
public void setPlatformOpenId(String platformOpenId) {
|
||||
this.platformOpenId = platformOpenId;
|
||||
}
|
||||
|
||||
public String getPlatformUnionId() {
|
||||
return platformUnionId;
|
||||
}
|
||||
|
||||
public void setPlatformUnionId(String platformUnionId) {
|
||||
this.platformUnionId = platformUnionId;
|
||||
}
|
||||
}
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.Year;
|
||||
|
||||
@Table("yearly_fortune")
|
||||
public class YearlyFortuneEntity extends BaseEntity {
|
||||
|
||||
@Column("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column("fortune_year")
|
||||
private Year fortuneYear;
|
||||
|
||||
@Column("overall_luck")
|
||||
private String overallLuck;
|
||||
|
||||
@Column("overall_score")
|
||||
private Integer overallScore;
|
||||
|
||||
@Column("palace_fortunes")
|
||||
private String palaceFortunes;
|
||||
|
||||
@Column("career_advice")
|
||||
private String careerAdvice;
|
||||
|
||||
@Column("wealth_advice")
|
||||
private String wealthAdvice;
|
||||
|
||||
@Column("relationship_advice")
|
||||
private String relationshipAdvice;
|
||||
|
||||
@Column("health_advice")
|
||||
private String healthAdvice;
|
||||
|
||||
@Column("lucky_color")
|
||||
private String luckyColor;
|
||||
|
||||
@Column("lucky_number")
|
||||
private String luckyNumber;
|
||||
|
||||
@Column("lucky_direction")
|
||||
private String luckyDirection;
|
||||
|
||||
@Column("key_focus")
|
||||
private String keyFocus;
|
||||
|
||||
@Column("caution_advice")
|
||||
private String cautionAdvice;
|
||||
|
||||
@Column("yearly_theme")
|
||||
private String yearlyTheme;
|
||||
|
||||
@Column("major_opportunity")
|
||||
private String majorOpportunity;
|
||||
|
||||
@Column("major_challenge")
|
||||
private String majorChallenge;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Year getFortuneYear() {
|
||||
return fortuneYear;
|
||||
}
|
||||
|
||||
public void setFortuneYear(Year fortuneYear) {
|
||||
this.fortuneYear = fortuneYear;
|
||||
}
|
||||
|
||||
public String getOverallLuck() {
|
||||
return overallLuck;
|
||||
}
|
||||
|
||||
public void setOverallLuck(String overallLuck) {
|
||||
this.overallLuck = overallLuck;
|
||||
}
|
||||
|
||||
public Integer getOverallScore() {
|
||||
return overallScore;
|
||||
}
|
||||
|
||||
public void setOverallScore(Integer overallScore) {
|
||||
this.overallScore = overallScore;
|
||||
}
|
||||
|
||||
public String getPalaceFortunes() {
|
||||
return palaceFortunes;
|
||||
}
|
||||
|
||||
public void setPalaceFortunes(String palaceFortunes) {
|
||||
this.palaceFortunes = palaceFortunes;
|
||||
}
|
||||
|
||||
public String getCareerAdvice() {
|
||||
return careerAdvice;
|
||||
}
|
||||
|
||||
public void setCareerAdvice(String careerAdvice) {
|
||||
this.careerAdvice = careerAdvice;
|
||||
}
|
||||
|
||||
public String getWealthAdvice() {
|
||||
return wealthAdvice;
|
||||
}
|
||||
|
||||
public void setWealthAdvice(String wealthAdvice) {
|
||||
this.wealthAdvice = wealthAdvice;
|
||||
}
|
||||
|
||||
public String getRelationshipAdvice() {
|
||||
return relationshipAdvice;
|
||||
}
|
||||
|
||||
public void setRelationshipAdvice(String relationshipAdvice) {
|
||||
this.relationshipAdvice = relationshipAdvice;
|
||||
}
|
||||
|
||||
public String getHealthAdvice() {
|
||||
return healthAdvice;
|
||||
}
|
||||
|
||||
public void setHealthAdvice(String healthAdvice) {
|
||||
this.healthAdvice = healthAdvice;
|
||||
}
|
||||
|
||||
public String getLuckyColor() {
|
||||
return luckyColor;
|
||||
}
|
||||
|
||||
public void setLuckyColor(String luckyColor) {
|
||||
this.luckyColor = luckyColor;
|
||||
}
|
||||
|
||||
public String getLuckyNumber() {
|
||||
return luckyNumber;
|
||||
}
|
||||
|
||||
public void setLuckyNumber(String luckyNumber) {
|
||||
this.luckyNumber = luckyNumber;
|
||||
}
|
||||
|
||||
public String getLuckyDirection() {
|
||||
return luckyDirection;
|
||||
}
|
||||
|
||||
public void setLuckyDirection(String luckyDirection) {
|
||||
this.luckyDirection = luckyDirection;
|
||||
}
|
||||
|
||||
public String getKeyFocus() {
|
||||
return keyFocus;
|
||||
}
|
||||
|
||||
public void setKeyFocus(String keyFocus) {
|
||||
this.keyFocus = keyFocus;
|
||||
}
|
||||
|
||||
public String getCautionAdvice() {
|
||||
return cautionAdvice;
|
||||
}
|
||||
|
||||
public void setCautionAdvice(String cautionAdvice) {
|
||||
this.cautionAdvice = cautionAdvice;
|
||||
}
|
||||
|
||||
public String getYearlyTheme() {
|
||||
return yearlyTheme;
|
||||
}
|
||||
|
||||
public void setYearlyTheme(String yearlyTheme) {
|
||||
this.yearlyTheme = yearlyTheme;
|
||||
}
|
||||
|
||||
public String getMajorOpportunity() {
|
||||
return majorOpportunity;
|
||||
}
|
||||
|
||||
public void setMajorOpportunity(String majorOpportunity) {
|
||||
this.majorOpportunity = majorOpportunity;
|
||||
}
|
||||
|
||||
public String getMajorChallenge() {
|
||||
return majorChallenge;
|
||||
}
|
||||
|
||||
public void setMajorChallenge(String majorChallenge) {
|
||||
this.majorChallenge = majorChallenge;
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package io.destiny.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Table("ziwei_chart")
|
||||
public class ZiweiChartEntity extends BaseEntity {
|
||||
|
||||
@Column("birth_info_id")
|
||||
private Long birthInfoId;
|
||||
|
||||
@Column("year_stem")
|
||||
private String yearStem;
|
||||
|
||||
@Column("ming_gong_branch")
|
||||
private String mingGongBranch;
|
||||
|
||||
@Column("shen_gong_branch")
|
||||
private String shenGongBranch;
|
||||
|
||||
@Column("summary")
|
||||
private String summary;
|
||||
|
||||
@Column("overall_luck")
|
||||
private String overallLuck;
|
||||
|
||||
@Column("san_fang_si_zheng")
|
||||
private String sanFangSiZheng;
|
||||
|
||||
@Column("patterns")
|
||||
private String patterns;
|
||||
|
||||
public Long getBirthInfoId() {
|
||||
return birthInfoId;
|
||||
}
|
||||
|
||||
public void setBirthInfoId(Long birthInfoId) {
|
||||
this.birthInfoId = birthInfoId;
|
||||
}
|
||||
|
||||
public String getYearStem() {
|
||||
return yearStem;
|
||||
}
|
||||
|
||||
public void setYearStem(String yearStem) {
|
||||
this.yearStem = yearStem;
|
||||
}
|
||||
|
||||
public String getMingGongBranch() {
|
||||
return mingGongBranch;
|
||||
}
|
||||
|
||||
public void setMingGongBranch(String mingGongBranch) {
|
||||
this.mingGongBranch = mingGongBranch;
|
||||
}
|
||||
|
||||
public String getShenGongBranch() {
|
||||
return shenGongBranch;
|
||||
}
|
||||
|
||||
public void setShenGongBranch(String shenGongBranch) {
|
||||
this.shenGongBranch = shenGongBranch;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public String getOverallLuck() {
|
||||
return overallLuck;
|
||||
}
|
||||
|
||||
public void setOverallLuck(String overallLuck) {
|
||||
this.overallLuck = overallLuck;
|
||||
}
|
||||
|
||||
public String getSanFangSiZheng() {
|
||||
return sanFangSiZheng;
|
||||
}
|
||||
|
||||
public void setSanFangSiZheng(String sanFangSiZheng) {
|
||||
this.sanFangSiZheng = sanFangSiZheng;
|
||||
}
|
||||
|
||||
public String getPatterns() {
|
||||
return patterns;
|
||||
}
|
||||
|
||||
public void setPatterns(String patterns) {
|
||||
this.patterns = patterns;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package io.destiny.db.entity.query;
|
||||
|
||||
import io.destiny.client.core.domain.query.ClientLoginLogQuery;
|
||||
import io.destiny.db.utils.QueryField;
|
||||
|
||||
public class ClientLoginLogQueryCriteria {
|
||||
|
||||
@QueryField(propName = "clientUserId", type = QueryField.Type.EQUAL)
|
||||
private Long clientUserId;
|
||||
|
||||
@QueryField(propName = "ipAddress", type = QueryField.Type.EQUAL)
|
||||
private String ipAddress;
|
||||
|
||||
@QueryField(propName = "loginTime", type = QueryField.Type.GREATER_THAN)
|
||||
private java.time.LocalDateTime loginTimeStart;
|
||||
|
||||
@QueryField(propName = "loginTime", type = QueryField.Type.LESS_THAN)
|
||||
private java.time.LocalDateTime loginTimeEnd;
|
||||
|
||||
@QueryField(propName = "logoutTime", type = QueryField.Type.GREATER_THAN)
|
||||
private java.time.LocalDateTime logoutTimeStart;
|
||||
|
||||
@QueryField(propName = "logoutTime", type = QueryField.Type.LESS_THAN)
|
||||
private java.time.LocalDateTime logoutTimeEnd;
|
||||
|
||||
public Long getClientUserId() {
|
||||
return clientUserId;
|
||||
}
|
||||
|
||||
public void setClientUserId(Long clientUserId) {
|
||||
this.clientUserId = clientUserId;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public java.time.LocalDateTime getLoginTimeStart() {
|
||||
return loginTimeStart;
|
||||
}
|
||||
|
||||
public void setLoginTimeStart(java.time.LocalDateTime loginTimeStart) {
|
||||
this.loginTimeStart = loginTimeStart;
|
||||
}
|
||||
|
||||
public java.time.LocalDateTime getLoginTimeEnd() {
|
||||
return loginTimeEnd;
|
||||
}
|
||||
|
||||
public void setLoginTimeEnd(java.time.LocalDateTime loginTimeEnd) {
|
||||
this.loginTimeEnd = loginTimeEnd;
|
||||
}
|
||||
|
||||
public java.time.LocalDateTime getLogoutTimeStart() {
|
||||
return logoutTimeStart;
|
||||
}
|
||||
|
||||
public void setLogoutTimeStart(java.time.LocalDateTime logoutTimeStart) {
|
||||
this.logoutTimeStart = logoutTimeStart;
|
||||
}
|
||||
|
||||
public java.time.LocalDateTime getLogoutTimeEnd() {
|
||||
return logoutTimeEnd;
|
||||
}
|
||||
|
||||
public void setLogoutTimeEnd(java.time.LocalDateTime logoutTimeEnd) {
|
||||
this.logoutTimeEnd = logoutTimeEnd;
|
||||
}
|
||||
|
||||
public void convert(ClientLoginLogQuery query) {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
this.clientUserId = query.getClientUserId();
|
||||
this.ipAddress = query.getIpAddress() != null ? query.getIpAddress().getValue() : null;
|
||||
this.loginTimeStart = query.getLoginTimeStart();
|
||||
this.loginTimeEnd = query.getLoginTimeEnd();
|
||||
this.logoutTimeStart = query.getLogoutTimeStart();
|
||||
this.logoutTimeEnd = query.getLogoutTimeEnd();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package io.destiny.db.entity.query;
|
||||
|
||||
import io.destiny.client.core.domain.query.ClientUserQuery;
|
||||
import io.destiny.db.utils.QueryField;
|
||||
|
||||
public class ClientUserQueryCriteria {
|
||||
|
||||
@QueryField(propName = "phone", type = QueryField.Type.EQUAL)
|
||||
private String phone;
|
||||
|
||||
@QueryField(propName = "username", type = QueryField.Type.EQUAL)
|
||||
private String username;
|
||||
|
||||
@QueryField(propName = "email", type = QueryField.Type.EQUAL)
|
||||
private String email;
|
||||
|
||||
@QueryField(propName = "ipAddress", type = QueryField.Type.EQUAL)
|
||||
private String ipAddress;
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public void convert(ClientUserQuery query) {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
this.phone = query.getPhone() != null ? query.getPhone().getValue() : null;
|
||||
this.username = query.getUsername();
|
||||
this.email = query.getEmail() != null ? query.getEmail().getValue() : null;
|
||||
this.ipAddress = query.getIpAddress() != null ? query.getIpAddress().getValue() : null;
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package io.destiny.db.entity.query;
|
||||
|
||||
import io.destiny.db.utils.QueryField;
|
||||
import io.destiny.sys.core.domain.query.SysUserQuery;
|
||||
|
||||
public class SysUserQueryCriteria {
|
||||
|
||||
@QueryField(propName = "username", type = QueryField.Type.INNER_LIKE)
|
||||
private String username;
|
||||
|
||||
@QueryField(propName = "email", type = QueryField.Type.INNER_LIKE)
|
||||
private String email;
|
||||
|
||||
@QueryField(propName = "phone", type = QueryField.Type.INNER_LIKE)
|
||||
private String phone;
|
||||
|
||||
@QueryField(propName = "status", type = QueryField.Type.EQUAL)
|
||||
private String status;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void convert(SysUserQuery query) {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
this.username = query.getUsername();
|
||||
this.email = query.getEmail() != null ? query.getEmail().getValue() : null;
|
||||
this.phone = query.getPhone() != null ? query.getPhone().getValue() : null;
|
||||
this.status = query.getStatus();
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.BirthInfo;
|
||||
import io.destiny.biz.repository.IBirthInfoRepository;
|
||||
import io.destiny.db.converter.BirthInfoConverter;
|
||||
import io.destiny.db.dao.BirthInfoDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class BirthInfoRepository implements IBirthInfoRepository {
|
||||
|
||||
private final BirthInfoDao dao;
|
||||
private final BirthInfoConverter converter;
|
||||
|
||||
public BirthInfoRepository(BirthInfoDao dao, BirthInfoConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<BirthInfo> findByBirthTime(java.time.LocalDateTime birthTime) {
|
||||
return dao.findByBirthTimeAndDeletedAtIsNull(birthTime)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<BirthInfo> findByYearBranchAndMonthBranchAndDayBranchAndHourBranch(String yearBranch,
|
||||
String monthBranch,
|
||||
String dayBranch, String hourBranch) {
|
||||
return dao
|
||||
.findByYearBranchAndMonthBranchAndDayBranchAndHourBranchAndDeletedAtIsNull(yearBranch, monthBranch,
|
||||
dayBranch, hourBranch)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.client.core.domain.ClientLoginLog;
|
||||
import io.destiny.client.core.domain.query.ClientLoginLogQuery;
|
||||
import io.destiny.client.core.repository.IClientLoginLogRepository;
|
||||
import io.destiny.common.request.PageQuery;
|
||||
import io.destiny.common.response.PageModel;
|
||||
import io.destiny.db.converter.ClientLoginLogConverter;
|
||||
import io.destiny.db.dao.ClientLoginLogDao;
|
||||
import io.destiny.db.entity.ClientLoginLogEntity;
|
||||
import io.destiny.db.entity.query.ClientLoginLogQueryCriteria;
|
||||
import io.destiny.db.utils.QueryUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class ClientLoginLogRepository implements IClientLoginLogRepository {
|
||||
|
||||
private final ClientLoginLogDao dao;
|
||||
private final ClientLoginLogConverter converter;
|
||||
private final R2dbcEntityTemplate template;
|
||||
|
||||
public ClientLoginLogRepository(ClientLoginLogDao dao, ClientLoginLogConverter converter,
|
||||
R2dbcEntityTemplate template) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageModel<ClientLoginLog>> findByQueryWithPagination(ClientLoginLogQuery query,
|
||||
PageQuery pageQuery) {
|
||||
ClientLoginLogQueryCriteria criteria = new ClientLoginLogQueryCriteria();
|
||||
criteria.convert(query);
|
||||
Query queryObj = QueryUtil.getQuery(criteria);
|
||||
|
||||
Sort sort = Sort.unsorted();
|
||||
if (pageQuery.hasSort()) {
|
||||
sort = Sort.by(Sort.Direction.fromString(pageQuery.getSortOrder()), pageQuery.getSortField());
|
||||
}
|
||||
|
||||
Pageable pageable = org.springframework.data.domain.PageRequest.of(
|
||||
pageQuery.getPageNum() - 1,
|
||||
pageQuery.getPageSize(),
|
||||
sort);
|
||||
|
||||
return template.select(ClientLoginLogEntity.class)
|
||||
.matching(queryObj.with(pageable))
|
||||
.all()
|
||||
.collectList()
|
||||
.zipWith(template.count(queryObj, ClientLoginLogEntity.class))
|
||||
.map(tuple -> new PageModel<>(
|
||||
tuple.getT2(),
|
||||
tuple.getT1().stream().map(converter::toDomain).toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientLoginLog> save(ClientLoginLog loginLog) {
|
||||
return dao.save(converter.toEntity(loginLog))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ClientLoginLog> findByClientUserId(Long clientUserId) {
|
||||
return dao.findByClientUserIdAndDeletedAtIsNull(clientUserId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.client.core.domain.ClientUser;
|
||||
import io.destiny.client.core.domain.query.ClientUserQuery;
|
||||
import io.destiny.client.core.repository.IClientUserRepository;
|
||||
import io.destiny.common.primitive.PhoneNumber;
|
||||
import io.destiny.common.request.PageQuery;
|
||||
import io.destiny.common.response.PageModel;
|
||||
import io.destiny.db.converter.ClientUserConverter;
|
||||
import io.destiny.db.dao.ClientUserDao;
|
||||
import io.destiny.db.entity.ClientUserEntity;
|
||||
import io.destiny.db.entity.query.ClientUserQueryCriteria;
|
||||
import io.destiny.db.utils.QueryUtil;
|
||||
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class ClientUserRepository implements IClientUserRepository {
|
||||
|
||||
private final ClientUserDao dao;
|
||||
private final ClientUserConverter converter;
|
||||
private final R2dbcEntityTemplate template;
|
||||
|
||||
public ClientUserRepository(ClientUserDao dao, ClientUserConverter converter, R2dbcEntityTemplate template) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByPhone(PhoneNumber phone) {
|
||||
return dao.findByPhoneAndDeletedAtIsNull(phone.getValue())
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByWechatOpenId(String wechatOpenId) {
|
||||
return dao.findByWechatOpenIdAndDeletedAtIsNull(wechatOpenId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByDouyinOpenId(String douyinOpenId) {
|
||||
return dao.findByDouyinOpenIdAndDeletedAtIsNull(douyinOpenId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByWechatUnionId(String wechatUnionId) {
|
||||
return dao.findByWechatUnionIdAndDeletedAtIsNull(wechatUnionId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByDouyinUnionId(String douyinUnionId) {
|
||||
return dao.findByDouyinUnionIdAndDeletedAtIsNull(douyinUnionId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> save(ClientUser clientUser) {
|
||||
return dao.save(converter.toEntity(clientUser))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findById(Long id) {
|
||||
return dao.findById(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ClientUser> findByUsername(String username) {
|
||||
return dao.findByUsernameAndDeletedAtIsNull(username)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ClientUser> findByQuery(ClientUserQuery query) {
|
||||
ClientUserQueryCriteria criteria = new ClientUserQueryCriteria();
|
||||
criteria.convert(query);
|
||||
Query queryObj = QueryUtil.getQuery(criteria);
|
||||
return template.select(ClientUserEntity.class)
|
||||
.matching(queryObj)
|
||||
.all()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageModel<ClientUser>> findByQueryWithPagination(ClientUserQuery query, PageQuery pageQuery) {
|
||||
ClientUserQueryCriteria criteria = new ClientUserQueryCriteria();
|
||||
criteria.convert(query);
|
||||
Query queryObj = QueryUtil.getQuery(criteria);
|
||||
|
||||
Sort sort = Sort.unsorted();
|
||||
if (pageQuery.hasSort()) {
|
||||
sort = Sort.by(Sort.Direction.fromString(pageQuery.getSortOrder()), pageQuery.getSortField());
|
||||
}
|
||||
|
||||
Pageable pageable = PageRequest.of(
|
||||
pageQuery.getPageNum() - 1,
|
||||
pageQuery.getPageSize(),
|
||||
sort);
|
||||
|
||||
return template.select(ClientUserEntity.class)
|
||||
.matching(queryObj.with(pageable))
|
||||
.all()
|
||||
.collectList()
|
||||
.zipWith(template.count(queryObj, ClientUserEntity.class))
|
||||
.map(tuple -> new PageModel<>(
|
||||
tuple.getT2(),
|
||||
tuple.getT1().stream()
|
||||
.map(converter::toDomain)
|
||||
.toList()));
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.DailyFortune;
|
||||
import io.destiny.biz.repository.IDailyFortuneRepository;
|
||||
import io.destiny.db.converter.DailyFortuneConverter;
|
||||
import io.destiny.db.dao.DailyFortuneDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Repository
|
||||
public class DailyFortuneRepository implements IDailyFortuneRepository {
|
||||
|
||||
private final DailyFortuneDao dao;
|
||||
private final DailyFortuneConverter converter;
|
||||
|
||||
public DailyFortuneRepository(DailyFortuneDao dao, DailyFortuneConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<DailyFortune> findByUserIdAndFortuneDate(Long userId, LocalDate fortuneDate) {
|
||||
return dao.findByUserIdAndFortuneDateAndDeletedAtIsNull(userId, fortuneDate)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<DailyFortune> findByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<DailyFortune> findByFortuneDate(LocalDate fortuneDate) {
|
||||
return dao.findByFortuneDateAndDeletedAtIsNull(fortuneDate)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<DailyFortune> findByUserIdAndFortuneDateBetween(Long userId, LocalDate startDate, LocalDate endDate) {
|
||||
return dao.findByUserIdAndFortuneDateBetweenAndDeletedAtIsNull(userId, startDate, endDate)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.converter.ExportTaskConverter;
|
||||
import io.destiny.db.dao.ExportTaskDao;
|
||||
import io.destiny.statistics.core.domain.ExportTask;
|
||||
import io.destiny.statistics.core.repository.IExportTaskRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class ExportTaskRepository implements IExportTaskRepository {
|
||||
|
||||
private final ExportTaskDao dao;
|
||||
private final ExportTaskConverter converter;
|
||||
|
||||
public ExportTaskRepository(ExportTaskDao dao, ExportTaskConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ExportTask> findAll() {
|
||||
return dao.findAll()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ExportTask> findById(Long id) {
|
||||
return dao.findById(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ExportTask> findByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ExportTask> save(ExportTask exportTask) {
|
||||
return dao.save(converter.toEntity(exportTask))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return dao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return dao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return dao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.MonthlyFortune;
|
||||
import io.destiny.biz.repository.IMonthlyFortuneRepository;
|
||||
import io.destiny.db.converter.MonthlyFortuneConverter;
|
||||
import io.destiny.db.dao.MonthlyFortuneDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
@Repository
|
||||
public class MonthlyFortuneRepository implements IMonthlyFortuneRepository {
|
||||
|
||||
private final MonthlyFortuneDao dao;
|
||||
private final MonthlyFortuneConverter converter;
|
||||
|
||||
public MonthlyFortuneRepository(MonthlyFortuneDao dao, MonthlyFortuneConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<MonthlyFortune> findByUserIdAndFortuneMonth(Long userId, YearMonth fortuneMonth) {
|
||||
return dao.findByUserIdAndFortuneMonthAndDeletedAtIsNull(userId, fortuneMonth)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<MonthlyFortune> findByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<MonthlyFortune> findByUserIdAndFortuneMonthBetween(Long userId, YearMonth startMonth, YearMonth endMonth) {
|
||||
return dao.findByUserIdAndFortuneMonthBetweenAndDeletedAtIsNull(userId, startMonth, endMonth)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.converter.OperationLogConverter;
|
||||
import io.destiny.db.dao.OperationLogDao;
|
||||
import io.destiny.sys.core.domain.OperationLog;
|
||||
import io.destiny.sys.core.domain.query.OperationLogQuery;
|
||||
import io.destiny.sys.core.repository.IOperationLogRepository;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class OperationLogRepository implements IOperationLogRepository {
|
||||
|
||||
private final OperationLogDao dao;
|
||||
private final OperationLogConverter converter;
|
||||
|
||||
public OperationLogRepository(OperationLogDao dao, OperationLogConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<OperationLog> findById(Long id) {
|
||||
return dao.findByIdAndDeletedAtIsNull(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<OperationLog> save(OperationLog operationLog) {
|
||||
return dao.save(converter.toEntity(operationLog))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<OperationLog> findByQuery(OperationLogQuery query) {
|
||||
int offset = (query.getPageNum() - 1) * query.getPageSize();
|
||||
return dao.findByConditions(
|
||||
query.getOperator(),
|
||||
query.getModuleName(),
|
||||
query.getStatus(),
|
||||
query.getStartTime(),
|
||||
query.getEndTime(),
|
||||
query.getPageSize(),
|
||||
offset
|
||||
).map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Long> countByQuery(OperationLogQuery query) {
|
||||
return dao.countByConditions(
|
||||
query.getOperator(),
|
||||
query.getModuleName(),
|
||||
query.getStatus(),
|
||||
query.getStartTime(),
|
||||
query.getEndTime()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return dao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return dao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.Palace;
|
||||
import io.destiny.biz.repository.IPalaceRepository;
|
||||
import io.destiny.db.converter.PalaceConverter;
|
||||
import io.destiny.db.dao.PalaceDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class PalaceRepository implements IPalaceRepository {
|
||||
|
||||
private final PalaceDao dao;
|
||||
private final PalaceConverter converter;
|
||||
|
||||
public PalaceRepository(PalaceDao dao, PalaceConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Palace> findByZiweiChartId(Long ziweiChartId) {
|
||||
return dao.findByZiweiChartIdAndDeletedAtIsNull(ziweiChartId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Palace> findByZiweiChartIdAndPalaceType(Long ziweiChartId, String palaceType) {
|
||||
return dao.findByZiweiChartIdAndPalaceTypeAndDeletedAtIsNull(ziweiChartId, palaceType)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.client.core.domain.SmsVerificationCode;
|
||||
import io.destiny.client.core.repository.ISmsVerificationCodeRepository;
|
||||
import io.destiny.db.converter.SmsVerificationCodeConverter;
|
||||
import io.destiny.db.dao.SmsVerificationCodeDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
public class SmsVerificationCodeRepository implements ISmsVerificationCodeRepository {
|
||||
|
||||
private final SmsVerificationCodeDao dao;
|
||||
private final SmsVerificationCodeConverter converter;
|
||||
|
||||
public SmsVerificationCodeRepository(SmsVerificationCodeDao dao, SmsVerificationCodeConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SmsVerificationCode> save(SmsVerificationCode smsVerificationCode) {
|
||||
return dao.save(converter.toEntity(smsVerificationCode))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SmsVerificationCode> findLatestByPhoneAndType(String phone, String type) {
|
||||
return dao.findLatestByPhoneAndType(phone, type)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Long> countByPhoneAndCreatedAtAfter(String phone, LocalDateTime createdAt) {
|
||||
return dao.countByPhoneAndCreatedAtAfter(phone, createdAt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Integer> deleteExpiredBefore(LocalDateTime expireTime) {
|
||||
return dao.deleteExpiredBefore(expireTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> markAsVerified(Long id) {
|
||||
return dao.markAsVerified(id, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.client.core.domain.Subscription;
|
||||
import io.destiny.client.core.repository.ISubscriptionRepository;
|
||||
import io.destiny.db.converter.SubscriptionConverter;
|
||||
import io.destiny.db.dao.SubscriptionDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SubscriptionRepository implements ISubscriptionRepository {
|
||||
|
||||
private final SubscriptionDao dao;
|
||||
private final SubscriptionConverter converter;
|
||||
|
||||
public SubscriptionRepository(SubscriptionDao dao, SubscriptionConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Subscription> findAll() {
|
||||
return dao.findAll()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Subscription> findByStatus(String status) {
|
||||
return dao.findByStatusAndDeletedAtIsNull(status)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Subscription> findByClientUserId(Long clientUserId) {
|
||||
return dao.findByClientUserIdAndDeletedAtIsNull(clientUserId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Subscription> findByStartDateBetween(long startTimestamp, long endTimestamp) {
|
||||
return dao.findAll()
|
||||
.filter(entity -> entity.getStartDate() != null)
|
||||
.filter(entity -> {
|
||||
long entityTimestamp = entity.getStartDate().atStartOfDay(java.time.ZoneOffset.UTC).toEpochSecond();
|
||||
return entityTimestamp >= startTimestamp && entityTimestamp <= endTimestamp;
|
||||
})
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Subscription> save(Subscription subscription) {
|
||||
return dao.save(converter.toEntity(subscription))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return dao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return dao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.converter.SysMenuConverter;
|
||||
import io.destiny.db.dao.SysMenuDao;
|
||||
import io.destiny.sys.core.domain.SysMenu;
|
||||
import io.destiny.sys.core.repository.ISysMenuRepository;
|
||||
import io.destiny.sys.core.repository.ISysRoleMenuRepository;
|
||||
import io.destiny.sys.core.repository.ISysUserRoleRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SysMenuRepository implements ISysMenuRepository {
|
||||
|
||||
private final SysMenuDao menuDao;
|
||||
private final ISysRoleMenuRepository roleMenuRepository;
|
||||
private final ISysUserRoleRepository userRoleRepository;
|
||||
private final SysMenuConverter converter;
|
||||
|
||||
public SysMenuRepository(SysMenuDao menuDao, ISysRoleMenuRepository roleMenuRepository,
|
||||
ISysUserRoleRepository userRoleRepository, SysMenuConverter converter) {
|
||||
this.menuDao = menuDao;
|
||||
this.roleMenuRepository = roleMenuRepository;
|
||||
this.userRoleRepository = userRoleRepository;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysMenu> findById(Long id) {
|
||||
return menuDao.findById(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysMenu> findByRoleId(Long roleId) {
|
||||
return roleMenuRepository.findMenuIdsByRoleId(roleId)
|
||||
.flatMap(menuDao::findById)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysMenu> findByUserId(Long userId) {
|
||||
return userRoleRepository.findRoleIdsByUserId(userId)
|
||||
.flatMap(roleId -> roleMenuRepository.findMenuIdsByRoleId(roleId))
|
||||
.flatMap(menuDao::findById)
|
||||
.map(converter::toDomain)
|
||||
.distinct();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysMenu> findAll() {
|
||||
return menuDao.findAll()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysMenu> save(SysMenu sysMenu) {
|
||||
return menuDao.save(converter.toEntity(sysMenu))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return menuDao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return menuDao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.dao.SysRoleMenuDao;
|
||||
import io.destiny.db.entity.SysRoleMenuEntity;
|
||||
import io.destiny.sys.core.repository.ISysRoleMenuRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SysRoleMenuRepository implements ISysRoleMenuRepository {
|
||||
|
||||
private final SysRoleMenuDao dao;
|
||||
|
||||
public SysRoleMenuRepository(SysRoleMenuDao dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Long> findMenuIdsByRoleId(Long roleId) {
|
||||
return dao.findByRoleId(roleId)
|
||||
.map(SysRoleMenuEntity::getMenuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> assignMenuToRole(Long roleId, Long menuId) {
|
||||
return dao.findByRoleId(roleId)
|
||||
.filter(entity -> entity.getMenuId().equals(menuId))
|
||||
.hasElements()
|
||||
.flatMap(exists -> {
|
||||
if (exists) {
|
||||
return Mono.error(new IllegalStateException("角色已拥有该菜单权限"));
|
||||
}
|
||||
SysRoleMenuEntity roleMenu = new SysRoleMenuEntity();
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenuId(menuId);
|
||||
return dao.save(roleMenu).then();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> removeMenuFromRole(Long roleId, Long menuId) {
|
||||
return dao.findByRoleId(roleId)
|
||||
.filter(entity -> entity.getMenuId().equals(menuId))
|
||||
.next()
|
||||
.switchIfEmpty(Mono.error(new IllegalStateException("角色未拥有该菜单权限")))
|
||||
.flatMap(dao::delete)
|
||||
.then();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> removeAllMenusFromRole(Long roleId) {
|
||||
return dao.findByRoleId(roleId)
|
||||
.flatMap(dao::delete)
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.converter.SysRoleConverter;
|
||||
import io.destiny.db.dao.SysRoleDao;
|
||||
import io.destiny.sys.core.domain.SysRole;
|
||||
import io.destiny.sys.core.repository.ISysRoleRepository;
|
||||
import io.destiny.sys.core.repository.ISysUserRoleRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SysRoleRepository implements ISysRoleRepository {
|
||||
|
||||
private final SysRoleDao roleDao;
|
||||
private final ISysUserRoleRepository userRoleRepository;
|
||||
private final SysRoleConverter converter;
|
||||
|
||||
public SysRoleRepository(SysRoleDao roleDao, ISysUserRoleRepository userRoleRepository, SysRoleConverter converter) {
|
||||
this.roleDao = roleDao;
|
||||
this.userRoleRepository = userRoleRepository;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysRole> findById(Long id) {
|
||||
return roleDao.findById(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysRole> findByRoleKey(String roleKey) {
|
||||
return roleDao.findByRoleKeyAndDeletedAtIsNull(roleKey)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysRole> findByUserId(Long userId) {
|
||||
return userRoleRepository.findRoleIdsByUserId(userId)
|
||||
.flatMap(roleDao::findById)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysRole> findAll() {
|
||||
return roleDao.findAll()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysRole> save(SysRole sysRole) {
|
||||
return roleDao.save(converter.toEntity(sysRole))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return roleDao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return roleDao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.converter.SysUserConverter;
|
||||
import io.destiny.db.dao.SysUserDao;
|
||||
import io.destiny.db.entity.SysUserEntity;
|
||||
import io.destiny.db.entity.query.SysUserQueryCriteria;
|
||||
import io.destiny.db.utils.QueryUtil;
|
||||
import io.destiny.sys.core.domain.SysUser;
|
||||
import io.destiny.sys.core.domain.query.SysUserQuery;
|
||||
import io.destiny.sys.core.repository.ISysUserRepository;
|
||||
import io.destiny.sys.core.repository.ISysUserRoleRepository;
|
||||
import io.destiny.common.request.PageQuery;
|
||||
import io.destiny.common.response.PageModel;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SysUserRepository implements ISysUserRepository {
|
||||
|
||||
private final SysUserDao dao;
|
||||
private final SysUserConverter converter;
|
||||
private final R2dbcEntityTemplate template;
|
||||
private final ISysUserRoleRepository sysUserRoleRepository;
|
||||
|
||||
public SysUserRepository(SysUserDao dao, SysUserConverter converter, R2dbcEntityTemplate template, ISysUserRoleRepository sysUserRoleRepository) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
this.template = template;
|
||||
this.sysUserRoleRepository = sysUserRoleRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysUser> findByUsername(String username) {
|
||||
return dao.findByUsernameAndDeletedAtIsNull(username)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysUser> findById(Long id) {
|
||||
return dao.findById(id)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SysUser> save(SysUser sysUser) {
|
||||
return dao.save(converter.toEntity(sysUser))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteById(Long id) {
|
||||
return dao.findById(id)
|
||||
.flatMap(entity -> {
|
||||
entity.setDeletedAt(java.time.LocalDateTime.now());
|
||||
return dao.save(entity);
|
||||
})
|
||||
.then();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<SysUser> findAll() {
|
||||
return dao.findByDeletedAtIsNull()
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageModel<SysUser>> findByQueryWithPagination(SysUserQuery query, PageQuery pageQuery) {
|
||||
SysUserQueryCriteria criteria = new SysUserQueryCriteria();
|
||||
criteria.convert(query);
|
||||
Query queryObj = QueryUtil.getQuery(criteria);
|
||||
|
||||
Sort sort = Sort.unsorted();
|
||||
if (pageQuery.hasSort()) {
|
||||
sort = Sort.by(Sort.Direction.fromString(pageQuery.getSortOrder()), pageQuery.getSortField());
|
||||
}
|
||||
|
||||
Pageable pageable = org.springframework.data.domain.PageRequest.of(
|
||||
pageQuery.getPageNum() - 1,
|
||||
pageQuery.getPageSize(),
|
||||
sort);
|
||||
|
||||
return template.select(SysUserEntity.class)
|
||||
.matching(queryObj.with(pageable))
|
||||
.all()
|
||||
.collectList()
|
||||
.zipWith(template.count(queryObj, SysUserEntity.class))
|
||||
.map(tuple -> new PageModel<>(
|
||||
tuple.getT2(),
|
||||
tuple.getT1().stream().map(converter::toDomain).toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> removeAllRolesFromUser(Long userId) {
|
||||
return sysUserRoleRepository.findRoleIdsByUserId(userId)
|
||||
.flatMap(roleId -> sysUserRoleRepository.removeRoleFromUser(userId, roleId))
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.db.dao.SysUserRoleDao;
|
||||
import io.destiny.db.entity.SysUserRoleEntity;
|
||||
import io.destiny.sys.core.repository.ISysUserRoleRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class SysUserRoleRepository implements ISysUserRoleRepository {
|
||||
|
||||
private final SysUserRoleDao dao;
|
||||
|
||||
public SysUserRoleRepository(SysUserRoleDao dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<Long> findRoleIdsByUserId(Long userId) {
|
||||
return dao.findByUserId(userId)
|
||||
.map(SysUserRoleEntity::getRoleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> assignRoleToUser(Long userId, Long roleId) {
|
||||
return dao.findByUserId(userId)
|
||||
.filter(entity -> entity.getRoleId().equals(roleId))
|
||||
.hasElements()
|
||||
.flatMap(exists -> {
|
||||
if (exists) {
|
||||
return Mono.error(new IllegalStateException("用户已拥有该角色"));
|
||||
}
|
||||
SysUserRoleEntity userRole = new SysUserRoleEntity();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(roleId);
|
||||
return dao.save(userRole).then();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> removeRoleFromUser(Long userId, Long roleId) {
|
||||
return dao.findByUserId(userId)
|
||||
.filter(entity -> entity.getRoleId().equals(roleId))
|
||||
.next()
|
||||
.switchIfEmpty(Mono.error(new IllegalStateException("用户未拥有该角色")))
|
||||
.flatMap(dao::delete)
|
||||
.then();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Mono<Void> removeAllUsersFromRole(Long roleId) {
|
||||
return dao.findByRoleId(roleId)
|
||||
.flatMap(dao::delete)
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.client.core.domain.UserBinding;
|
||||
import io.destiny.client.core.repository.IUserBindingRepository;
|
||||
import io.destiny.db.converter.UserBindingConverter;
|
||||
import io.destiny.db.dao.UserBindingDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class UserBindingRepository implements IUserBindingRepository {
|
||||
|
||||
private final UserBindingDao dao;
|
||||
private final UserBindingConverter converter;
|
||||
|
||||
public UserBindingRepository(UserBindingDao dao, UserBindingConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<UserBinding> save(UserBinding userBinding) {
|
||||
return dao.save(converter.toEntity(userBinding))
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<UserBinding> findByUserIdAndPlatform(Long userId, String platform) {
|
||||
return dao.findByUserIdAndPlatformAndDeletedAtIsNull(userId, platform)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<UserBinding> findByPlatformAndOpenId(String platform, String platformOpenId) {
|
||||
return dao.findByPlatformAndOpenIdAndDeletedAtIsNull(platform, platformOpenId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<UserBinding> findByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<UserBinding> findByPlatformAndUnionId(String platform, String platformUnionId) {
|
||||
return dao.findByPlatformAndUnionIdAndDeletedAtIsNull(platform, platformUnionId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteByUserIdAndPlatform(Long userId, String platform) {
|
||||
java.time.LocalDateTime now = java.time.LocalDateTime.now();
|
||||
return dao.deleteByUserIdAndPlatform(userId, platform, now, now)
|
||||
.then();
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.YearlyFortune;
|
||||
import io.destiny.biz.repository.IYearlyFortuneRepository;
|
||||
import io.destiny.db.converter.YearlyFortuneConverter;
|
||||
import io.destiny.db.dao.YearlyFortuneDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Year;
|
||||
|
||||
@Repository
|
||||
public class YearlyFortuneRepository implements IYearlyFortuneRepository {
|
||||
|
||||
private final YearlyFortuneDao dao;
|
||||
private final YearlyFortuneConverter converter;
|
||||
|
||||
public YearlyFortuneRepository(YearlyFortuneDao dao, YearlyFortuneConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<YearlyFortune> findByUserIdAndFortuneYear(Long userId, Year fortuneYear) {
|
||||
return dao.findByUserIdAndFortuneYearAndDeletedAtIsNull(userId, fortuneYear)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<YearlyFortune> findByUserId(Long userId) {
|
||||
return dao.findByUserIdAndDeletedAtIsNull(userId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<YearlyFortune> findByUserIdAndFortuneYearBetween(Long userId, Year startYear, Year endYear) {
|
||||
return dao.findByUserIdAndFortuneYearBetweenAndDeletedAtIsNull(userId, startYear, endYear)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package io.destiny.db.repository;
|
||||
|
||||
import io.destiny.biz.domain.ZiweiChart;
|
||||
import io.destiny.biz.repository.IZiweiChartRepository;
|
||||
import io.destiny.db.converter.ZiweiChartConverter;
|
||||
import io.destiny.db.dao.ZiweiChartDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class ZiweiChartRepository implements IZiweiChartRepository {
|
||||
|
||||
private final ZiweiChartDao dao;
|
||||
private final ZiweiChartConverter converter;
|
||||
|
||||
public ZiweiChartRepository(ZiweiChartDao dao, ZiweiChartConverter converter) {
|
||||
this.dao = dao;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ZiweiChart> findByBirthInfoId(Long birthInfoId) {
|
||||
return dao.findByBirthInfoIdAndDeletedAtIsNull(birthInfoId)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ZiweiChart> findByYearStem(String yearStem) {
|
||||
return dao.findByYearStemAndDeletedAtIsNull(yearStem)
|
||||
.map(converter::toDomain);
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package io.destiny.db.utils;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author zhangxiang
|
||||
* @version 1.0
|
||||
* @description 查询注解
|
||||
* @date 2023/10/31 14:34
|
||||
**/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface QueryField {
|
||||
|
||||
/**
|
||||
* 基本对象的属性名
|
||||
*/
|
||||
String propName() default "";
|
||||
|
||||
/**
|
||||
* 基本对象的属性名LIST OR
|
||||
*/
|
||||
String[] orPropNames() default {};
|
||||
|
||||
Type orPropVal() default Type.IS_NULL;
|
||||
|
||||
/**
|
||||
* 查询方式 默认精确查询
|
||||
*/
|
||||
Type type() default Type.EQUAL;
|
||||
|
||||
/**
|
||||
* 多表连接查询的属性名,如User类中的role
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String joinName() default "";
|
||||
|
||||
/**
|
||||
* 左连接
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Join join() default Join.LEFT;
|
||||
|
||||
/**
|
||||
* 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如用户名和手机号模糊查询@Query(blurry = "username,phone")
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String blurry() default "";
|
||||
|
||||
enum Type {
|
||||
/**
|
||||
* 相等,精确查询
|
||||
*/
|
||||
EQUAL,
|
||||
/**
|
||||
* 大于等于
|
||||
*/
|
||||
GREATER_THAN,
|
||||
/**
|
||||
* 小于等于
|
||||
*/
|
||||
LESS_THAN,
|
||||
/**
|
||||
* 左右均模糊查询: %a%
|
||||
*/
|
||||
INNER_LIKE,
|
||||
/**
|
||||
* 左模糊查询:%a
|
||||
*/
|
||||
LEFT_LIKE,
|
||||
/**
|
||||
* 非左模糊查询:%a
|
||||
*/
|
||||
NOT_LEFT_LIKE,
|
||||
/**
|
||||
* 右模糊查询: a%
|
||||
*/
|
||||
RIGHT_LIKE,
|
||||
/**
|
||||
* 小于
|
||||
*/
|
||||
LESS_THAN_NQ,
|
||||
/**
|
||||
* 在...范围内
|
||||
*/
|
||||
IN,
|
||||
/**
|
||||
* 或者
|
||||
*/
|
||||
OR,
|
||||
/**
|
||||
* 为空
|
||||
*/
|
||||
IS_NULL,
|
||||
/**
|
||||
* 不为空
|
||||
*/
|
||||
IS_NOT_NULL,
|
||||
}
|
||||
|
||||
enum Join {
|
||||
/**
|
||||
* 左连接
|
||||
*/
|
||||
LEFT,
|
||||
/**
|
||||
* 右连接
|
||||
*/
|
||||
RIGHT,
|
||||
}
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package io.destiny.db.utils;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.relational.core.query.Criteria;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangxiang
|
||||
* @version 1.0
|
||||
* @description 查询工具类
|
||||
* @date 2023/10/31 16:51
|
||||
**/
|
||||
public class QueryUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(QueryUtil.class);
|
||||
|
||||
public static <Q> Query getQuery(Q query) {
|
||||
return getQuery(query, true);
|
||||
}
|
||||
|
||||
public static <Q> Query getQueryAll(Q query) {
|
||||
return getQuery(query, false);
|
||||
}
|
||||
|
||||
public static <Q> Query getQuery(Q query, Boolean enabled) {
|
||||
Criteria criteria = Criteria.empty();
|
||||
if (enabled) {
|
||||
// 默认查询 deletedAt 为空的数据
|
||||
criteria = criteria.and("deletedAt").isNull();
|
||||
}
|
||||
if (query == null) {
|
||||
return Query.query(criteria);
|
||||
}
|
||||
try {
|
||||
List<Field> fields = getAllFields(query.getClass(), new ArrayList<>());
|
||||
for (Field field : fields) {
|
||||
boolean accessible = Modifier.isStatic(field.getModifiers()) ? field.canAccess(null)
|
||||
: field.canAccess(query);
|
||||
field.setAccessible(true);
|
||||
QueryField q = field.getAnnotation(QueryField.class);
|
||||
if (q != null) {
|
||||
String propName = q.propName();
|
||||
String blurry = q.blurry();
|
||||
String attributeName = isBlank(propName) ? field.getName() : propName;
|
||||
Object val = field.get(query);
|
||||
if (val == null || "".equals(val)) {
|
||||
continue;
|
||||
}
|
||||
// 模糊多字段
|
||||
if (StringUtils.isNotBlank(blurry)) {
|
||||
String[] blurrys = blurry.split(",");
|
||||
Criteria orCriteria = Criteria.empty();
|
||||
for (String s : blurrys) {
|
||||
orCriteria = orCriteria.or(s).like("%" + val + "%");
|
||||
}
|
||||
criteria = criteria.and(orCriteria);
|
||||
continue;
|
||||
}
|
||||
switch (q.type()) {
|
||||
case EQUAL:
|
||||
criteria = criteria.and(attributeName).is(val);
|
||||
break;
|
||||
case GREATER_THAN:
|
||||
criteria = criteria.and(attributeName).greaterThanOrEquals(val);
|
||||
break;
|
||||
case LESS_THAN:
|
||||
criteria = criteria.and(attributeName).lessThanOrEquals(val);
|
||||
break;
|
||||
case LESS_THAN_NQ:
|
||||
criteria = criteria.and(attributeName).lessThan(val);
|
||||
break;
|
||||
case INNER_LIKE:
|
||||
criteria = criteria.and(attributeName).like("%" + val + "%");
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
criteria = criteria.and(attributeName).like("%" + val);
|
||||
break;
|
||||
case NOT_LEFT_LIKE:
|
||||
criteria = criteria.and(attributeName).notLike("%" + val);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
criteria = criteria.and(attributeName).like(val + "%");
|
||||
break;
|
||||
case IN:
|
||||
if (val instanceof Collection && CollectionUtils.isNotEmpty((Collection<?>) val)) {
|
||||
criteria = criteria.and(attributeName).in((Collection<?>) val);
|
||||
}
|
||||
break;
|
||||
case OR:
|
||||
QueryField.Type orValue = q.orPropVal();
|
||||
String[] orPropNames = q.orPropNames();
|
||||
Criteria orPredicate = Criteria.empty();
|
||||
if (QueryField.Type.IS_NULL.equals(orValue)) {
|
||||
for (String prop : orPropNames) {
|
||||
orPredicate = orPredicate.or(prop).isNull();
|
||||
}
|
||||
}
|
||||
if (QueryField.Type.IS_NOT_NULL.equals(orValue)) {
|
||||
for (String prop : orPropNames) {
|
||||
orPredicate = orPredicate.or(prop).isNotNull();
|
||||
}
|
||||
}
|
||||
criteria = criteria.and(orPredicate);
|
||||
break;
|
||||
case IS_NULL:
|
||||
criteria = criteria.and(attributeName).isNull();
|
||||
break;
|
||||
case IS_NOT_NULL:
|
||||
criteria = criteria.and(attributeName).isNotNull();
|
||||
break;
|
||||
}
|
||||
}
|
||||
field.setAccessible(accessible);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return Query.query(criteria);
|
||||
}
|
||||
|
||||
public static boolean isBlank(final CharSequence cs) {
|
||||
int strLen;
|
||||
if (cs == null || (strLen = cs.length()) == 0) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < strLen; i++) {
|
||||
if (!Character.isWhitespace(cs.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static List<Field> getAllFields(Class<?> clazz, List<Field> fields) {
|
||||
if (clazz != null) {
|
||||
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||
getAllFields(clazz.getSuperclass(), fields);
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.flyway.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to enable Flyway.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.locations",
|
||||
"type": "java.lang.String[]",
|
||||
"description": "Locations of migrations scripts.",
|
||||
"defaultValue": "classpath:db/migration"
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.baseline-on-migrate",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.baseline-version",
|
||||
"type": "java.lang.String",
|
||||
"description": "Version to tag an existing schema with when executing baseline.",
|
||||
"defaultValue": "0"
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.validate-on-migrate",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to validate migrations before applying them.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.clean-disabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to disable Flyway's clean command.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.out-of-order",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to allow migrations to be run out of order.",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.placeholder-replacement",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Whether to perform placeholder replacement.",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.url",
|
||||
"type": "java.lang.String",
|
||||
"description": "JDBC URL of the database to migrate."
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.username",
|
||||
"type": "java.lang.String",
|
||||
"description": "Login user of the database to migrate."
|
||||
},
|
||||
{
|
||||
"name": "spring.flyway.password",
|
||||
"type": "java.lang.String",
|
||||
"description": "Login password of the database to migrate."
|
||||
}
|
||||
]
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE IF NOT EXISTS sms_verification_code (
|
||||
id BIGINT PRIMARY KEY,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
code VARCHAR(10) NOT NULL,
|
||||
type VARCHAR(20) NOT NULL,
|
||||
expire_time TIMESTAMP NOT NULL,
|
||||
verified BOOLEAN DEFAULT FALSE,
|
||||
verify_count INT DEFAULT 0,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_phone ON sms_verification_code(phone);
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_expire_time ON sms_verification_code(expire_time);
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_deleted_at ON sms_verification_code(deleted_at);
|
||||
|
||||
COMMENT ON TABLE sms_verification_code IS '短信验证码表';
|
||||
COMMENT ON COLUMN sms_verification_code.id IS '主键ID';
|
||||
COMMENT ON COLUMN sms_verification_code.phone IS '手机号';
|
||||
COMMENT ON COLUMN sms_verification_code.code IS '验证码';
|
||||
COMMENT ON COLUMN sms_verification_code.type IS '验证码类型';
|
||||
COMMENT ON COLUMN sms_verification_code.expire_time IS '过期时间';
|
||||
COMMENT ON COLUMN sms_verification_code.verified IS '是否已验证';
|
||||
COMMENT ON COLUMN sms_verification_code.verify_count IS '验证次数';
|
||||
COMMENT ON COLUMN sms_verification_code.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN sms_verification_code.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN sms_verification_code.deleted_at IS '删除时间';
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
-- 创建用户账号绑定表
|
||||
-- 用于存储用户与微信/抖音平台的绑定关系
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_binding (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
platform VARCHAR(20) NOT NULL,
|
||||
platform_open_id VARCHAR(100) NOT NULL,
|
||||
platform_union_id VARCHAR(100),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 创建索引
|
||||
CREATE INDEX IF NOT EXISTS idx_user_binding_user_id ON user_binding(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_binding_platform_union_id ON user_binding(platform_union_id);
|
||||
|
||||
-- 创建唯一索引,确保同一平台的同一open_id只能绑定一个用户
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_user_binding_platform_open_id ON user_binding(platform, platform_open_id);
|
||||
|
||||
-- 添加外键约束
|
||||
ALTER TABLE user_binding ADD CONSTRAINT fk_user_binding_user_id FOREIGN KEY (user_id) REFERENCES client_user(id) ON DELETE CASCADE;
|
||||
|
||||
-- 添加注释
|
||||
COMMENT ON TABLE user_binding IS '用户账号绑定表,用于管理用户与微信/抖音平台的绑定关系';
|
||||
COMMENT ON COLUMN user_binding.user_id IS '用户ID,关联client_user.id';
|
||||
COMMENT ON COLUMN user_binding.platform IS '平台类型:wechat/douyin';
|
||||
COMMENT ON COLUMN user_binding.platform_open_id IS '平台open_id,用于唯一标识用户';
|
||||
COMMENT ON COLUMN user_binding.platform_union_id IS '平台union_id,用于跨应用识别同一用户';
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
-- V12__Create_sys_tables.sql
|
||||
|
||||
-- 创建系统用户表
|
||||
CREATE TABLE IF NOT EXISTS sys_user (
|
||||
id BIGINT PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL,
|
||||
password VARCHAR(100) NOT NULL,
|
||||
email VARCHAR(100),
|
||||
phone VARCHAR(20),
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_sys_user_username ON sys_user(username);
|
||||
CREATE INDEX idx_sys_user_email ON sys_user(email);
|
||||
CREATE INDEX idx_sys_user_phone ON sys_user(phone);
|
||||
CREATE INDEX idx_sys_user_deleted_at ON sys_user(deleted_at);
|
||||
|
||||
-- 创建角色表
|
||||
CREATE TABLE IF NOT EXISTS sys_role (
|
||||
id BIGINT PRIMARY KEY,
|
||||
role_name VARCHAR(30) NOT NULL,
|
||||
role_key VARCHAR(100) NOT NULL,
|
||||
role_sort INT DEFAULT 0,
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_sys_role_key ON sys_role(role_key);
|
||||
CREATE INDEX idx_sys_role_deleted_at ON sys_role(deleted_at);
|
||||
|
||||
-- 创建用户角色关联表
|
||||
CREATE TABLE IF NOT EXISTS sys_user_role (
|
||||
user_id BIGINT NOT NULL,
|
||||
role_id BIGINT NOT NULL,
|
||||
PRIMARY KEY (user_id, role_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_user_role_user_id ON sys_user_role(user_id);
|
||||
CREATE INDEX idx_sys_user_role_role_id ON sys_user_role(role_id);
|
||||
|
||||
-- 创建菜单权限表
|
||||
CREATE TABLE IF NOT EXISTS sys_menu (
|
||||
id BIGINT PRIMARY KEY,
|
||||
menu_name VARCHAR(50) NOT NULL,
|
||||
parent_id BIGINT DEFAULT 0,
|
||||
order_num INT DEFAULT 0,
|
||||
menu_type VARCHAR(1) NOT NULL,
|
||||
perms VARCHAR(100),
|
||||
component VARCHAR(200),
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_menu_parent_id ON sys_menu(parent_id);
|
||||
CREATE INDEX idx_sys_menu_deleted_at ON sys_menu(deleted_at);
|
||||
|
||||
-- 创建角色菜单关联表
|
||||
CREATE TABLE IF NOT EXISTS sys_role_menu (
|
||||
role_id BIGINT NOT NULL,
|
||||
menu_id BIGINT NOT NULL,
|
||||
PRIMARY KEY (role_id, menu_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_menu_role_id ON sys_role_menu(role_id);
|
||||
CREATE INDEX idx_sys_role_menu_menu_id ON sys_role_menu(menu_id);
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
-- V13__Init_sys_data.sql
|
||||
|
||||
-- 插入超级管理员账号(密码:admin123456,BCrypt加密后的值)
|
||||
MERGE INTO sys_user (id, username, password, email, phone, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES (1, 'admin', '$2a$10$QYomzJFN9a0wJ1u8pGjiv.HNmqIvaQt/NFmqBG6e93TwgKIMNDmS.', 'admin@example.com', '13800138000', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 插入超级管理员角色
|
||||
MERGE INTO sys_role (id, role_name, role_key, role_sort, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES (1, '超级管理员', 'admin', 1, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 为超级管理员分配角色
|
||||
MERGE INTO sys_user_role (user_id, role_id)
|
||||
KEY (user_id, role_id)
|
||||
VALUES (1, 1);
|
||||
|
||||
-- 插入系统管理菜单
|
||||
INSERT INTO sys_menu (id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, created_at, updated_at) VALUES
|
||||
(1, '系统管理', 0, 1, 'M', NULL, NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(100, '用户管理', 1, 1, 'C', 'sys:user:list', 'system/user/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1001, '用户查询', 100, 1, 'F', 'sys:user:query', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1002, '用户新增', 100, 2, 'F', 'sys:user:add', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1003, '用户修改', 100, 3, 'F', 'sys:user:edit', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1004, '用户删除', 100, 4, 'F', 'sys:user:remove', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1005, '用户重置密码', 100, 5, 'F', 'sys:user:resetPwd', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(101, '角色管理', 1, 2, 'C', 'sys:role:list', 'system/role/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1011, '角色查询', 101, 1, 'F', 'sys:role:query', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1012, '角色新增', 101, 2, 'F', 'sys:role:add', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1013, '角色修改', 101, 3, 'F', 'sys:role:edit', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1014, '角色删除', 101, 4, 'F', 'sys:role:remove', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1015, '角色授权', 101, 5, 'F', 'sys:role:auth', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(102, '菜单管理', 1, 3, 'C', 'sys:menu:list', 'system/menu/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1021, '菜单查询', 102, 1, 'F', 'sys:menu:query', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1022, '菜单新增', 102, 2, 'F', 'sys:menu:add', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1023, '菜单修改', 102, 3, 'F', 'sys:menu:edit', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(1024, '菜单删除', 102, 4, 'F', 'sys:menu:remove', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 为超级管理员角色分配所有菜单权限
|
||||
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||
SELECT 1, id FROM sys_menu;
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
-- V14__Create_operation_log_table.sql
|
||||
|
||||
-- 创建操作日志表
|
||||
CREATE TABLE IF NOT EXISTS sys_operation_log (
|
||||
id BIGINT PRIMARY KEY,
|
||||
operator VARCHAR(50) NOT NULL,
|
||||
operation_time TIMESTAMP NOT NULL,
|
||||
request_path VARCHAR(200) NOT NULL,
|
||||
request_method VARCHAR(10) NOT NULL,
|
||||
request_params TEXT,
|
||||
response_result TEXT,
|
||||
ip_address VARCHAR(50),
|
||||
execution_time BIGINT,
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
exception_message TEXT,
|
||||
module_name VARCHAR(50),
|
||||
operation_desc VARCHAR(200),
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_operation_log_operator ON sys_operation_log(operator);
|
||||
CREATE INDEX idx_sys_operation_log_operation_time ON sys_operation_log(operation_time);
|
||||
CREATE INDEX idx_sys_operation_log_module_name ON sys_operation_log(module_name);
|
||||
CREATE INDEX idx_sys_operation_log_status ON sys_operation_log(status);
|
||||
CREATE INDEX idx_sys_operation_log_deleted_at ON sys_operation_log(deleted_at);
|
||||
|
||||
COMMENT ON TABLE sys_operation_log IS '系统操作日志表';
|
||||
COMMENT ON COLUMN sys_operation_log.id IS '主键ID';
|
||||
COMMENT ON COLUMN sys_operation_log.operator IS '操作人';
|
||||
COMMENT ON COLUMN sys_operation_log.operation_time IS '操作时间';
|
||||
COMMENT ON COLUMN sys_operation_log.request_path IS '请求路径';
|
||||
COMMENT ON COLUMN sys_operation_log.request_method IS '请求方法';
|
||||
COMMENT ON COLUMN sys_operation_log.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_operation_log.response_result IS '响应结果';
|
||||
COMMENT ON COLUMN sys_operation_log.ip_address IS '操作IP';
|
||||
COMMENT ON COLUMN sys_operation_log.execution_time IS '执行耗时(ms)';
|
||||
COMMENT ON COLUMN sys_operation_log.status IS '状态 0-成功 1-失败';
|
||||
COMMENT ON COLUMN sys_operation_log.exception_message IS '异常信息';
|
||||
COMMENT ON COLUMN sys_operation_log.module_name IS '模块名称';
|
||||
COMMENT ON COLUMN sys_operation_log.operation_desc IS '操作描述';
|
||||
COMMENT ON COLUMN sys_operation_log.create_by IS '创建人';
|
||||
COMMENT ON COLUMN sys_operation_log.update_by IS '更新人';
|
||||
COMMENT ON COLUMN sys_operation_log.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN sys_operation_log.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN sys_operation_log.deleted_at IS '删除时间';
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
-- V15__Add_diff_json_to_operation_log_table.sql
|
||||
|
||||
-- 添加 diff_json 字段到操作日志表
|
||||
ALTER TABLE sys_operation_log ADD COLUMN IF NOT EXISTS diff_json TEXT;
|
||||
|
||||
COMMENT ON COLUMN sys_operation_log.diff_json IS '对象变化差异JSON';
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
-- V16__Create_subscription_table.sql
|
||||
CREATE TABLE IF NOT EXISTS subscription (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
plan_type VARCHAR(50) NOT NULL,
|
||||
start_date TIMESTAMP NOT NULL,
|
||||
end_date TIMESTAMP NOT NULL,
|
||||
status VARCHAR(20) NOT NULL,
|
||||
amount DECIMAL(10, 2) NOT NULL,
|
||||
payment_method VARCHAR(50),
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_user_id ON subscription(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_status ON subscription(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_plan_type ON subscription(plan_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_start_date ON subscription(start_date);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_end_date ON subscription(end_date);
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_deleted_at ON subscription(deleted_at);
|
||||
COMMENT ON TABLE subscription IS '订阅服务表';
|
||||
COMMENT ON COLUMN subscription.id IS '主键ID';
|
||||
COMMENT ON COLUMN subscription.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN subscription.plan_type IS '订阅套餐类型';
|
||||
COMMENT ON COLUMN subscription.start_date IS '订阅开始时间';
|
||||
COMMENT ON COLUMN subscription.end_date IS '订阅结束时间';
|
||||
COMMENT ON COLUMN subscription.status IS '订阅状态';
|
||||
COMMENT ON COLUMN subscription.amount IS '订阅金额';
|
||||
COMMENT ON COLUMN subscription.payment_method IS '支付方式';
|
||||
COMMENT ON COLUMN subscription.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN subscription.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN subscription.deleted_at IS '删除时间';
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
-- V17__Create_export_task_table.sql
|
||||
CREATE TABLE IF NOT EXISTS export_task (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
task_type VARCHAR(50) NOT NULL,
|
||||
status VARCHAR(20) NOT NULL,
|
||||
file_path VARCHAR(255),
|
||||
file_name VARCHAR(255),
|
||||
file_size BIGINT,
|
||||
error_message TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_user_id ON export_task(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_status ON export_task(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_task_type ON export_task(task_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_created_at ON export_task(created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_deleted_at ON export_task(deleted_at);
|
||||
|
||||
COMMENT ON TABLE export_task IS '导出任务表';
|
||||
COMMENT ON COLUMN export_task.id IS '主键ID';
|
||||
COMMENT ON COLUMN export_task.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN export_task.task_type IS '任务类型';
|
||||
COMMENT ON COLUMN export_task.status IS '任务状态';
|
||||
COMMENT ON COLUMN export_task.file_path IS '文件路径';
|
||||
COMMENT ON COLUMN export_task.file_name IS '文件名';
|
||||
COMMENT ON COLUMN export_task.file_size IS '文件大小';
|
||||
COMMENT ON COLUMN export_task.error_message IS '错误信息';
|
||||
COMMENT ON COLUMN export_task.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN export_task.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN export_task.deleted_at IS '删除时间';
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
-- V18__Add_geo_fields_to_client_user_table.sql
|
||||
ALTER TABLE client_user ADD COLUMN country VARCHAR(50);
|
||||
ALTER TABLE client_user ADD COLUMN province VARCHAR(50);
|
||||
ALTER TABLE client_user ADD COLUMN city VARCHAR(50);
|
||||
|
||||
CREATE INDEX idx_client_user_country ON client_user(country);
|
||||
CREATE INDEX idx_client_user_province ON client_user(province);
|
||||
CREATE INDEX idx_client_user_city ON client_user(city);
|
||||
|
||||
COMMENT ON COLUMN client_user.country IS '国家';
|
||||
COMMENT ON COLUMN client_user.province IS '省份';
|
||||
COMMENT ON COLUMN client_user.city IS '城市';
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
-- V19__Add_dashboard_menu_and_permissions.sql
|
||||
|
||||
-- 添加仪表盘菜单
|
||||
MERGE INTO sys_menu (id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES (2, '仪表盘', 0, 0, 'C', 'sys:dashboard:view', 'dashboard/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 添加操作日志菜单
|
||||
MERGE INTO sys_menu (id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES
|
||||
(3, '操作日志', 0, 4, 'C', 'sys:operationLog:list', 'system/operationLog/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(31, '日志查询', 3, 1, 'F', 'sys:operationLog:query', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(32, '日志导出', 3, 2, 'F', 'sys:operationLog:export', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 添加权限管理菜单
|
||||
MERGE INTO sys_menu (id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES
|
||||
(4, '权限管理', 1, 4, 'C', 'sys:permission:list', 'system/permission/index', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(41, '权限查询', 4, 1, 'F', 'sys:permission:query', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(42, '权限新增', 4, 2, 'F', 'sys:permission:add', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(43, '权限修改', 4, 3, 'F', 'sys:permission:edit', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
(44, '权限删除', 4, 4, 'F', 'sys:permission:remove', NULL, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 为超级管理员角色分配新增的菜单权限
|
||||
MERGE INTO sys_role_menu (role_id, menu_id)
|
||||
KEY (role_id, menu_id)
|
||||
VALUES
|
||||
(1, 2),
|
||||
(1, 3),
|
||||
(1, 4);
|
||||
|
||||
-- 创建普通用户角色
|
||||
MERGE INTO sys_role (id, role_name, role_key, role_sort, status, create_by, created_at, updated_at)
|
||||
KEY (id)
|
||||
VALUES (2, '普通用户', 'user', 2, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- 为普通用户角色分配仪表盘权限
|
||||
MERGE INTO sys_role_menu (role_id, menu_id)
|
||||
KEY (role_id, menu_id)
|
||||
VALUES (2, 2);
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
-- V1__Create_birth_info_table.sql
|
||||
CREATE TABLE IF NOT EXISTS birth_info (
|
||||
id BIGINT PRIMARY KEY,
|
||||
birth_time TIMESTAMP NOT NULL,
|
||||
year_stem VARCHAR(10) NOT NULL,
|
||||
year_branch VARCHAR(10) NOT NULL,
|
||||
month_stem VARCHAR(10) NOT NULL,
|
||||
month_branch VARCHAR(10) NOT NULL,
|
||||
day_stem VARCHAR(10) NOT NULL,
|
||||
day_branch VARCHAR(10) NOT NULL,
|
||||
hour_stem VARCHAR(10) NOT NULL,
|
||||
hour_branch VARCHAR(10) NOT NULL,
|
||||
gender VARCHAR(10) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_birth_info_birth_time ON birth_info(birth_time);
|
||||
CREATE INDEX idx_birth_info_year_branch ON birth_info(year_branch);
|
||||
CREATE INDEX idx_birth_info_month_branch ON birth_info(month_branch);
|
||||
CREATE INDEX idx_birth_info_day_branch ON birth_info(day_branch);
|
||||
CREATE INDEX idx_birth_info_hour_branch ON birth_info(hour_branch);
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
-- V20__Fix_user_id_auto_generation.sql
|
||||
-- 修改sys_user表,添加ID自动生成功能
|
||||
-- H2数据库使用IDENTITY语法
|
||||
|
||||
-- 1. 删除主键约束
|
||||
ALTER TABLE sys_user DROP CONSTRAINT IF EXISTS sys_user_pkey;
|
||||
|
||||
-- 2. 重新创建表,使用IDENTITY
|
||||
-- 由于H2不支持直接修改列为IDENTITY,需要重新创建表
|
||||
CREATE TABLE sys_user_new AS SELECT * FROM sys_user;
|
||||
|
||||
-- 删除原表
|
||||
DROP TABLE sys_user;
|
||||
|
||||
-- 创建新表,使用IDENTITY
|
||||
CREATE TABLE sys_user (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(100),
|
||||
phone VARCHAR(20),
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 插入数据
|
||||
INSERT INTO sys_user (id, username, password, email, phone, status, create_by, update_by, created_at, updated_at, deleted_at)
|
||||
SELECT id, username, password, email, phone, status, create_by, update_by, created_at, updated_at, deleted_at FROM sys_user_new;
|
||||
|
||||
-- 删除临时表
|
||||
DROP TABLE sys_user_new;
|
||||
|
||||
-- 3. 为其他表也做同样的修改
|
||||
ALTER TABLE sys_role DROP CONSTRAINT IF EXISTS sys_role_pkey;
|
||||
CREATE TABLE sys_role_new AS SELECT * FROM sys_role;
|
||||
DROP TABLE sys_role;
|
||||
CREATE TABLE sys_role (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
role_name VARCHAR(50) NOT NULL,
|
||||
role_key VARCHAR(50) NOT NULL UNIQUE,
|
||||
role_sort INT,
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
INSERT INTO sys_role (id, role_name, role_key, role_sort, status, create_by, update_by, created_at, updated_at, deleted_at)
|
||||
SELECT id, role_name, role_key, role_sort, status, create_by, update_by, created_at, updated_at, deleted_at FROM sys_role_new;
|
||||
DROP TABLE sys_role_new;
|
||||
|
||||
ALTER TABLE sys_menu DROP CONSTRAINT IF EXISTS sys_menu_pkey;
|
||||
CREATE TABLE sys_menu_new AS SELECT * FROM sys_menu;
|
||||
DROP TABLE sys_menu;
|
||||
CREATE TABLE sys_menu (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
menu_name VARCHAR(50) NOT NULL,
|
||||
parent_id BIGINT DEFAULT 0,
|
||||
order_num INT DEFAULT 0,
|
||||
menu_type VARCHAR(1) DEFAULT 'M',
|
||||
perms VARCHAR(100),
|
||||
component VARCHAR(200),
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
INSERT INTO sys_menu (id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, update_by, created_at, updated_at, deleted_at)
|
||||
SELECT id, menu_name, parent_id, order_num, menu_type, perms, component, status, create_by, update_by, created_at, updated_at, deleted_at FROM sys_menu_new;
|
||||
DROP TABLE sys_menu_new;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
-- V21__Add_id_to_sys_user_role.sql
|
||||
|
||||
-- 为sys_user_role表添加id字段
|
||||
-- H2数据库使用IDENTITY语法
|
||||
|
||||
-- 1. 创建临时表
|
||||
CREATE TABLE sys_user_role_new AS SELECT * FROM sys_user_role;
|
||||
|
||||
-- 2. 删除原表
|
||||
DROP TABLE sys_user_role;
|
||||
|
||||
-- 3. 创建新表,使用IDENTITY
|
||||
CREATE TABLE sys_user_role (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
role_id BIGINT NOT NULL
|
||||
);
|
||||
|
||||
-- 4. 插入数据
|
||||
INSERT INTO sys_user_role (user_id, role_id)
|
||||
SELECT user_id, role_id FROM sys_user_role_new;
|
||||
|
||||
-- 5. 删除临时表
|
||||
DROP TABLE sys_user_role_new;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
-- V22__Add_id_to_sys_role_menu.sql
|
||||
|
||||
-- 为sys_role_menu表添加id字段
|
||||
-- H2数据库使用IDENTITY语法
|
||||
|
||||
-- 1. 创建临时表
|
||||
CREATE TABLE sys_role_menu_new AS SELECT * FROM sys_role_menu;
|
||||
|
||||
-- 2. 删除原表
|
||||
DROP TABLE sys_role_menu;
|
||||
|
||||
-- 3. 创建新表,使用IDENTITY
|
||||
CREATE TABLE sys_role_menu (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
role_id BIGINT NOT NULL,
|
||||
menu_id BIGINT NOT NULL
|
||||
);
|
||||
|
||||
-- 4. 插入数据
|
||||
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||
SELECT role_id, menu_id FROM sys_role_menu_new;
|
||||
|
||||
-- 5. 删除临时表
|
||||
DROP TABLE sys_role_menu_new;
|
||||
+236
@@ -0,0 +1,236 @@
|
||||
-- V23__Add_performance_indexes.sql
|
||||
-- 性能优化:添加数据库索引以提升查询性能
|
||||
|
||||
-- ============================================
|
||||
-- 系统用户表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加状态索引(用于查询活跃用户)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_user_status ON sys_user(status);
|
||||
|
||||
-- 添加创建时间索引(用于按时间排序查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_user_created_at ON sys_user(created_at DESC);
|
||||
|
||||
-- 添加复合索引(用于用户列表查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_user_status_created_at ON sys_user(status, created_at DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 角色表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加状态索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_role_status ON sys_role(status);
|
||||
|
||||
-- 添加排序索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_role_sort ON sys_role(role_sort);
|
||||
|
||||
-- ============================================
|
||||
-- 菜单表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加菜单类型索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_menu_type ON sys_menu(menu_type);
|
||||
|
||||
-- 添加排序索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_menu_order_num ON sys_menu(order_num);
|
||||
|
||||
-- 添加状态索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_menu_status ON sys_menu(status);
|
||||
|
||||
-- 添加复合索引(用于菜单树查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_menu_parent_status ON sys_menu(parent_id, status);
|
||||
|
||||
-- ============================================
|
||||
-- 操作日志表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加执行时间索引(用于性能分析)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_operation_log_execution_time ON sys_operation_log(execution_time);
|
||||
|
||||
-- 添加复合索引(用于日志查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_operation_log_operator_time ON sys_operation_log(operator, operation_time DESC);
|
||||
|
||||
-- 添加复合索引(用于模块日志查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_operation_log_module_time ON sys_operation_log(module_name, operation_time DESC);
|
||||
|
||||
-- 添加复合索引(用于状态和时间查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_sys_operation_log_status_time ON sys_operation_log(status, operation_time DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 客户端用户表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加性别索引
|
||||
CREATE INDEX IF NOT EXISTS idx_client_user_gender ON client_user(gender);
|
||||
|
||||
-- 添加创建时间索引
|
||||
CREATE INDEX IF NOT EXISTS idx_client_user_created_at ON client_user(created_at DESC);
|
||||
|
||||
-- 添加生日索引(用于生日查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_client_user_birth_time ON client_user(birth_time);
|
||||
|
||||
-- ============================================
|
||||
-- 客户端登录日志表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_client_login_log_client_user_id ON client_login_log(client_user_id);
|
||||
|
||||
-- 添加登录时间索引(用于最近登录查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_client_login_log_login_time ON client_login_log(login_time DESC);
|
||||
|
||||
-- 添加复合索引(用于用户登录历史查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_client_login_log_client_user_time ON client_login_log(client_user_id, login_time DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 用户绑定表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加平台索引
|
||||
CREATE INDEX IF NOT EXISTS idx_user_binding_platform ON user_binding(platform);
|
||||
|
||||
-- 添加复合索引(用于平台用户查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_user_binding_platform_openid ON user_binding(platform, platform_open_id);
|
||||
|
||||
-- 添加复合索引(用于平台UnionID查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_user_binding_platform_unionid ON user_binding(platform, platform_union_id);
|
||||
|
||||
-- ============================================
|
||||
-- 短信验证码表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加手机号索引
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_phone ON sms_verification_code(phone);
|
||||
|
||||
-- 添加过期时间索引(用于清理过期验证码)
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_expire_time ON sms_verification_code(expire_time);
|
||||
|
||||
-- 添加复合索引(用于验证码验证)
|
||||
CREATE INDEX IF NOT EXISTS idx_sms_verification_code_phone_expire ON sms_verification_code(phone, expire_time);
|
||||
|
||||
-- ============================================
|
||||
-- 导出任务表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_user_id ON export_task(user_id);
|
||||
|
||||
-- 添加任务状态索引
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_status ON export_task(status);
|
||||
|
||||
-- 添加创建时间索引
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_created_at ON export_task(created_at DESC);
|
||||
|
||||
-- 添加复合索引(用于用户任务查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_export_task_user_status ON export_task(user_id, status, created_at DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 订阅表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_user_id ON subscription(user_id);
|
||||
|
||||
-- 添加订阅类型索引
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_plan_type ON subscription(plan_type);
|
||||
|
||||
-- 添加状态索引
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_status ON subscription(status);
|
||||
|
||||
-- 添加过期时间索引
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_end_date ON subscription(end_date);
|
||||
|
||||
-- 添加复合索引(用于用户订阅查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_subscription_user_status_end ON subscription(user_id, status, end_date);
|
||||
|
||||
-- ============================================
|
||||
-- 紫微排盘表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加出生信息ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_ziwei_chart_birth_info_id ON ziwei_chart(birth_info_id);
|
||||
|
||||
-- 添加创建时间索引
|
||||
CREATE INDEX IF NOT EXISTS idx_ziwei_chart_created_at ON ziwei_chart(created_at DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 宫位表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加紫微排盘ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_palace_ziwei_chart_id ON palace(ziwei_chart_id);
|
||||
|
||||
-- 添加宫位类型索引
|
||||
CREATE INDEX IF NOT EXISTS idx_palace_palace_type ON palace(palace_type);
|
||||
|
||||
-- 添加复合索引(用于宫位查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_palace_chart_type ON palace(ziwei_chart_id, palace_type);
|
||||
|
||||
-- ============================================
|
||||
-- 每日运势表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_daily_fortune_user_id ON daily_fortune(user_id);
|
||||
|
||||
-- 添加运势日期索引
|
||||
CREATE INDEX IF NOT EXISTS idx_daily_fortune_fortune_date ON daily_fortune(fortune_date);
|
||||
|
||||
-- 添加复合索引(用于用户每日运势查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_daily_fortune_user_date ON daily_fortune(user_id, fortune_date DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 每月运势表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_monthly_fortune_user_id ON monthly_fortune(user_id);
|
||||
|
||||
-- 添加运势月份索引
|
||||
CREATE INDEX IF NOT EXISTS idx_monthly_fortune_fortune_month ON monthly_fortune(fortune_month);
|
||||
|
||||
-- 添加复合索引(用于用户每月运势查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_monthly_fortune_user_month ON monthly_fortune(user_id, fortune_month DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 每年运势表索引优化
|
||||
-- ============================================
|
||||
|
||||
-- 添加用户ID索引
|
||||
CREATE INDEX IF NOT EXISTS idx_yearly_fortune_user_id ON yearly_fortune(user_id);
|
||||
|
||||
-- 添加运势年份索引
|
||||
CREATE INDEX IF NOT EXISTS idx_yearly_fortune_fortune_year ON yearly_fortune(fortune_year);
|
||||
|
||||
-- 添加复合索引(用于用户每年运势查询)
|
||||
CREATE INDEX IF NOT EXISTS idx_yearly_fortune_user_year ON yearly_fortune(user_id, fortune_year DESC);
|
||||
|
||||
-- ============================================
|
||||
-- 索引性能分析
|
||||
-- ============================================
|
||||
|
||||
-- 创建索引统计信息表(用于监控索引使用情况)
|
||||
CREATE TABLE IF NOT EXISTS index_usage_stats (
|
||||
id SERIAL PRIMARY KEY,
|
||||
table_name VARCHAR(100) NOT NULL,
|
||||
index_name VARCHAR(100) NOT NULL,
|
||||
index_type VARCHAR(50),
|
||||
idx_scan BIGINT DEFAULT 0,
|
||||
idx_tup_read BIGINT DEFAULT 0,
|
||||
idx_tup_fetch BIGINT DEFAULT 0,
|
||||
last_analyzed TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_index_usage_stats_table ON index_usage_stats(table_name);
|
||||
CREATE INDEX IF NOT EXISTS idx_index_usage_stats_updated ON index_usage_stats(updated_at);
|
||||
|
||||
COMMENT ON TABLE index_usage_stats IS '索引使用统计表';
|
||||
COMMENT ON COLUMN index_usage_stats.table_name IS '表名';
|
||||
COMMENT ON COLUMN index_usage_stats.index_name IS '索引名';
|
||||
COMMENT ON COLUMN index_usage_stats.index_type IS '索引类型';
|
||||
COMMENT ON COLUMN index_usage_stats.idx_scan IS '索引扫描次数';
|
||||
COMMENT ON COLUMN index_usage_stats.idx_tup_read IS '索引读取元组数';
|
||||
COMMENT ON COLUMN index_usage_stats.idx_tup_fetch IS '索引获取元组数';
|
||||
COMMENT ON COLUMN index_usage_stats.last_analyzed IS '最后分析时间';
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
-- V24__Add_test_user.sql
|
||||
|
||||
-- 插入测试用户(密码:user123,BCrypt加密后的值)
|
||||
INSERT INTO sys_user (id, username, password, email, phone, status, create_by, created_at, updated_at)
|
||||
SELECT 2, 'user', '$2a$10$QR8EIE13IAuF1WCj57VEjuvaIn.rYhK/tcmbWNjvpjB08aDmCxPP.', 'user@example.com', '13900139000', '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_user WHERE id = 2);
|
||||
|
||||
-- 插入普通用户角色
|
||||
INSERT INTO sys_role (id, role_name, role_key, role_sort, status, create_by, created_at, updated_at)
|
||||
SELECT 2, '普通用户', 'user', 2, '0', 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_role WHERE id = 2);
|
||||
|
||||
-- 为测试用户分配角色
|
||||
INSERT INTO sys_user_role (user_id, role_id)
|
||||
SELECT 2, 2
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_user_role WHERE user_id = 2 AND role_id = 2);
|
||||
|
||||
-- 为普通用户角色分配基础菜单权限(只读权限)
|
||||
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||
SELECT 2, id FROM sys_menu WHERE menu_type = 'M'
|
||||
AND NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 2 AND menu_id = sys_menu.id);
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
-- V2__Create_ziwei_chart_table.sql
|
||||
CREATE TABLE IF NOT EXISTS ziwei_chart (
|
||||
id BIGINT PRIMARY KEY,
|
||||
birth_info_id BIGINT NOT NULL,
|
||||
year_stem VARCHAR(10) NOT NULL,
|
||||
year_branch VARCHAR(10) NOT NULL,
|
||||
month_stem VARCHAR(10) NOT NULL,
|
||||
month_branch VARCHAR(10) NOT NULL,
|
||||
day_stem VARCHAR(10) NOT NULL,
|
||||
day_branch VARCHAR(10) NOT NULL,
|
||||
hour_stem VARCHAR(10) NOT NULL,
|
||||
hour_branch VARCHAR(10) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
CONSTRAINT fk_ziwei_chart_birth_info FOREIGN KEY (birth_info_id) REFERENCES birth_info(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_ziwei_chart_birth_info_id ON ziwei_chart(birth_info_id);
|
||||
CREATE INDEX idx_ziwei_chart_year_stem ON ziwei_chart(year_stem);
|
||||
CREATE INDEX idx_ziwei_chart_year_branch ON ziwei_chart(year_branch);
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
-- V3__Create_palace_table.sql
|
||||
CREATE TABLE IF NOT EXISTS palace (
|
||||
id BIGINT PRIMARY KEY,
|
||||
ziwei_chart_id BIGINT NOT NULL,
|
||||
palace_type VARCHAR(50) NOT NULL,
|
||||
main_star VARCHAR(50),
|
||||
minor_stars JSONB,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
CONSTRAINT fk_palace_ziwei_chart FOREIGN KEY (ziwei_chart_id) REFERENCES ziwei_chart(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_palace_ziwei_chart_id ON palace(ziwei_chart_id);
|
||||
CREATE INDEX idx_palace_palace_type ON palace(palace_type);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
-- V4__Create_daily_fortune_table.sql
|
||||
CREATE TABLE IF NOT EXISTS daily_fortune (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
fortune_date DATE NOT NULL,
|
||||
overall_score INTEGER,
|
||||
overall_comment TEXT,
|
||||
palace_fortunes JSONB,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_daily_fortune_user_id ON daily_fortune(user_id);
|
||||
CREATE INDEX idx_daily_fortune_fortune_date ON daily_fortune(fortune_date);
|
||||
CREATE INDEX idx_daily_fortune_user_date ON daily_fortune(user_id, fortune_date);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user