
8 changed files with 305 additions and 7 deletions
@ -0,0 +1,64 @@ |
|||||
|
# 此为注释– 将被Git 忽略 |
||||
|
# /结尾表示是目录,忽略目录和目录下的所有件 |
||||
|
# /开头表示根目录,否则是.gitignore的相对目录 |
||||
|
# !开头表示反选 |
||||
|
**/.idea/ |
||||
|
**/target/ |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
*.iws |
||||
|
*.log |
||||
|
.svn/ |
||||
|
.project |
||||
|
rebel.xml |
||||
|
.rebel-remote.xml.* |
||||
|
**/target/ |
||||
|
pom.xml.tag |
||||
|
pom.xml.releaseBackup |
||||
|
pom.xml.versionsBackup |
||||
|
pom.xml.next |
||||
|
release.properties |
||||
|
dependency-reduced-pom.xml |
||||
|
buildNumber.properties |
||||
|
.mvn/timing.properties |
||||
|
# https://github.com/takari/maven-wrapper#usage-without-binary-jar |
||||
|
.mvn/wrapper/maven-wrapper.jar |
||||
|
|
||||
|
.DS_Store |
||||
|
HELP.md |
||||
|
## target/ |
||||
|
!.mvn/wrapper/maven-wrapper.jar |
||||
|
!**/src/main/**/target/ |
||||
|
!**/src/test/**/target/ |
||||
|
**/node_modules/ |
||||
|
**/logs/ |
||||
|
|
||||
|
### STS ### |
||||
|
.apt_generated |
||||
|
.classpath |
||||
|
.factorypath |
||||
|
.project |
||||
|
.settings |
||||
|
.springBeans |
||||
|
.sts4-cache |
||||
|
|
||||
|
### IntelliJ IDEA ### |
||||
|
.idea |
||||
|
*.iws |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
|
||||
|
### NetBeans ### |
||||
|
/nbproject/private/ |
||||
|
/nbbuild/ |
||||
|
/dist/ |
||||
|
/nbdist/ |
||||
|
/.nb-gradle/ |
||||
|
build/ |
||||
|
!**/src/main/**/build/ |
||||
|
!**/src/test/**/build/ |
||||
|
|
||||
|
### VS Code ### |
||||
|
.vscode/ |
||||
|
/supervise-uniapp/.hbuilderx/ |
||||
|
/supervise-uniapp/unpackage/ |
@ -0,0 +1,8 @@ |
|||||
|
package com.yxt.demo.common.core.dto; |
||||
|
|
||||
|
|
||||
|
import com.yxt.demo.common.core.vo.Vo; |
||||
|
|
||||
|
public interface Dto extends Vo { |
||||
|
|
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
package com.yxt.demo.common.core.query; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/9/3 16:41 |
||||
|
* @description |
||||
|
*/ |
||||
|
|
||||
|
public class PagerQuery<T extends Query> implements Serializable { |
||||
|
|
||||
|
@ApiModelProperty(value = "当前页号", example = "1") |
||||
|
private long current = 1L; |
||||
|
|
||||
|
@ApiModelProperty(value = "每页记录数", example = "10") |
||||
|
private long size = 10L; |
||||
|
|
||||
|
@ApiModelProperty(value = "标识符") |
||||
|
private Integer identifier; |
||||
|
|
||||
|
@ApiModelProperty("查询条件的项") |
||||
|
private T params; |
||||
|
|
||||
|
public PagerQuery() { |
||||
|
} |
||||
|
|
||||
|
public PagerQuery(long current) { |
||||
|
this.current = current; |
||||
|
} |
||||
|
|
||||
|
public PagerQuery(long current, long size) { |
||||
|
this.size = size; |
||||
|
this.current = current; |
||||
|
} |
||||
|
|
||||
|
public long getSize() { |
||||
|
return size; |
||||
|
} |
||||
|
|
||||
|
public PagerQuery setSize(long size) { |
||||
|
this.size = size; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public long getCurrent() { |
||||
|
return current; |
||||
|
} |
||||
|
|
||||
|
public PagerQuery setCurrent(long current) { |
||||
|
this.current = current; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public T getParams() { |
||||
|
return params; |
||||
|
} |
||||
|
|
||||
|
public PagerQuery setParams(T params) { |
||||
|
this.params = params; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Integer getIdentifier() { |
||||
|
return identifier; |
||||
|
} |
||||
|
|
||||
|
public void setIdentifier(Integer identifier) { |
||||
|
this.identifier = identifier; |
||||
|
} |
||||
|
|
||||
|
public void fromPagerQuery(PagerQuery s_query) { |
||||
|
this.setCurrent(s_query.getCurrent()).setSize(s_query.getSize()).setParams(params.fromMap(s_query.getParams().toMap())); |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.yxt.demo.common.core.query; |
||||
|
|
||||
|
import com.yxt.demo.common.core.vo.Vo; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/9/3 16:41 |
||||
|
* @description |
||||
|
*/ |
||||
|
|
||||
|
public interface Query extends Vo { |
||||
|
|
||||
|
} |
@ -0,0 +1,100 @@ |
|||||
|
package com.yxt.demo.common.core.vo; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/9/3 16:24 |
||||
|
* @description |
||||
|
*/ |
||||
|
@ApiModel(description = "返回的分页结果") |
||||
|
public class PagerVo<T> implements Serializable { |
||||
|
|
||||
|
@ApiModelProperty("总页数") |
||||
|
private long pages = 1L; |
||||
|
@ApiModelProperty("总记录数") |
||||
|
private long total = 0L; |
||||
|
@ApiModelProperty("每页记录数") |
||||
|
private long size = 15L; |
||||
|
@ApiModelProperty("当前页号") |
||||
|
private long current = 1L; |
||||
|
@ApiModelProperty(value = "标识符") |
||||
|
private Integer identifier; |
||||
|
|
||||
|
@ApiModelProperty("当前页的数据") |
||||
|
private List<T> records = Collections.emptyList(); |
||||
|
|
||||
|
public PagerVo() { |
||||
|
this.pages = 1L; |
||||
|
this.total = 0L; |
||||
|
this.size = 10L; |
||||
|
this.current = 1L; |
||||
|
this.records = Collections.emptyList(); |
||||
|
} |
||||
|
|
||||
|
public PagerVo(long current) { |
||||
|
this.pages = 1L; |
||||
|
this.total = 0L; |
||||
|
this.size = 10L; |
||||
|
this.current = current; |
||||
|
this.records = Collections.emptyList(); |
||||
|
} |
||||
|
|
||||
|
public long getPages() { |
||||
|
return pages; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<T> setPages(long pages) { |
||||
|
this.pages = pages; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public long getTotal() { |
||||
|
return total; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<T> setTotal(long total) { |
||||
|
this.total = total; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public long getSize() { |
||||
|
return size; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<T> setSize(long size) { |
||||
|
this.size = size; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public long getCurrent() { |
||||
|
return current; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<T> setCurrent(long current) { |
||||
|
this.current = current; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public List<T> getRecords() { |
||||
|
return records; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<T> setRecords(List<T> records) { |
||||
|
this.records = records; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Integer getIdentifier() { |
||||
|
return identifier; |
||||
|
} |
||||
|
|
||||
|
public void setIdentifier(Integer identifier) { |
||||
|
this.identifier = identifier; |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.demo.common.core.vo; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
|
||||
|
import javax.swing.text.html.parser.Entity; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/9/3 16:21 |
||||
|
* @description |
||||
|
*/ |
||||
|
|
||||
|
public interface Vo extends Serializable { |
||||
|
|
||||
|
default Map<String, Object> toMap() { |
||||
|
return BeanUtil.beanToMap(this); |
||||
|
} |
||||
|
|
||||
|
default <V extends Vo> V fromMap(Map<String, Object> map) { |
||||
|
return (V) BeanUtil.fillBeanWithMap(map, this, false); |
||||
|
} |
||||
|
|
||||
|
default <E extends Entity> void fromEntity(E e) { |
||||
|
BeanUtil.copyProperties(e, this); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue