-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hubin6
committed
Oct 27, 2017
1 parent
fd38655
commit ecbc0d3
Showing
101 changed files
with
52,016 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
57 changes: 57 additions & 0 deletions
57
hydra-center-commons/src/main/java/com/fresh/commons/data/page/Page.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
hydra-center-commons/src/main/java/com/fresh/commons/data/page/PageRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
hydra-center-commons/src/main/java/com/fresh/commons/data/validation/Errors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
hydra-center-domain-service/src/main/java/com/fresh/hydra/center/biz/user/domain/Col.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.