数据库实体类

main
lensfrex 2 years ago
parent 759dd2f151
commit 01b389ac1a
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 130
      pom.xml
  2. 4
      src/main/java/net/lensfrex/dscape/ServerMain.java
  3. 12
      src/main/java/net/lensfrex/dscape/dao/PatientDataDao.java
  4. 5
      src/main/java/net/lensfrex/dscape/dao/UserBasicDao.java
  5. 12
      src/main/java/net/lensfrex/dscape/dao/mappers/PatientDataMapper.java
  6. 10
      src/main/java/net/lensfrex/dscape/dao/mappers/UserBasicMapper.java
  7. 139
      src/main/java/net/lensfrex/dscape/domain/PatientData.java
  8. 62
      src/main/java/net/lensfrex/dscape/domain/user/UserBasic.java
  9. 17
      src/main/java/net/lensfrex/dscape/domain/user/UserRole.java
  10. 15
      src/main/java/net/lensfrex/dscape/domain/user/UserStatus.java
  11. 35
      src/main/java/net/lensfrex/dscape/web/controllers/Index.java
  12. 21
      src/main/resources/application.yml

@ -1,110 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>me.lensfrex</groupId> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>net.lensfrex</groupId>
<artifactId>dscape-server</artifactId> <artifactId>dscape-server</artifactId>
<version>0.0.1-dev</version> <version>0.0.1-dev</version>
<name>dscape-server</name> <name>dscape-server</name>
<packaging>jar</packaging> <description>dscape-server</description>
<properties> <properties>
<start-class>me.lensfrex.dscape.api.v1.ServerMain</start-class> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.version>5.8.1</junit.version>
</properties> </properties>
<parent> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
<relativePath/> </dependency>
</parent>
<dependencies>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<version>4.0.1</version> <scope>test</scope>
<scope>provided</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>gson</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>2.9.0</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mindrot/jbcrypt -->
<dependency> <dependency>
<groupId>org.mindrot</groupId> <groupId>com.baomidou</groupId>
<artifactId>jbcrypt</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>0.4</version> <version>3.5.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>org.mariadb.jdbc</groupId>
<artifactId>jjwt-api</artifactId> <artifactId>mariadb-java-client</artifactId>
<version>0.11.5</version> <version>3.0.5</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>com.alibaba</groupId>
<artifactId>jjwt-impl</artifactId> <artifactId>druid</artifactId>
<version>0.11.5</version> <version>1.2.11</version>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>com.alibaba</groupId>
<artifactId>jjwt-gson</artifactId> <!-- or jjwt-gson if Gson is preferred --> <artifactId>druid-spring-boot-starter</artifactId>
<version>0.11.5</version> <version>1.2.11</version>
<scope>runtime</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>mybatis</artifactId> <artifactId>jackson-core</artifactId>
<version>3.5.9</version> <version>2.13.3</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency> <dependency>
<groupId>org.mariadb.jdbc</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>mariadb-java-client</artifactId> <artifactId>jackson-databind</artifactId>
<version>3.0.4</version> <version>2.13.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.13.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-cli</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-cli</artifactId>
<version>2.11.0</version> <version>1.5.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>jjwt-api</artifactId>
<exclusions> <version>0.11.5</version>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>jjwt-impl</artifactId>
<scope>test</scope> <version>0.11.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>spring-boot-starter-jetty</artifactId> <artifactId>jjwt-jackson</artifactId>
<scope>compile</scope> <version>0.11.5</version>
</dependency> </dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -115,4 +112,5 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

