init
35
.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
.idea/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
36
README.en.md
Normal file
@ -0,0 +1,36 @@
|
||||
# DFB-web
|
||||
|
||||
#### Description
|
||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
155
pom.xml
Normal file
@ -0,0 +1,155 @@
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>com.DFB</groupId>
|
||||
<artifactId>dfb-web-admin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!--开发Web应用程序的Starter, @Controller、@RestController、@RequestMapping-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--注解生成getter、setter、toString等方法-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!--MyBatis Plus, @Mapper注解添加到DAO (数据访问对象) 接口中-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--JUnit 5的API模块,用于编写单元测试, @Test、@BeforeEach、@AfterEach-->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- sqlserver驱动-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<version>9.4.1.jre8</version>
|
||||
</dependency>
|
||||
|
||||
<!--Druid数据库连接池, 将@Configuration注解添加到一个类中,用于配置Druid连接池的相关属性-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.23</version>
|
||||
</dependency>
|
||||
|
||||
<!--Apache Velocity模板引擎的核心库, 不需要为它添加额外的注解-->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--Redis (一个高性能内存数据库) 的Starter, @Component或@Configuration-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--缓存功能的Starter, 将@EnableCaching注解添加到一个类上,用于启用缓存功能-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--生成MyBatis Plus代码的工具, @Component添加到GeneratorConfiguration的类中-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--面向切面编程 (AOP)-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--JSON与Java对象之间的相互转换-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.76</version>
|
||||
</dependency>
|
||||
|
||||
<!--一个Java持久层框架,用于将数据库操作与应用程序解耦-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云对象存储 (Cloud Object Storage, COS) API的库-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>5.6.133</version>
|
||||
</dependency>
|
||||
|
||||
<!--jwt令牌-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.7.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-spring-web</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<!-- 验证码图片工具-->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>3.2.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
46
settings.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
|
||||
<pluginGroups>
|
||||
|
||||
</pluginGroups>
|
||||
|
||||
<proxies>
|
||||
|
||||
</proxies>
|
||||
|
||||
|
||||
<servers>
|
||||
|
||||
</servers>
|
||||
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>alimaven</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
|
||||
</mirror>
|
||||
|
||||
</mirrors>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>JDK-8</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<jdk>8</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
|
||||
</settings>
|
19
src/main/java/com/mijiu/DFBApplication.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.mijiu;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@ServletComponentScan
|
||||
public class DFBApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DFBApplication.class, args);
|
||||
log.info("项目启动成功...");
|
||||
}
|
||||
}
|
23
src/main/java/com/mijiu/common/Util/AdminHolder.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
|
||||
import com.mijiu.entity.vo.Administrator;
|
||||
|
||||
/**
|
||||
* @author mijiupro
|
||||
*/
|
||||
public class AdminHolder { private static final ThreadLocal<Administrator> TOKEN_HOLDER = new ThreadLocal<>();
|
||||
|
||||
public static void setInfoByToken(Administrator administrator) {
|
||||
TOKEN_HOLDER.set(administrator);
|
||||
}
|
||||
|
||||
public static Administrator getInfoByToken() {
|
||||
return TOKEN_HOLDER.get();
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
TOKEN_HOLDER.remove();
|
||||
}
|
||||
|
||||
}
|
26
src/main/java/com/mijiu/common/Util/BaseContext.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
/**
|
||||
* 基于ThreadLocal封装工具类,用户保存和获取当前登录用户id
|
||||
*/
|
||||
public class BaseContext {
|
||||
private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 获取值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Long getCurrentId() {
|
||||
return threadLocal.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public static void setCurrentId(Long id) {
|
||||
threadLocal.set(id);
|
||||
}
|
||||
}
|
56
src/main/java/com/mijiu/common/Util/JacksonObjectMapper.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
|
||||
|
||||
/**
|
||||
* 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象
|
||||
* 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象]
|
||||
* 从Java对象生成JSON的过程称为 [序列化Java对象到JSON]
|
||||
*/
|
||||
public class JacksonObjectMapper extends ObjectMapper {
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
||||
public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
public JacksonObjectMapper() {
|
||||
super();
|
||||
//收到未知属性时不报异常
|
||||
this.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
//反序列化时,属性不存在的兼容处理
|
||||
this.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
|
||||
|
||||
SimpleModule simpleModule = new SimpleModule()
|
||||
.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
|
||||
.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
|
||||
.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)))
|
||||
|
||||
.addSerializer(BigInteger.class, ToStringSerializer.instance)
|
||||
.addSerializer(Long.class, ToStringSerializer.instance)
|
||||
.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
|
||||
.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
|
||||
.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
|
||||
//注册功能模块 例如,可以添加自定义序列化器和反序列化器
|
||||
this.registerModule(simpleModule);
|
||||
}
|
||||
}
|
103
src/main/java/com/mijiu/common/Util/JwtUtils.java
Normal file
@ -0,0 +1,103 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author mijiupro
|
||||
*/
|
||||
@Data
|
||||
public class JwtUtils {
|
||||
|
||||
private static String secret="123456";//密钥
|
||||
private static long expiration=4320000000L;//过期时间
|
||||
|
||||
|
||||
/**
|
||||
* 生成token令牌
|
||||
* @param claims JWT第二部分负载 payload 中存储的内容
|
||||
* @param subject 主题(用户类型)
|
||||
* @return token
|
||||
*/
|
||||
public static String generateToken(Map<String,Object> claims, String subject) {
|
||||
return Jwts.builder()
|
||||
.setId(Claims.ID)//设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为令牌的唯一标识。
|
||||
.setSubject("mijiu")//设置主题,一般为用户类型
|
||||
.setIssuedAt(new Date())//设置签发时间
|
||||
.addClaims(claims)//设置负载
|
||||
.signWith(SignatureAlgorithm.HS256, secret)//设置签名算法
|
||||
.setExpiration(new Date(System.currentTimeMillis() + expiration))//设置令牌过期时间
|
||||
.compact();//生成令牌
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析token令牌
|
||||
* @param token token令牌
|
||||
* @return 负载
|
||||
*/
|
||||
public static Claims parseToken(String token) {
|
||||
|
||||
return Jwts.parser()
|
||||
.setSigningKey(secret)
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证token令牌
|
||||
* @param token 令牌
|
||||
* @return 是否有效
|
||||
*/
|
||||
public static boolean validateToken(String token) {
|
||||
try {
|
||||
Jwts.parser()
|
||||
.setSigningKey(secret)
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新Token
|
||||
* @param token 旧的Token令牌
|
||||
* @return 新的Token令牌
|
||||
*/
|
||||
public String refreshToken(String token) {
|
||||
try {
|
||||
// 解析旧的Token,获取负载信息
|
||||
Claims claims = parseToken(token);
|
||||
// 生成新的Token,设置过期时间和签名算法等参数
|
||||
return generateToken(claims, claims.getSubject());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法刷新令牌!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从令牌中获取主题信息
|
||||
* @param token 令牌
|
||||
* @return 主题信息(用户类型)
|
||||
*/
|
||||
public String getSubjectFromToken(String token) {
|
||||
try {
|
||||
Claims claims = parseToken(token); // 解析令牌,获取负载信息
|
||||
return claims.getSubject(); // 返回主题信息
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法从令牌中获取主题。", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
48
src/main/java/com/mijiu/common/Util/MyMetaObjecthandler.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 自定义元数据对象处理器
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MyMetaObjecthandler implements MetaObjectHandler {
|
||||
/**
|
||||
* 插入操作,自动填充
|
||||
*
|
||||
* @param metaObject
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
log.info("公共字段自动填充[insert]...");
|
||||
log.info(metaObject.toString());
|
||||
|
||||
metaObject.setValue("createTime", LocalDateTime.now());
|
||||
metaObject.setValue("updateTime", LocalDateTime.now());
|
||||
metaObject.setValue("createStaff", BaseContext.getCurrentId());
|
||||
metaObject.setValue("updateStaff", BaseContext.getCurrentId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新操作,自动填充
|
||||
*
|
||||
* @param metaObject
|
||||
*/
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
log.info("公共字段自动填充[update]...");
|
||||
log.info(metaObject.toString());
|
||||
|
||||
long id = Thread.currentThread().getId();
|
||||
log.info("线程id为:{}", id);
|
||||
|
||||
metaObject.setValue("updateTime", LocalDateTime.now());
|
||||
metaObject.setValue("updateStaff", BaseContext.getCurrentId());
|
||||
}
|
||||
}
|
44
src/main/java/com/mijiu/common/Util/ValidateCodeUtils.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.mijiu.common.Util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 随机生成验证码工具类
|
||||
*/
|
||||
public class ValidateCodeUtils {
|
||||
/**
|
||||
* 随机生成验证码
|
||||
*
|
||||
* @param length 长度为4位或者6位
|
||||
* @return
|
||||
*/
|
||||
public static Integer generateValidateCode(int length) {
|
||||
Integer code = null;
|
||||
if (length == 4) {
|
||||
code = new Random().nextInt(9999);//生成随机数,最大为9999
|
||||
if (code < 1000) {
|
||||
code = code + 1000;//保证随机数为4位数字
|
||||
}
|
||||
} else if (length == 6) {
|
||||
code = new Random().nextInt(999999);//生成随机数,最大为999999
|
||||
if (code < 100000) {
|
||||
code = code + 100000;//保证随机数为6位数字
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("只能生成4位或6位数字验证码");
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机生成指定长度字符串验证码
|
||||
*
|
||||
* @param length 长度
|
||||
* @return
|
||||
*/
|
||||
public static String generateValidateCode4String(int length) {
|
||||
Random rdm = new Random();
|
||||
String hash1 = Integer.toHexString(rdm.nextInt());
|
||||
return hash1.substring(0, length);
|
||||
}
|
||||
}
|
12
src/main/java/com/mijiu/common/annotation/Log.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.mijiu.common.annotation;
|
||||
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Log {
|
||||
}
|
59
src/main/java/com/mijiu/common/aop/LogAspect.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.mijiu.common.annotation.aop;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class LogAspect {
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Around("@annotation(com.mijiu.common.annotation.Log)")
|
||||
public Object recordTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
|
||||
//操作时间
|
||||
LocalDateTime operateTime = LocalDateTime.now();
|
||||
|
||||
//操作类名
|
||||
String className = joinPoint.getTarget().getClass().getName();
|
||||
|
||||
//操作方法名
|
||||
String methodName = joinPoint.getSignature().getName();
|
||||
|
||||
//操作返回参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
String methodParams = Arrays.toString(args);
|
||||
|
||||
long begin = System.currentTimeMillis();
|
||||
|
||||
//原始方法运行
|
||||
Object result = joinPoint.proceed();
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
//操作方法返回值
|
||||
String returnValue = JSONObject.toJSONString(result);
|
||||
|
||||
//操作耗时
|
||||
long costTime = end - begin;
|
||||
|
||||
//操作id
|
||||
Long operateUser = (Long) request.getSession().getAttribute("StaffDfb");
|
||||
log.info("操作者id: " + operateUser);
|
||||
|
||||
//回写进表或者其他
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
20
src/main/java/com/mijiu/common/config/MybatisPlusConfig.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.mijiu.common.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 配置MP的分页插件
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
}
|
27
src/main/java/com/mijiu/common/config/RedisConfig.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.mijiu.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(connectionFactory);
|
||||
|
||||
// 设置key和value的序列化方式
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
|
||||
redisTemplate.afterPropertiesSet();
|
||||
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
43
src/main/java/com/mijiu/common/config/WebMvcConfig.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.mijiu.common.config;
|
||||
|
||||
import com.mijiu.common.Util.JacksonObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class WebMvcConfig extends WebMvcConfigurationSupport {
|
||||
/**
|
||||
* 设置静态资源映射
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩展mvc框架的消息转换器
|
||||
*
|
||||
* @param converters
|
||||
*/
|
||||
@Override
|
||||
protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
//创建消息转换器对象
|
||||
MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
|
||||
//设置对象转换器,底层使用Jackson将Java对象转为json
|
||||
messageConverter.setObjectMapper(new JacksonObjectMapper());
|
||||
//将上面的消息转换器对象追加到mvc框架的转换器集合中
|
||||
converters.add(0, messageConverter);
|
||||
}
|
||||
|
||||
|
||||
}
|
18
src/main/java/com/mijiu/common/constant/CommonConstant.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.mijiu.common.constant;
|
||||
|
||||
/**
|
||||
* 通用常量
|
||||
*/
|
||||
public interface CommonConstant {
|
||||
|
||||
/**
|
||||
* 升序
|
||||
*/
|
||||
String SORT_ORDER_ASC = "ascend";
|
||||
|
||||
/**
|
||||
* 降序
|
||||
*/
|
||||
String SORT_ORDER_DESC = " descend";
|
||||
|
||||
}
|
32
src/main/java/com/mijiu/common/constant/UserConstant.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.mijiu.common.constant;
|
||||
|
||||
/**
|
||||
* 用户常量
|
||||
*
|
||||
*/
|
||||
public interface UserConstant {
|
||||
|
||||
/**
|
||||
* 用户登录态键
|
||||
*/
|
||||
String USER_LOGIN_STATE = "user_login";
|
||||
|
||||
// region 权限
|
||||
|
||||
/**
|
||||
* 默认角色
|
||||
*/
|
||||
String DEFAULT_ROLE = "user";
|
||||
|
||||
/**
|
||||
* 管理员角色
|
||||
*/
|
||||
String ADMIN_ROLE = "admin";
|
||||
|
||||
/**
|
||||
* 被封号
|
||||
*/
|
||||
String BAN_ROLE = "ban";
|
||||
|
||||
// endregion
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
/**
|
||||
* 账号被锁定异常
|
||||
*/
|
||||
public class AccountLockedException extends CustomException {
|
||||
|
||||
public AccountLockedException() {
|
||||
}
|
||||
|
||||
public AccountLockedException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
/**
|
||||
* 账号不存在异常
|
||||
*/
|
||||
public class AccountNotFoundException extends CustomException {
|
||||
|
||||
public AccountNotFoundException(){}
|
||||
public AccountNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
/**
|
||||
* 自定义业务异常类
|
||||
*/
|
||||
public class CustomException extends RuntimeException {
|
||||
|
||||
public CustomException(){}
|
||||
public CustomException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.common.model.ResultCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
*/
|
||||
@ControllerAdvice(annotations = {RestController.class, Controller.class})
|
||||
@ResponseBody
|
||||
@Slf4j
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
|
||||
//账号不存在异常
|
||||
@ExceptionHandler(AccountNotFoundException.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public Result<String> handleAccountNotFoundException(AccountNotFoundException ex) {
|
||||
return Result.error(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
||||
//密码错误异常
|
||||
@ExceptionHandler(PasswordErrorException.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public Result<String> handlePasswordErrorException(PasswordErrorException ex) {
|
||||
return Result.error(ResultCode.USER_LOGIN_ERROR);
|
||||
}
|
||||
|
||||
//登录状态过期异常
|
||||
@ExceptionHandler(TokenOverdueException.class)
|
||||
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||
public Result handleTokenOverdueException(TokenOverdueException ex){
|
||||
return Result.error(ResultCode.PERMISSION_EXPIRE);
|
||||
}
|
||||
|
||||
|
||||
//添加员工,管理员账号重复异常
|
||||
@ExceptionHandler(SQLIntegrityConstraintViolationException.class)
|
||||
public Result<String> exceptionHandler(SQLIntegrityConstraintViolationException ex) {
|
||||
log.error(ex.getMessage());
|
||||
|
||||
if (ex.getMessage().contains("Duplicate entry")) {
|
||||
String[] split = ex.getMessage().split(" ");
|
||||
String msg = split[2] + "已存在";
|
||||
return Result.error(msg);
|
||||
}
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理方法
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ExceptionHandler(CustomException.class)
|
||||
public Result<String> exceptionHandler(CustomException ex) {
|
||||
log.error(ex.getMessage());
|
||||
|
||||
return Result.error(ex.getMessage());
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
/**
|
||||
* 密码错误异常
|
||||
*/
|
||||
public class PasswordErrorException extends CustomException {
|
||||
|
||||
public PasswordErrorException() {
|
||||
}
|
||||
|
||||
public PasswordErrorException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.mijiu.common.exception;
|
||||
|
||||
public class TokenOverdueException extends CustomException{
|
||||
public TokenOverdueException(){}
|
||||
|
||||
public TokenOverdueException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.mijiu.common.interceptor;
|
||||
|
||||
import com.mijiu.common.Util.JwtUtils;
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.common.model.ResultCode;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* jwt令牌校验的拦截器
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
||||
|
||||
/**
|
||||
* 通过拦截器 放行拦截器的某些请求 头部参数 add(未完成)
|
||||
*
|
||||
*/
|
||||
//jwt校验
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
//判断当前拦截到的是Controller的方法还是其他资源
|
||||
if (!(handler instanceof HandlerMethod)) {
|
||||
//当前拦截到的不是动态方法,直接放行
|
||||
return true;
|
||||
}
|
||||
//1、从请求头中获取令牌
|
||||
String authorizationHeader = request.getHeader("Authorization");
|
||||
if (authorizationHeader == null) {
|
||||
log.info("Authorization值为空");
|
||||
return false;
|
||||
}
|
||||
// 从第8个字符开始截取,去掉 "Bearer " 前缀
|
||||
String jwt = authorizationHeader.substring(7);
|
||||
//2、校验令牌
|
||||
try {
|
||||
JwtUtils.validateToken(jwt);
|
||||
} catch (Exception e) {//jwt解析失败
|
||||
e.printStackTrace();
|
||||
response.getWriter().write(JSON.toJSONString(Result.error(ResultCode.USER_NOT_LOGGED_IN)));
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
30
src/main/java/com/mijiu/common/model/PageRequest.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.mijiu.common.model;
|
||||
|
||||
import com.mijiu.common.constant.CommonConstant;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 分页请求
|
||||
*/
|
||||
@Data
|
||||
public class PageRequest {
|
||||
/**
|
||||
* 当前页号
|
||||
*/
|
||||
private long current = 1;
|
||||
|
||||
/**
|
||||
* 页面大小
|
||||
*/
|
||||
private long pageSize = 10;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String sortField;
|
||||
|
||||
/**
|
||||
* 排序顺序(默认升序)
|
||||
*/
|
||||
private String sortOrder = CommonConstant.SORT_ORDER_ASC;
|
||||
}
|
61
src/main/java/com/mijiu/common/model/Result.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.mijiu.common.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 统一响应结果集
|
||||
*
|
||||
* @author crush
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Result<T> {
|
||||
|
||||
//操作代码
|
||||
Integer code;
|
||||
|
||||
//提示信息
|
||||
String message;
|
||||
|
||||
//结果数据
|
||||
T data;
|
||||
|
||||
public Result(ResultCode resultCode) {
|
||||
this.code = resultCode.code();
|
||||
this.message = resultCode.message();
|
||||
}
|
||||
|
||||
public Result(ResultCode resultCode, T data) {
|
||||
this.code = resultCode.code();
|
||||
this.message = resultCode.message();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Result(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static Result<String> success() {
|
||||
return new Result<String>(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data) {
|
||||
return new Result<T>(ResultCode.SUCCESS, data);
|
||||
}
|
||||
|
||||
public static Result<String> error() {
|
||||
return new Result<String>(ResultCode.FAIL);
|
||||
}
|
||||
|
||||
public static Result<String> error(ResultCode resultCode) {
|
||||
return new Result<String>(resultCode);
|
||||
}
|
||||
|
||||
public static Result<String> error(String message) {
|
||||
return new Result<String>(message);
|
||||
}
|
||||
}
|
82
src/main/java/com/mijiu/common/model/ResultCode.java
Normal file
@ -0,0 +1,82 @@
|
||||
package com.mijiu.common.model;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 通用响应状态
|
||||
*/
|
||||
@Getter
|
||||
public enum ResultCode {
|
||||
|
||||
/* 成功状态码 */
|
||||
SUCCESS(0, "操作成功!"),
|
||||
|
||||
/* 错误状态码 */
|
||||
FAIL(-1, "操作失败!"),
|
||||
|
||||
/* 参数错误:10001-19999 */
|
||||
PARAM_IS_INVALID(10001, "参数无效"),
|
||||
PARAM_IS_BLANK(10002, "参数为空"),
|
||||
PARAM_TYPE_BIND_ERROR(10003, "参数格式错误"),
|
||||
PARAM_NOT_COMPLETE(10004, "参数缺失"),
|
||||
|
||||
/* 用户错误:20001-29999*/
|
||||
USER_NOT_LOGGED_IN(20001, "用户未登录,请先登录"),
|
||||
USER_LOGIN_ERROR(20002, "账号不存在或密码错误"),
|
||||
USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"),
|
||||
USER_NOT_EXIST(20004, "用户不存在"),
|
||||
USER_HAS_EXISTED(20005, "用户已存在"),
|
||||
|
||||
/* 系统错误:40001-49999 */
|
||||
FILE_MAX_SIZE_OVERFLOW(40003, "上传尺寸过大"),
|
||||
FILE_ACCEPT_NOT_SUPPORT(40004, "上传文件格式不支持"),
|
||||
|
||||
/* 数据错误:50001-599999 */
|
||||
RESULT_DATA_NONE(50001, "数据未找到"),
|
||||
DATA_IS_WRONG(50002, "数据有误"),
|
||||
DATA_ALREADY_EXISTED(50003, "数据已存在"),
|
||||
AUTH_CODE_ERROR(50004, "验证码错误"),
|
||||
|
||||
|
||||
/* 权限错误:70001-79999 */
|
||||
PERMISSION_UNAUTHENTICATED(70001, "此操作需要登陆系统!"),
|
||||
|
||||
PERMISSION_UNAUTHORISE(70002, "权限不足,无权操作!"),
|
||||
|
||||
PERMISSION_EXPIRE(70003, "登录状态过期!"),
|
||||
|
||||
PERMISSION_TOKEN_EXPIRED(70004, "token已过期"),
|
||||
|
||||
PERMISSION_LIMIT(70005, "访问次数受限制"),
|
||||
|
||||
PERMISSION_TOKEN_INVALID(70006, "无效token"),
|
||||
|
||||
PERMISSION_SIGNATURE_ERROR(70007, "签名失败");
|
||||
|
||||
//操作代码
|
||||
int code;
|
||||
//提示信息
|
||||
String message;
|
||||
|
||||
ResultCode(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int code() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String message() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.mijiu.common.model.dto.staffDfb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class StaffDfbAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.mijiu.common.model.dto.staffDfb;
|
||||
|
||||
import com.mijiu.common.model.PageRequest;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class StaffDfbQueryByIdRequest extends PageRequest implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.mijiu.common.model.dto.staffDfb;
|
||||
|
||||
import com.mijiu.common.model.PageRequest;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 员工查询请求
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class StaffDfbQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
61
src/main/java/com/mijiu/controller/ConduitController.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.dto.BaseDto;
|
||||
import com.mijiu.entity.site.Conduit;
|
||||
import com.mijiu.mapper.ConduitMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管道站表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/conduit")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class ConduitController {
|
||||
|
||||
@Autowired
|
||||
private ConduitMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<?> list() {
|
||||
return Result.success(mapper.selectList(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<?> detail(@PathVariable Long id) {
|
||||
return Result.success(mapper.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping ("/add")
|
||||
public Result<?> add(@RequestBody Conduit conduit) {
|
||||
|
||||
return Result.success(mapper.insert(conduit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<?> update( @RequestBody Conduit conduit) {
|
||||
return Result.success(mapper.updateById(conduit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
return Result.success(mapper.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.DayAccumulate;
|
||||
import com.mijiu.entity.DownholeFilling;
|
||||
import com.mijiu.entity.Gauges;
|
||||
import com.mijiu.entity.site.Conduit;
|
||||
import com.mijiu.entity.site.Gob;
|
||||
import com.mijiu.entity.site.GroutingStation;
|
||||
import com.mijiu.entity.site.PressureMonitoring;
|
||||
import com.mijiu.mapper.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/downholeFilling")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class DownholeFillingController {
|
||||
|
||||
@Autowired
|
||||
private DownholeFillingMapper downholeFillingMapper;
|
||||
|
||||
@Autowired
|
||||
private GaugesMapper gaugesMapper;
|
||||
|
||||
@Autowired
|
||||
private DayAccumulateMapper dayAccumulateMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ConduitMapper conduitMapper;//管道
|
||||
|
||||
@Autowired
|
||||
private GobMapper gobMapper;//采空区
|
||||
|
||||
@Autowired
|
||||
private GroutingStationMapper groutingStationMapper;//注浆站
|
||||
|
||||
@Autowired
|
||||
private PressureMonitoringMapper pressureMonitoringMapper;//压力监测
|
||||
|
||||
|
||||
/**
|
||||
* 查询大屏实例
|
||||
*/
|
||||
@GetMapping("/getScreenExample")
|
||||
public Result<?> getScreen(){
|
||||
//管道列表
|
||||
List<Conduit> conduitList = conduitMapper.selectList(null);
|
||||
//采空区列表
|
||||
List<Gob> gobList = gobMapper.selectList(null);
|
||||
//注浆站列表
|
||||
List<GroutingStation> groutingStationList = groutingStationMapper.selectList(null);
|
||||
//压力监测列表
|
||||
List<PressureMonitoring> pressureMonitoringList = pressureMonitoringMapper.selectList(null);
|
||||
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
HashMap<String, Object> obj = new HashMap<>();
|
||||
List<Object> list = new ArrayList<>();
|
||||
//合并列表
|
||||
list.addAll(conduitList);
|
||||
list.addAll(gobList);
|
||||
list.addAll(groutingStationList);
|
||||
list.addAll(pressureMonitoringList);
|
||||
map.put("allList", list);
|
||||
map.put("conduitList", conduitList);
|
||||
map.put("gobList", gobList);
|
||||
map.put("groutingStationList", groutingStationList);
|
||||
map.put("pressureMonitoringList", pressureMonitoringList);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询压力监测统计信息
|
||||
*/
|
||||
@GetMapping("/pressureMonitoring/count")
|
||||
public Result<?> getPressure(){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
List<Gauges> list = new LambdaQueryChainWrapper<>(gaugesMapper)
|
||||
.in(Gauges::getG_ID, "AI_YL_CJX1GD1_VALUE", "AI_YL_CJX1GD2_VALUE", "AI_YL_CJX1GD3_VALUE"
|
||||
, "AI_YL_CJX2GD1_VALUE", "AI_YL_CJX2GD2_VALUE", "AI_YL_CJX2GD3_VALUE",
|
||||
"AI_YL_CJX3GD1_VALUE", "AI_YL_CJX3GD2_VALUE", "AI_YL_CJX3GD3_VALUE",
|
||||
"AI_YL_CJX4GD1_VALUE", "AI_YL_CJX4GD2_VALUE", "AI_YL_CJX4GD3_VALUE",
|
||||
"AI_YL_CJX5GD1_VALUE", "AI_YL_CJX5GD2_VALUE", "AI_YL_CJX5GD3_VALUE")
|
||||
.list();
|
||||
for (Gauges g: list){
|
||||
switch (g.getG_ID()){
|
||||
case "AI_YL_CJX1GD1_VALUE":
|
||||
map.put("box1pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX1GD2_VALUE":
|
||||
map.put("box1pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX1GD3_VALUE":
|
||||
map.put("box1pipe3", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX2GD1_VALUE":
|
||||
map.put("box2pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX2GD2_VALUE":
|
||||
map.put("box2pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX2GD3_VALUE":
|
||||
map.put("box2pipe3", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX3GD1_VALUE":
|
||||
map.put("box3pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX3GD2_VALUE":
|
||||
map.put("box3pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX3GD3_VALUE":
|
||||
map.put("box3pipe3", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX4GD1_VALUE":
|
||||
map.put("box4pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX4GD2_VALUE":
|
||||
map.put("box4pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX4GD3_VALUE":
|
||||
map.put("box4pipe3", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX5GD1_VALUE":
|
||||
map.put("box5pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX5GD2_VALUE":
|
||||
map.put("box5pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX5GD3_VALUE":
|
||||
map.put("box5pipe3", g.getG_Value());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询采空区统计信息
|
||||
*/
|
||||
@GetMapping("/gob/count")
|
||||
public Result<?> getDownholeFilling(){
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//钻头总数
|
||||
Long count = new LambdaQueryChainWrapper<>(downholeFillingMapper).count();
|
||||
map.put("allNum", count);
|
||||
//已完成钻孔DF_Scheduleint >= 4的数值的条数
|
||||
Long count1 = new LambdaQueryChainWrapper<>(downholeFillingMapper)
|
||||
.ge(DownholeFilling::getDF_Scheduleint, 4).count();
|
||||
map.put("completedNum", count1);
|
||||
//管道压力
|
||||
List<Gauges> aiYlCjx6GD1Value = new LambdaQueryChainWrapper<>(gaugesMapper)
|
||||
.in(Gauges::getG_ID, "AI_YL_CJX6GD1_VALUE","AI_YL_CJX6GD2_VALUE", "AI_YL_CJX6GD3_VALUE")
|
||||
.list();
|
||||
for(Gauges g : aiYlCjx6GD1Value){
|
||||
switch (g.getG_ID()) {
|
||||
case "AI_YL_CJX6GD1_VALUE":
|
||||
map.put("pipe1", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX6GD2_VALUE":
|
||||
map.put("pipe2", g.getG_Value());
|
||||
break;
|
||||
case "AI_YL_CJX6GD3_VALUE":
|
||||
map.put("pipe3", g.getG_Value());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//管道流量
|
||||
List<Gauges> aiLlCjx6GD1Value = new LambdaQueryChainWrapper<>(gaugesMapper)
|
||||
.in(Gauges::getG_ID, "AI_LL_CJX6GD1_VALUE","AI_LL_CJX6GD2_VALUE", "AI_LL_CJX6GD3_VALUE")
|
||||
.list();
|
||||
for(Gauges g : aiLlCjx6GD1Value){
|
||||
switch (g.getG_ID()) {
|
||||
case "AI_LL_CJX6GD1_VALUE":
|
||||
map.put("flow1", g.getG_Value());
|
||||
break;
|
||||
case "AI_LL_CJX6GD2_VALUE":
|
||||
map.put("flow2", g.getG_Value());
|
||||
break;
|
||||
case "AI_LL_CJX6GD3_VALUE":
|
||||
map.put("flow3", g.getG_Value());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询注浆站统计信息
|
||||
*/
|
||||
@GetMapping("/groutingStation/count")
|
||||
public Result<?> getDownholeFilling1(){
|
||||
return Result.success(dayAccumulateMapper.getAccumulate());
|
||||
}
|
||||
/**
|
||||
* 查询钻孔统计信息
|
||||
*/
|
||||
@GetMapping("/drill/count")
|
||||
public Result<?> getDrill(){
|
||||
List<DownholeFilling> list = new LambdaQueryChainWrapper<>(downholeFillingMapper)
|
||||
.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
64
src/main/java/com/mijiu/controller/GobController.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.dto.BaseDto;
|
||||
import com.mijiu.entity.site.Conduit;
|
||||
import com.mijiu.entity.site.Gob;
|
||||
import com.mijiu.entity.site.GroutingStation;
|
||||
import com.mijiu.mapper.GobMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 采空区表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gob")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class GobController {
|
||||
|
||||
@Autowired
|
||||
private GobMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<?> list() {
|
||||
return Result.success(mapper.selectList(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<?> detail(@PathVariable Long id) {
|
||||
return Result.success(mapper.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping ("/add")
|
||||
public Result<?> add(@RequestBody Gob gob) {
|
||||
|
||||
return Result.success(mapper.insert(gob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<?> update( @RequestBody Gob gob) {
|
||||
|
||||
return Result.success(mapper.updateById(gob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
return Result.success(mapper.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.dto.BaseDto;
|
||||
import com.mijiu.entity.site.GroutingStation;
|
||||
import com.mijiu.mapper.GroutingStationMapper;
|
||||
import com.mijiu.service.GroutingStationServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 注浆站表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/groutingStation")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class GroutingStationController {
|
||||
|
||||
@Autowired
|
||||
private GroutingStationMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<?> list() {
|
||||
return Result.success(mapper.selectList(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<?> detail(@PathVariable Long id) {
|
||||
return Result.success(mapper.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping ("/add")
|
||||
public Result<?> add(@RequestBody GroutingStation groutingStation) {
|
||||
|
||||
System.err.println(groutingStation);
|
||||
return Result.success(mapper.insert(groutingStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<?> update( @RequestBody GroutingStation groutingStation) {
|
||||
|
||||
return Result.success(mapper.updateById(groutingStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
return Result.success(mapper.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.dto.BaseDto;
|
||||
import com.mijiu.entity.site.Gob;
|
||||
import com.mijiu.entity.site.PressureMonitoring;
|
||||
import com.mijiu.mapper.PressureMonitoringMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 压力监测站表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pressureMonitoring")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class PressureMonitoringController {
|
||||
|
||||
@Autowired
|
||||
private PressureMonitoringMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<?> list() {
|
||||
return Result.success(mapper.selectList(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<?> detail(@PathVariable Long id) {
|
||||
return Result.success(mapper.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping ("/add")
|
||||
public Result<?> add(@RequestBody PressureMonitoring pressureMonitoring) {
|
||||
|
||||
return Result.success(mapper.insert(pressureMonitoring));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<?> update( @RequestBody PressureMonitoring pressureMonitoring) {
|
||||
return Result.success(mapper.updateById(pressureMonitoring));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
return Result.success(mapper.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.mijiu.controller;
|
||||
|
||||
import com.mijiu.common.Util.JwtUtils;
|
||||
import com.mijiu.common.exception.CustomException;
|
||||
import com.mijiu.common.model.Result;
|
||||
import com.mijiu.entity.UserManagement;
|
||||
import com.mijiu.entity.dto.LoginRequest;
|
||||
import com.mijiu.mapper.UserManagementMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理员表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
@CrossOrigin(allowedHeaders = "*")
|
||||
public class UserManagementController {
|
||||
|
||||
@Autowired
|
||||
private UserManagementMapper userManagementMapper;
|
||||
|
||||
@PostMapping("/login")
|
||||
public Result<?> login(@RequestBody LoginRequest loginRequest) {
|
||||
UserManagement user = new UserManagement();
|
||||
user.setUmName(loginRequest.getUsername());
|
||||
user.setUmPassword(loginRequest.getPassword());
|
||||
|
||||
// 根据用户名和密码查询用户
|
||||
List<UserManagement> users = userManagementMapper.selectList(null);
|
||||
for (UserManagement u : users) {
|
||||
if (u.getUmName().equals(user.getUmName()) && u.getUmPassword().equals(user.getUmPassword())) {
|
||||
|
||||
// 生成token
|
||||
Map<String,Object> info=new HashMap<>();
|
||||
info.put("userId",u.getUmUid());
|
||||
info.put("userRole",u.getUmName());
|
||||
String token = JwtUtils.generateToken(info,"user");
|
||||
|
||||
// 登录成功逻辑
|
||||
Map<String,Object> rest= new HashMap<>();
|
||||
rest.put("token",token);
|
||||
return Result.success(rest);
|
||||
}
|
||||
}
|
||||
throw new CustomException("用户名或密码错误!");
|
||||
}
|
||||
}
|
||||
|
76
src/main/java/com/mijiu/entity/DayAccumulate.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.mijiu.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("DayAccumulate")
|
||||
public class DayAccumulate implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 对应数据库表中的自增主键列DA_N,配置为自增类型的主键
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer DA_N;
|
||||
|
||||
// DA_System是计算列,在实体类中一般不做常规映射,若业务有需求获取其值,可后续通过自定义查询来处理
|
||||
// 此处暂不添加映射
|
||||
|
||||
@TableField("DA_System1")
|
||||
private Integer DA_System1;
|
||||
|
||||
@TableField("DA_System2")
|
||||
private Integer DA_System2;
|
||||
|
||||
@TableField("DA_WriteTime")
|
||||
private LocalDateTime DA_WriteTime;
|
||||
|
||||
@TableField("DA_Filling")
|
||||
private BigDecimal DA_Filling;
|
||||
|
||||
@TableField("DA_Lime")
|
||||
private BigDecimal DA_Lime;
|
||||
|
||||
@TableField("DA_Sand")
|
||||
private BigDecimal DA_Sand;
|
||||
|
||||
@TableField("DA_Water")
|
||||
private BigDecimal DA_Water;
|
||||
|
||||
@TableField("DA_Concentration")
|
||||
private BigDecimal DA_Concentration;
|
||||
|
||||
@TableField("DA_UnitConsumption")
|
||||
private BigDecimal DA_UnitConsumption;
|
||||
|
||||
@TableField("DA_Electricity")
|
||||
private BigDecimal DA_Electricity;
|
||||
|
||||
@TableField("DA_FlocculatingAgents")
|
||||
private BigDecimal DA_FlocculatingAgents;
|
||||
|
||||
@TableField("DA_ComingSandVolume")
|
||||
private BigDecimal DA_ComingSandVolume;
|
||||
|
||||
@TableField("DA_ComingSandWetVolume")
|
||||
private BigDecimal DA_ComingSandWetVolume;
|
||||
|
||||
@TableField("DA_ComingSandQuality")
|
||||
private BigDecimal DA_ComingSandQuality;
|
||||
|
||||
@TableField("DA_ComingSandWetQuality")
|
||||
private BigDecimal DA_ComingSandWetQuality;
|
||||
|
||||
@TableField("DA_ComingSandFlux")
|
||||
private BigDecimal DA_ComingSandFlux;
|
||||
|
||||
@TableField("DA_ComingSandConcentration")
|
||||
private BigDecimal DA_ComingSandConcentration;
|
||||
}
|
99
src/main/java/com/mijiu/entity/DownholeFilling.java
Normal file
@ -0,0 +1,99 @@
|
||||
package com.mijiu.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("DownholeFilling") // 指定对应的数据库表名
|
||||
public class DownholeFilling implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置主键自增,对应数据库中的自增列DF_ID
|
||||
private Integer DF_ID;
|
||||
|
||||
// 由于DF_System是计算列,在Java实体类中一般不需要映射它,除非有特殊业务需求去获取它的值
|
||||
// 如果需要,可以通过自定义查询等方式处理,这里暂不做映射
|
||||
|
||||
@TableField("DF_System1")
|
||||
private Integer DF_System1;
|
||||
|
||||
@TableField("DF_System2")
|
||||
private Integer DF_System2;
|
||||
|
||||
@TableField("DF_Name")
|
||||
private String DF_Name;
|
||||
|
||||
@TableField("DF_Space")
|
||||
private BigDecimal DF_Space;
|
||||
|
||||
@TableField("DF_Finished")
|
||||
private BigDecimal DF_Finished;
|
||||
|
||||
// DF_UnFinished同样是计算列,可按需处理,暂不做常规映射
|
||||
|
||||
@TableField("DF_WriteTime")
|
||||
private LocalDateTime DF_WriteTime;
|
||||
|
||||
@TableField("DF_Location")
|
||||
private String DF_Location;
|
||||
|
||||
@TableField("DF_Remarks")
|
||||
private String DF_Remarks;
|
||||
|
||||
@TableField("DF_Collect")
|
||||
private Boolean DF_Collect;
|
||||
|
||||
@TableField("DF_ModificationTime")
|
||||
private LocalDateTime DF_ModificationTime;
|
||||
|
||||
@TableField("DF_FillingTime")
|
||||
private LocalDateTime DF_FillingTime;
|
||||
|
||||
@TableField("DF_Schedule")
|
||||
private String DF_Schedule;
|
||||
|
||||
@TableField("DF_Scheduleint")
|
||||
private Integer DF_Scheduleint;
|
||||
|
||||
@TableField("DF_FillingDuration")
|
||||
private Integer DF_FillingDuration;
|
||||
|
||||
@TableField("DF_Elevation")
|
||||
private Float DF_Elevation;
|
||||
|
||||
@TableField("DF_Depth")
|
||||
private Float DF_Depth;
|
||||
|
||||
@TableField("DF_Diameter")
|
||||
private Float DF_Diameter;
|
||||
|
||||
@TableField("DF_StartDate")
|
||||
private LocalDateTime DF_StartDate;
|
||||
|
||||
@TableField("DF_EndDate")
|
||||
private LocalDateTime DF_EndDate;
|
||||
|
||||
@TableField("DF_Operator")
|
||||
private String DF_Operator;
|
||||
|
||||
@TableField("DF_ContactPhone")
|
||||
private String DF_ContactPhone;
|
||||
|
||||
@TableField("DF_VideoURL")
|
||||
private String DF_VideoURL;
|
||||
|
||||
@TableField("DF_Longitude")
|
||||
private Float DF_Longitude;
|
||||
|
||||
@TableField("DF_Latitude")
|
||||
private Float DF_Latitude;
|
||||
}
|
52
src/main/java/com/mijiu/entity/Gauges.java
Normal file
@ -0,0 +1,52 @@
|
||||
package com.mijiu.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("Gauges") // 指定对应的数据库表名
|
||||
public class Gauges implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置自增主键,对应数据库中的自增列G_N
|
||||
private Integer G_N;
|
||||
|
||||
// G_System是计算列,通常在实体类中可不做常规映射,若有获取其值的业务需求,可通过自定义查询等方式处理
|
||||
// 此处暂不做映射
|
||||
|
||||
@TableField("G_System1")
|
||||
private Integer G_System1;
|
||||
|
||||
@TableField("G_System2")
|
||||
private Integer G_System2;
|
||||
|
||||
@TableField("G_ID")
|
||||
private String G_ID;
|
||||
|
||||
@TableField("G_Name")
|
||||
private String G_Name;
|
||||
|
||||
@TableField("G_Value")
|
||||
private BigDecimal G_Value;
|
||||
|
||||
@TableField("G_Unit")
|
||||
private String G_Unit;
|
||||
|
||||
@TableField("G_WriteTime")
|
||||
private LocalDateTime G_WriteTime;
|
||||
|
||||
@TableField("G_Group")
|
||||
private String G_Group;
|
||||
|
||||
@TableField("G_ValuePrdfix")
|
||||
private Integer G_ValuePrdfix;
|
||||
}
|
74
src/main/java/com/mijiu/entity/UserManagement.java
Normal file
@ -0,0 +1,74 @@
|
||||
package com.mijiu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("UserManagement")
|
||||
@Data
|
||||
public class UserManagement implements Serializable {
|
||||
|
||||
@TableId(value = "UM_UID", type = IdType.ASSIGN_ID) // 自增主键
|
||||
private Integer umUid;
|
||||
|
||||
@TableField("UM_Name")
|
||||
private String umName;
|
||||
|
||||
@TableField("UM_Type")
|
||||
private String umType;
|
||||
|
||||
@TableField("UM_TEL")
|
||||
private String umTel;
|
||||
|
||||
@TableField("UM_WriteTime")
|
||||
private LocalDateTime umWriteTime;
|
||||
|
||||
@TableField("UM_IsFreeze")
|
||||
private Boolean umIsFreeze;
|
||||
|
||||
@TableField("UM_FreezeTime")
|
||||
private LocalDateTime umFreezeTime;
|
||||
|
||||
@TableField("UM_LastLoginTime")
|
||||
private LocalDateTime umLastLoginTime;
|
||||
|
||||
@TableField("UM_IsLogin")
|
||||
private LocalDateTime umIsLogin;
|
||||
|
||||
@TableField("UM_IsWrite")
|
||||
private Boolean umIsWrite;
|
||||
|
||||
@TableField("UM_Password")
|
||||
private String umPassword;
|
||||
|
||||
@TableField("UM_IsUserM")
|
||||
private Boolean umIsUserM;
|
||||
|
||||
@TableField("UM_IsEquipmentM")
|
||||
private Boolean umIsEquipmentM;
|
||||
|
||||
@TableField("UM_IsEnergy")
|
||||
private Boolean umIsEnergy;
|
||||
|
||||
@TableField("UM_IsProductionRF")
|
||||
private Boolean umIsProductionRF;
|
||||
|
||||
@TableField("UM_IsDownholeF")
|
||||
private Boolean umIsDownholeF;
|
||||
|
||||
@TableField("UM_isAlarmA")
|
||||
private Boolean umIsAlarmA;
|
||||
|
||||
@TableField("UM_IsRecipeM")
|
||||
private Boolean umIsRecipeM;
|
||||
|
||||
@TableField("UM_Section")
|
||||
private String umSection;
|
||||
|
||||
|
||||
}
|
23
src/main/java/com/mijiu/entity/dto/BaseDto.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.mijiu.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class BaseDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Float longitude;
|
||||
|
||||
private Float latitude;
|
||||
|
||||
private String json;
|
||||
|
||||
private String name;
|
||||
|
||||
private String EntityId;
|
||||
private String EntityName;
|
||||
}
|
11
src/main/java/com/mijiu/entity/dto/LoginRequest.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.mijiu.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginRequest {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
// 省略 getter 和 setter 方法
|
||||
}
|
37
src/main/java/com/mijiu/entity/site/Conduit.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.mijiu.entity.site;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("Conduit")
|
||||
public class Conduit implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置为主键自增,对应数据库表中的自增主键列C_ID
|
||||
private Long id;
|
||||
|
||||
|
||||
private Float longitude;
|
||||
|
||||
private Float latitude;
|
||||
|
||||
|
||||
private String json;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
@TableField("entity_id")
|
||||
private String entityId;
|
||||
|
||||
@TableField("entity_name")
|
||||
private String entityName;
|
||||
|
||||
private String type;
|
||||
}
|
38
src/main/java/com/mijiu/entity/site/Gob.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.mijiu.entity.site;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("Gob")
|
||||
public class Gob implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置为主键自增,对应数据库表中的自增主键列C_ID
|
||||
private Long id;
|
||||
|
||||
|
||||
private Float longitude;
|
||||
|
||||
private Float latitude;
|
||||
|
||||
|
||||
private String json;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@TableField("entity_id")
|
||||
private String entityId;
|
||||
|
||||
@TableField("entity_name")
|
||||
private String entityName;
|
||||
|
||||
private String type;
|
||||
}
|
38
src/main/java/com/mijiu/entity/site/GroutingStation.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.mijiu.entity.site;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("GroutingStation")
|
||||
public class GroutingStation implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置为主键自增,对应数据库表中的自增主键列C_ID
|
||||
private Long id;
|
||||
|
||||
|
||||
private Float longitude;
|
||||
|
||||
private Float latitude;
|
||||
|
||||
|
||||
private String json;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@TableField("entity_id")
|
||||
private String entityId;
|
||||
|
||||
@TableField("entity_name")
|
||||
private String entityName;
|
||||
|
||||
private String type;
|
||||
}
|
38
src/main/java/com/mijiu/entity/site/PressureMonitoring.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.mijiu.entity.site;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("PressureMonitoring")
|
||||
public class PressureMonitoring implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO) // 配置为主键自增,对应数据库表中的自增主键列C_ID
|
||||
private Long id;
|
||||
|
||||
|
||||
private Float longitude;
|
||||
|
||||
private Float latitude;
|
||||
|
||||
|
||||
private String json;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@TableField("entity_id")
|
||||
private String entityId;
|
||||
|
||||
@TableField("entity_name")
|
||||
private String entityName;
|
||||
|
||||
private String type;
|
||||
}
|
39
src/main/java/com/mijiu/entity/vo/Administrator.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.mijiu.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 管理员表
|
||||
* </p>
|
||||
*
|
||||
* @author 蒾酒
|
||||
* @since 2024-03-07
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Administrator implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@TableField("admin_account")
|
||||
private String adminAccount;
|
||||
|
||||
@TableField("admin_password")
|
||||
private String adminPassword;
|
||||
|
||||
@TableField("admin_name")
|
||||
private String adminName;
|
||||
|
||||
@TableField("merchant_id")
|
||||
private Integer adminId;
|
||||
}
|
11
src/main/java/com/mijiu/mapper/ConduitMapper.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.site.Conduit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface ConduitMapper extends BaseMapper<Conduit> {
|
||||
// 可以根据具体业务需求在这里添加自定义的SQL方法,目前继承BaseMapper已具备基本的CRUD方法
|
||||
}
|
18
src/main/java/com/mijiu/mapper/DayAccumulateMapper.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.DayAccumulate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface DayAccumulateMapper extends BaseMapper<DayAccumulate> {
|
||||
/**
|
||||
* 统计矸石处理量(本月和本日)
|
||||
*/
|
||||
@Select("SELECT SUM(CASE WHEN CONVERT(DATE, DA_WriteTime) = CONVERT(DATE, GETDATE()) THEN DA_Filling ELSE 0 END) AS TotalFillingQualityToday, SUM(CASE WHEN YEAR(DA_WriteTime) = YEAR(GETDATE()) AND MONTH(DA_WriteTime) = MONTH(GETDATE()) THEN DA_Filling ELSE 0 END) AS TotalFillingQualityThisMonth FROM DayAccumulate;")
|
||||
Map<String,Object> getAccumulate();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.DownholeFilling;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DownholeFillingMapper extends BaseMapper<DownholeFilling> {
|
||||
}
|
10
src/main/java/com/mijiu/mapper/GaugesMapper.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.Gauges;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GaugesMapper extends BaseMapper<Gauges> {
|
||||
}
|
10
src/main/java/com/mijiu/mapper/GobMapper.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.site.Gob;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GobMapper extends BaseMapper<Gob> {
|
||||
// 这里可以根据具体业务需求添加自定义的SQL方法,目前继承BaseMapper已经具备基本的CRUD方法
|
||||
}
|
28
src/main/java/com/mijiu/mapper/GroutingStationMapper.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.site.GroutingStation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface GroutingStationMapper extends BaseMapper<GroutingStation> {
|
||||
// // 根据主键查询注浆站信息
|
||||
// GroutingStation selectById(Long GS_Id);
|
||||
//
|
||||
// // 查询所有注浆站信息
|
||||
//// @Select("SELECT GS_ID id,GS_Longitude longitude FROM GroutingStation")
|
||||
// List<GroutingStation> selectAll();
|
||||
//
|
||||
// // 插入注浆站信息
|
||||
// int insert(GroutingStation groutingStation);
|
||||
//
|
||||
// // 根据主键更新注浆站信息
|
||||
// int updateById(GroutingStation groutingStation);
|
||||
//
|
||||
// // 根据主键删除注浆站信息
|
||||
// int deleteById(Long GS_Id);
|
||||
}
|
11
src/main/java/com/mijiu/mapper/PressureMonitoringMapper.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.site.PressureMonitoring;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface PressureMonitoringMapper extends BaseMapper<PressureMonitoring> {
|
||||
// 这里可以根据具体业务需求添加自定义的SQL方法,目前继承BaseMapper已经具备基本的CRUD方法
|
||||
}
|
9
src/main/java/com/mijiu/mapper/UserManagementMapper.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.mijiu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mijiu.entity.UserManagement;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserManagementMapper extends BaseMapper<UserManagement> {
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.mijiu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.mijiu.common.exception.CustomException;
|
||||
import com.mijiu.entity.site.GroutingStation;
|
||||
import com.mijiu.mapper.GroutingStationMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GroutingStationServiceImpl {
|
||||
|
||||
@Autowired
|
||||
private GroutingStationMapper groutingStationMapper;
|
||||
|
||||
public GroutingStation getById(Long GS_Id) {
|
||||
return groutingStationMapper.selectById(GS_Id);
|
||||
}
|
||||
|
||||
public List<GroutingStation> getAll() {
|
||||
return new LambdaQueryChainWrapper<>(groutingStationMapper).list();
|
||||
}
|
||||
|
||||
public void save(GroutingStation groutingStation) {
|
||||
int inserted = groutingStationMapper.insert(groutingStation);
|
||||
if (inserted == 0) {
|
||||
throw new CustomException("保存失败!");
|
||||
}
|
||||
}
|
||||
|
||||
public void update(GroutingStation groutingStation) {
|
||||
int i = groutingStationMapper.updateById(groutingStation);
|
||||
if (i == 0) {
|
||||
throw new CustomException("更新失败!");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteById(Long GS_Id) {
|
||||
int i = groutingStationMapper.deleteById(GS_Id);
|
||||
if (i == 0) {
|
||||
throw new CustomException("删除失败!");
|
||||
}
|
||||
}
|
||||
}
|
36
src/main/resources/application.yml
Normal file
@ -0,0 +1,36 @@
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
# password: WU3w7dK.f[X6xz;4I1hs*90PFS^D}c5o
|
||||
database: 0
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://wlml.a1.luyouxia.net:21023;databaseName=JKWLML
|
||||
username: sa
|
||||
password: JK@123456
|
||||
|
||||
#关spring的没必要日志
|
||||
main:
|
||||
banner-mode: off
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
#在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
|
||||
map-underscore-to-camel-case: false
|
||||
#开启mybatisplus日志(输出到控制台)
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
# db-config:
|
||||
# #id自增配置
|
||||
# id-type: ASSIGN_ID
|
||||
#逻辑删除字段
|
||||
# logic-delete-field: isExist
|
||||
# logic-not-delete-value: 1
|
||||
# logic-delete-value: 0
|
||||
#关没必要的mp日志输出
|
||||
banner: false
|
BIN
src/main/resources/images/merchant/1.jpeg
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
src/main/resources/images/product/10004.png
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
src/main/resources/images/product/10005.png
Normal file
After Width: | Height: | Size: 228 KiB |
BIN
src/main/resources/images/product/10006.png
Normal file
After Width: | Height: | Size: 271 KiB |
BIN
src/main/resources/images/product/10007.png
Normal file
After Width: | Height: | Size: 207 KiB |
BIN
src/main/resources/images/product/10008.png
Normal file
After Width: | Height: | Size: 228 KiB |
BIN
src/main/resources/images/product/10009.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
src/main/resources/images/product/10010.png
Normal file
After Width: | Height: | Size: 245 KiB |
BIN
src/main/resources/images/product/10011.png
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
src/main/resources/images/product/10012.png
Normal file
After Width: | Height: | Size: 648 KiB |
BIN
src/main/resources/images/product/10013.png
Normal file
After Width: | Height: | Size: 275 KiB |
BIN
src/main/resources/images/product/10014.png
Normal file
After Width: | Height: | Size: 272 KiB |
BIN
src/main/resources/images/product/10015.png
Normal file
After Width: | Height: | Size: 204 KiB |
BIN
src/main/resources/images/product/10016.png
Normal file
After Width: | Height: | Size: 219 KiB |
BIN
src/main/resources/images/product/10017.png
Normal file
After Width: | Height: | Size: 232 KiB |
BIN
src/main/resources/images/product/10018.png
Normal file
After Width: | Height: | Size: 240 KiB |
BIN
src/main/resources/images/product/10019.png
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
src/main/resources/images/product/10020.png
Normal file
After Width: | Height: | Size: 232 KiB |
57
src/main/resources/static/script.js
Normal file
@ -0,0 +1,57 @@
|
||||
// 获取文件上传表单元素
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
|
||||
// 监听文件上传表单的change事件
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
// 创建FormData对象
|
||||
const formData = new FormData();
|
||||
|
||||
// 将文件添加到FormData对象中
|
||||
const file = event.target.files[0];
|
||||
formData.append('file', file);
|
||||
|
||||
// 发送文件上传请求
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// 处理上传成功后的响应数据
|
||||
console.log(data);
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理上传失败的情况
|
||||
console.error(error);
|
||||
});
|
||||
});
|
||||
|
||||
// 创建一个a标签用于下载
|
||||
const downloadLink = document.createElement('a');
|
||||
|
||||
// 点击下载按钮时触发的事件
|
||||
function downloadFile() {
|
||||
// 发送文件下载请求
|
||||
fetch('/download', {
|
||||
method: 'GET'
|
||||
})
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
// 创建URL对象
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
// 设置下载链接的属性
|
||||
downloadLink.href = url;
|
||||
downloadLink.download = 'filename.ext';
|
||||
|
||||
// 模拟点击下载链接
|
||||
downloadLink.click();
|
||||
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理下载失败的情况
|
||||
console.error(error);
|
||||
});
|
||||
}
|
21
src/main/resources/static/upload.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||
<title>文件上传和下载</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 文件上传表单 -->
|
||||
<form enctype="multipart/form-data" id="uploadForm">
|
||||
<input id="fileInput" name="file" type="file">
|
||||
<button type="submit">上传文件</button>
|
||||
</form>
|
||||
|
||||
<!-- 文件下载按钮 -->
|
||||
<button onclick="downloadFile()">下载文件</button>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
12
src/test/java/com/mijiu/test/DFBAppTest.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.mijiu.test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DFBAppTest {
|
||||
@Test
|
||||
public void test1() {
|
||||
String fileName = "ererewe.jpg";
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
System.out.println(suffix);
|
||||
}
|
||||
}
|
9
src/test/java/com/mijiu/test/mapper/TestMapper.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.mijiu.test.mapper;
|
||||
|
||||
import com.mijiu.test.pojo.Test;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TestMapper extends BaseMapper<Test> {
|
||||
}
|
15
src/test/java/com/mijiu/test/pojo/Test.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.mijiu.test.pojo;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Test {
|
||||
private String name;
|
||||
private Integer age;
|
||||
|
||||
}
|