Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hubin6 committed Oct 27, 2017
1 parent fd38655 commit ecbc0d3
Show file tree
Hide file tree
Showing 101 changed files with 52,016 additions and 95 deletions.
15 changes: 15 additions & 0 deletions hydra-center-commons/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hydra-center</artifactId>
<groupId>com.fresh.hydra</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>hydra-center-commons</artifactId>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.fresh.commons.data.page;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* @Author hubin
* @Description:
* @Date 2017/10/27 21:46
*/
public class Page<T> implements Serializable {
private static final long serialVersionUID = 2489970337451484305L;
private long totalElements = 0L;
private int size = 10;
private int page = 1;
private List<T> content = new ArrayList();

public Page() {
}

public int getSize() {
return this.size;
}

public void setSize(int size) {
this.size = size;
}

public long getTotalElements() {
return this.totalElements;
}

public void setTotalElements(long totalElements) {
this.totalElements = totalElements;
}

public long getTotalPage() {
return this.totalElements / (long) this.size + (long) (this.totalElements % (long) this.size == 0L ? 0 : 1);
}

public List<T> getContent() {
return this.content;
}

public void setContent(List<T> content) {
this.content = content;
}

public int getPage() {
return this.page;
}

public void setPage(int page) {
this.page = page;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.fresh.commons.data.page;

import java.io.Serializable;

/**
* @Author hubin
* @Description:
* @Date 2017/10/27 21:47
*/
public class PageRequest implements Serializable {
private static final long serialVersionUID = -2959044827323493348L;
private int page = 1;
private int pageSize = 10;

public PageRequest() {
}

public int getPage() {
return this.page;
}

public void setPage(int page) {
this.page = page;
}

public int getPageSize() {
return this.pageSize;
}

public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}

public long getOffset() {
return (long)(this.page - 1) * (long)this.pageSize;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.fresh.commons.data.validation;

import java.util.ArrayList;
import java.util.List;

/**
* @Author hubin
* @Description:
* @Date 2017/10/27 22:05
*/
public class Errors {
private static class Error {
private String msg;
private String field;

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

public String getField() {
return field;
}

public void setField(String field) {
this.field = field;
}
}
private List<Error> errors = new ArrayList();

public Errors() {
}

public List<Error> getErrors() {
return this.errors;
}

public void setErrors(List<Error> errors) {
this.errors = errors;
}

public static class Builder {
private String msg;
private List<Error> errors = new ArrayList();

public Builder() {
}

public Errors.Builder msg(String msg) {
this.msg = msg;
return this;
}

public Errors.Builder addFieldError(String field, String msg) {
Error error = new Error();
error.setField(field);
error.setMsg(msg);
this.errors.add(error);
return this;
}

public Errors build() {
Errors errors = new Errors();
errors.getErrors().addAll(this.errors);
return errors;
}
}
}
94 changes: 65 additions & 29 deletions hydra-center-domain-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@

<groupId>com.fresh.hydra</groupId>
<artifactId>hydra-center-domain-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0-SNAPSHOT</version>
<name>hydra-center-domain-service</name>

<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.6.1</springfox-version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -26,13 +33,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.jd.spring.boot</groupId>
<artifactId>jd-spring-boot-dependencies</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>com.jd.spring.boot</groupId>-->
<!--<artifactId>jd-spring-boot-dependencies</artifactId>-->
<!--<version>1.0-SNAPSHOT</version>-->
<!--<type>pom</type>-->
<!--<scope>import</scope>-->
<!--</dependency>-->
</dependencies>
</dependencyManagement>

Expand All @@ -48,47 +55,76 @@
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>
<!--<dependency>-->
<!--<groupId>mysql</groupId>-->
<!--<artifactId>mysql-connector-java</artifactId>-->
<!--<version>5.1.24</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-jdbc</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>

<dependency>
<groupId>com.fresh.commons</groupId>
<artifactId>fresh-commons-data</artifactId>
<version>1.0.1-SNAPSHOT</version>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>

<dependency>
<groupId>com.fresh.commons</groupId>
<artifactId>fresh-commons-exception</artifactId>
<version>1.0.1-SNAPSHOT</version>
<groupId>com.fresh.hydra</groupId>
<artifactId>hydra-center-commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<!--<dependency>-->
<!--<groupId>com.fresh.commons</groupId>-->
<!--<artifactId>fresh-commons-data</artifactId>-->
<!--<version>1.0.1-SNAPSHOT</version>-->
<!--</dependency>-->

<!--<dependency>-->
<!--<groupId>com.fresh.commons</groupId>-->
<!--<artifactId>fresh-commons-exception</artifactId>-->
<!--<version>1.0.1-SNAPSHOT</version>-->
<!--</dependency>-->
</dependencies>

<build>
Expand Down Expand Up @@ -119,8 +155,8 @@
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>testGenerateStubs</goal>
<goal>testCompile</goal>
<!-- <goal>testGenerateStubs</goal>
<goal>testCompile</goal>-->
</goals>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fresh.hydra.center.biz.user.repository

import com.fresh.commons.data.page.PageRequest
import com.fresh.hydra.center.biz.user.domain.User
import com.fresh.hydra.center.biz.user.domain.UserQuery
import com.fresh.commons.data.page.PageRequest
import org.apache.ibatis.annotations.Delete
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Mapper
Expand All @@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Update
/**
* Created by yanhua on 2017/2/3.
*/
@Mapper
//@Mapper
public interface UserRepository {

@Insert("INSERT into T_USER (name,age,addr) VALUES(#{name}, #{age}, #{addr})")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.fresh.hydra.center.biz.user.domain;

import lombok.Data;

import java.io.Serializable;

/**
* @Author hubin
* @Description:
* @Date 2017/10/23 16:16
*/
@Data
public class Col implements Serializable {
private static final long serialVersionUID = 6155650348427219235L;
private String title;
private String key;

public Col(String key, String title) {
this.title = title;
this.key = key;
}
}
Loading

0 comments on commit ecbc0d3

Please sign in to comment.