@ -1,10 +1,12 @@
package me.lensfrex.dscape.api.v1; package net.lensfrex.dscape;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication @SpringBootApplication
@MapperScan("net.lensfrex.dscape.dao.mappers")
public class ServerMain extends SpringBootServletInitializer { public class ServerMain extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {

@ -0,0 +1,12 @@
/*
* Coded by lensfrex.
*/
/*
* Coded by lensfrex.
*/
package net.lensfrex.dscape.dao;
public class PatientDataDao {
}

@ -0,0 +1,5 @@
package net.lensfrex.dscape.dao;
public class UserBasicDao {
}

@ -0,0 +1,12 @@
/*
* Coded by lensfrex.
*/
package net.lensfrex.dscape.dao.mappers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lensfrex.dscape.domain.PatientData;
public interface PatientDataMapper extends BaseMapper<PatientData> {
}

@ -0,0 +1,10 @@
package net.lensfrex.dscape.dao.mappers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lensfrex.dscape.domain.user.UserBasic;
import org.springframework.stereotype.Repository;
@Repository
public interface UserBasicMapper extends BaseMapper<UserBasic> {
}

@ -0,0 +1,139 @@
package net.lensfrex.dscape.domain;
import java.util.Date;
public class PatientData {
/**
* 患者数据id
*/
private int id;
/**
* 病人id
*/
private int pid;
/**
* ctDNA长度
*/
private int ctDNALength;
/**
* 甲基化位点数
*/
private int cpg;
/**
* 是否为hcc
*/
private boolean hccStatus;
/**
* 通过推断得出的hcc状态
*/
private boolean hccInferStatus;
/**
* create_time
*/
private Date createTime;
/**
* edit_time
*/
private Date editTime;
/**
* delete
*/
private boolean delete;
public PatientData() {}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public int getCtDNALength() {
return ctDNALength;
}
public void setCtDNALength(int ctDNALength) {
this.ctDNALength = ctDNALength;
}
public boolean isHccStatus() {
return hccStatus;
}
public void setHccStatus(boolean hccStatus) {
this.hccStatus = hccStatus;
}
public boolean isHccInferStatus() {
return hccInferStatus;
}
public void setHccInferStatus(boolean hccInferStatus) {
this.hccInferStatus = hccInferStatus;
}
public boolean isDelete() {
return delete;
}
public void setDelete(boolean delete) {
this.delete = delete;
}
public int getCpg() {
return cpg;
}
public void setCpg(int cpg) {
this.cpg = cpg;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getEditTime() {
return editTime;
}
public void setEditTime(Date editTime) {
this.editTime = editTime;
}
@Override
public String toString() {
return "PatientData{" + "id=" + id +
", pid=" + pid +
", ctDNALength=" + ctDNALength +
", cpg=" + cpg +
", hccStatus=" + hccStatus +
", hccInferStatus=" + hccInferStatus +
", createTime=" + createTime +
", editTime=" + editTime +
", delete=" + delete +
'}';
}
}

@ -0,0 +1,62 @@
package net.lensfrex.dscape.domain.user;
public class UserBasic {
private String uid;
private String userName;
private String password;
private UserStatus status;
private UserRole role;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
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 UserRole getRole() {
return role;
}
public void setRole(UserRole role) {
this.role = role;
}
public UserStatus getStatus() {
return status;
}
public void setStatus(UserStatus status) {
this.status = status;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("UserBasic{");
sb.append("uid='").append(uid).append('\'');
sb.append(", userName='").append(userName).append('\'');
sb.append(", password='").append(password).append('\'');
sb.append(", status=").append(status);
sb.append(", role=").append(role);
sb.append('}');
return sb.toString();
}
}

@ -0,0 +1,17 @@
package net.lensfrex.dscape.domain.user;
import com.baomidou.mybatisplus.annotation.EnumValue;
public enum UserRole {
ADMIN(1, "admin"), NORMAL_USER(0, "normal");
@EnumValue
private final int role;
private final String desc;
UserRole(int role, String desc) {
this.role = role;
this.desc = desc;
}
}

@ -0,0 +1,15 @@
package net.lensfrex.dscape.domain.user;
import com.baomidou.mybatisplus.annotation.EnumValue;
public enum UserStatus {
NORMAL(0), BANNED(1), DELETED(2);
@EnumValue
private final int status;
UserStatus(int status) {
this.status = status;
}
}

@ -0,0 +1,35 @@
package net.lensfrex.dscape.web.controllers;
import net.lensfrex.dscape.dao.mappers.UserBasicMapper;
import net.lensfrex.dscape.domain.user.UserBasic;
import net.lensfrex.dscape.domain.user.UserRole;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
public class Index {
@Resource
private UserBasicMapper userBasicMapper;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String returnIndexMessage() {
System.out.println("------test------");
// List<UserBasic> userBasicList = userBasicMapper.selectList(null);
UserBasic userBasic = new UserBasic();
userBasic.setUserName("lensfrex");
userBasic.setPassword("passwd");
userBasic.setUid("uid");
userBasic.setRole(UserRole.ADMIN);
System.out.println(userBasicMapper.insert(userBasic));
return "ヾ( ̄▽ ̄)";
}
}

@ -1 +1,22 @@
server:
address: 127.0.0.1
port: 6480
http2:
enabled: false
ssl:
enabled: false
trust-certificate:
trust-certificate-private-key:
spring:
datasource:
driver-class-name: org.mariadb.jdbc.Driver
url: jdbc:mariadb://localhost:33060/dscape?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: "dscape_user"
password:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler

Loading…
Cancel
Save