2022-03-31
This commit is contained in:
52
yxt-common/yxt-common-core/pom.xml
Normal file
52
yxt-common/yxt-common-core/pom.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.yxt</groupId>
|
||||
<artifactId>yxt-parent</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.yxt</groupId>
|
||||
<artifactId>yxt-common-core</artifactId>
|
||||
<version>0.0.1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.yxt.common.core.api;
|
||||
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.query.Query;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
public interface BaseApi<V, D, Q extends Query> {
|
||||
|
||||
/**
|
||||
* 不分页列表(可带查询参数)
|
||||
*
|
||||
* @return 不分页列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "不分页列表")
|
||||
public ResultBean<List<V>> list(@Valid @RequestBody Q query);
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表(可带查询参数)
|
||||
* @param pagerQuery
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pagelist")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "分页列表")
|
||||
public ResultBean<PagerVo<V>> pageList(@Valid @RequestBody PagerQuery<Q> pagerQuery);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param Dto
|
||||
* dto对象
|
||||
* @return ResultBean
|
||||
*/
|
||||
@PostMapping
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "新增")
|
||||
public ResultBean save(@Valid @RequestBody D dto);
|
||||
|
||||
/**
|
||||
* 修改(@PathVariable是spring3.0的一个新功能:接收请求路径中占位符的值. 通过 @PathVariable
|
||||
* 可以将URL中占位符参数{xxx}绑定到处理器类的方法形参中@PathVariable(“xxx“) )
|
||||
*
|
||||
* @param
|
||||
* @return ResultBean
|
||||
*/
|
||||
@PutMapping("/{sid}")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "根据sid修改")
|
||||
public ResultBean update(@Valid @RequestBody D dto,@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param sid
|
||||
* sid
|
||||
* @return ResultBean
|
||||
*/
|
||||
@DeleteMapping("/{sid}")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "删除")
|
||||
public ResultBean delete(
|
||||
@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
|
||||
/**
|
||||
* 获取单一对象
|
||||
* @param sid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{sid}")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "获取单一对象")
|
||||
public ResultBean<V> getVo(
|
||||
@ApiParam(value = "sid", required = true) @PathVariable("sid") String sid);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.common.core.constant;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/6/16 10:50
|
||||
* @description
|
||||
*/
|
||||
|
||||
public class HttpStatus {
|
||||
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 系统内部错误
|
||||
*/
|
||||
public static final int ERROR = 500;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* Project: yxt-common <br/>
|
||||
* File: BaseEntity.java <br/>
|
||||
* Class: com.yxt.common.core.domain.BaseEntity <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/8/4 1:01 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class BaseEntity extends EntityWithId {
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public Integer getLockVersion() {
|
||||
return lockVersion;
|
||||
}
|
||||
|
||||
public void setLockVersion(Integer lockVersion) {
|
||||
this.lockVersion = lockVersion;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Integer getIsEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
public void setIsEnable(Integer isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getCreateBySid() {
|
||||
return createBySid;
|
||||
}
|
||||
|
||||
public void setCreateBySid(String createBySid) {
|
||||
this.createBySid = createBySid;
|
||||
}
|
||||
|
||||
public String getUpdateBySid() {
|
||||
return updateBySid;
|
||||
}
|
||||
|
||||
public void setUpdateBySid(String updateBySid) {
|
||||
this.updateBySid = updateBySid;
|
||||
}
|
||||
|
||||
@ApiModelProperty("字符型编号")
|
||||
private String sid = UUID.randomUUID().toString();
|
||||
|
||||
// @Version
|
||||
@ApiModelProperty("记录版本,锁")
|
||||
private Integer lockVersion = 0;
|
||||
|
||||
@ApiModelProperty("记录创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date createTime = new Date();
|
||||
@ApiModelProperty("记录最后修改时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date modifyTime = new Date();
|
||||
@ApiModelProperty("记录状态值")
|
||||
private Integer state = 1;
|
||||
@ApiModelProperty("记录是否可用,1:可用(默认),0:不可用")
|
||||
private Integer isEnable = 1;
|
||||
|
||||
// @TableLogic
|
||||
@ApiModelProperty("记录是否被删除,0:未删除(默认),1:已经删除")
|
||||
private Integer isDelete = 0;
|
||||
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remarks;
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBySid;
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBySid;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.yxt.common.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Entity implements Serializable {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.yxt.common.core.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class EntityWithId extends Entity {
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ApiModelProperty("ID值的字符串形式")
|
||||
public String getIdStr() {
|
||||
if (null == id) {
|
||||
return "";
|
||||
}
|
||||
return "" + id;
|
||||
}
|
||||
|
||||
@ApiModelProperty("ID,唯一编号")
|
||||
private Integer id;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClassName:" + getClass().getName() + ";id:" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int id2 = Long.hashCode(getId());
|
||||
return super.hashCode() + id2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof EntityWithId)) {
|
||||
return false;
|
||||
}
|
||||
EntityWithId entity = (EntityWithId) obj;
|
||||
return this.getId().equals(entity.getId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: Base64File.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.dto.Base64File <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/22 下午12:22 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(description = "Base64文件")
|
||||
public class Base64File implements Serializable {
|
||||
|
||||
@ApiModelProperty("base64字符串")
|
||||
private String base64;
|
||||
@ApiModelProperty("文件名")
|
||||
private String name;
|
||||
@ApiModelProperty("文件类型")
|
||||
private String type;
|
||||
@ApiModelProperty("文件后缀,可以为空(通过文件名获取)")
|
||||
private String suffix;
|
||||
@ApiModelProperty("文件大小")
|
||||
private long size;
|
||||
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
|
||||
public void setBase64(String base64) {
|
||||
this.base64 = base64;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.dto;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
||||
import com.yxt.common.core.domain.Entity;
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: Dto.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.dto.Dto <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/17 23:30 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface Dto extends Vo {
|
||||
|
||||
default <E extends Entity> void fillEntity(E e) {
|
||||
BeanUtil.copyProperties(this, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.query;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: PagerQuery.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.query.PagerQuery <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/21 下午3:58 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PagerQuery<T extends Query> implements Serializable {
|
||||
|
||||
public PagerQuery() {
|
||||
}
|
||||
|
||||
public PagerQuery(long current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public PagerQuery(long current, long size) {
|
||||
this.size = size;
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
// @ApiModelProperty("总记录数")
|
||||
//private long total = 0L; //总记录数
|
||||
@ApiModelProperty(value = "每页记录数", example = "10")
|
||||
private long size = 10L; //每页记录数
|
||||
@ApiModelProperty(value = "当前页号", example = "1")
|
||||
private long current = 1L; //当前页号
|
||||
@ApiModelProperty("查询条件的项")
|
||||
private T params;
|
||||
|
||||
// @ApiModelProperty("每页记录数,size的别名,默认值为10")
|
||||
// public PagerQuery set_p_size(long _p_size) {
|
||||
// this.size = _p_size;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// @ApiModelProperty("当前页号,current的别名,默认值为1")
|
||||
// public PagerQuery set_p_no(long _p_no) {
|
||||
// this.current = _p_no;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// @ApiModelProperty("总记录数,total的别名,默认值为0")
|
||||
// public PagerQuery set_p_total(long _p_total) {
|
||||
// this.total = _p_total;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
/* public long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public PagerQuery setTotal(long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
*/
|
||||
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 void fromPagerQuery(PagerQuery s_query)
|
||||
{
|
||||
this.setCurrent(s_query.getCurrent()).setSize(s_query.getSize()).setParams(params.fromMap(s_query.getParams().toMap()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.query;
|
||||
|
||||
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: Query.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.query.Query <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/21 下午3:24 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface Query extends Vo {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author liuguohui
|
||||
* @Date 2021/10/11
|
||||
*/
|
||||
@ApiModel(description = "手机端返回数据结构(同查询数据字典)")
|
||||
@Data
|
||||
public class AppResultData {
|
||||
|
||||
@ApiModelProperty(value = "数据字典项sid")
|
||||
private String sid;
|
||||
|
||||
@ApiModelProperty(value = "数据字典项key")
|
||||
private String dictKey;
|
||||
|
||||
@ApiModelProperty(value = "数据字典类型")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "数据字典项名称")
|
||||
private String dictValue;
|
||||
@ApiModelProperty(value = "父级sid:0为第一级")
|
||||
private String parentSid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: FileUploadResult.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.base.vo.FileUploadResult <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/17 下午12:05 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(description = "文件上传结果")
|
||||
public class FileUploadResult {
|
||||
|
||||
@ApiModelProperty("上传的原文件名")
|
||||
private String sourceFileName;
|
||||
@ApiModelProperty("文件的相对路径")
|
||||
private String filePath;
|
||||
@ApiModelProperty("文件完整的访问URL")
|
||||
private String fullUrl;
|
||||
@ApiModelProperty("文件大小")
|
||||
private String size;
|
||||
|
||||
public FileUploadResult() {
|
||||
}
|
||||
|
||||
public FileUploadResult(String sourceFileName, String filePath, String fullUrl, String size) {
|
||||
this.sourceFileName = sourceFileName;
|
||||
this.filePath = filePath;
|
||||
this.fullUrl = fullUrl;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getSourceFileName() {
|
||||
return sourceFileName;
|
||||
}
|
||||
|
||||
public FileUploadResult setSourceFileName(String sourceFileName) {
|
||||
this.sourceFileName = sourceFileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public FileUploadResult setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFullUrl() {
|
||||
return fullUrl;
|
||||
}
|
||||
|
||||
public FileUploadResult setFullUrl(String fullUrl) {
|
||||
this.fullUrl = fullUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public FileUploadResult setSize(String size) {
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
/**
|
||||
* Project: yxt-common <br/>
|
||||
* File: IResultCodeMsg.java <br/>
|
||||
* Class: com.yxt.common.core.result.IResultCodeMsg <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2021/9/11 下午11:00 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface IResultCodeMsg {
|
||||
String getCode();
|
||||
String getMsg();
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
import com.yxt.common.core.constant.HttpStatus;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: yxt-common-core <br/>
|
||||
* File: ResultBean.java <br/>
|
||||
* Class: com.yxt.common.core.result.ResultBean <br/>
|
||||
* Description: 通过接口、Rest、逻辑处理执行后的结果信息. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/8/4 0:51 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(description = "返回结果")
|
||||
public class ResultBean<T> implements Serializable {
|
||||
private static final long serialVersionUID = 4529658978692424234L;
|
||||
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private Class<T> clazz() {
|
||||
// Class<T> targetClass = (Class<T>) ((ParameterizedType) this.getClass().getGenericSuperclass())
|
||||
// .getActualTypeArguments()[0];
|
||||
//// if(targetClass==null)
|
||||
//// targetClass=Object.class;
|
||||
// return targetClass;
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private T obj() {
|
||||
// T instance = null;
|
||||
// Class<T> targetClass = (Class<T>) ((ParameterizedType) this.getClass().getGenericSuperclass())
|
||||
// .getActualTypeArguments()[1];
|
||||
// try {
|
||||
// instance = targetClass.newInstance();
|
||||
// } catch (InstantiationException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// } catch (IllegalAccessException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return instance;
|
||||
// }
|
||||
|
||||
@ApiModelProperty("对象创建的时间戳")
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
// 是否成功
|
||||
@ApiModelProperty("是否成功: true or false")
|
||||
private boolean success;
|
||||
|
||||
// 消息 返回结果的说明
|
||||
@ApiModelProperty("返回结果的说明")
|
||||
private String msg;
|
||||
|
||||
// 结果状态码
|
||||
@ApiModelProperty("结果状态码")
|
||||
private String code;
|
||||
|
||||
// 数据
|
||||
@ApiModelProperty("业务数据")
|
||||
private T data;
|
||||
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ResultBean<T> setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean() {
|
||||
}
|
||||
|
||||
public ResultBean(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public ResultBean(boolean success, String msg) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ResultBean(boolean success, String msg, String code) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ResultBean(T data) {
|
||||
this.success = true;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBean(String code, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBean(String code, String msg, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public ResultBean<T> setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public ResultBean<T> setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public ResultBean<T> setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
// if (this.data == null && this.map != null && !this.map.isEmpty()) {
|
||||
//// Object t = new Object();
|
||||
//// Object r = (Object)this.map;map
|
||||
//// BeanUtil.fillBeanWithMap(this.map, t, false);
|
||||
// this.data = obj();
|
||||
// BeanUtil.copyProperties(this.map, this.data, true);
|
||||
//// this.data = (T) t;
|
||||
//// return t;
|
||||
// }
|
||||
return data;
|
||||
}
|
||||
|
||||
public ResultBean<T> setData(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean<T> successOne() {
|
||||
this.setSuccess(true);
|
||||
this.setCode("0");
|
||||
this.setMessage("成功!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean<T> failOne() {
|
||||
this.setSuccess(false);
|
||||
this.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
this.setMessage("操作失败!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean<T> success() {
|
||||
this.setSuccess(true);
|
||||
this.setCode(String.valueOf(HttpStatus.SUCCESS));
|
||||
this.setMsg("操作成功!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBean<T> fail() {
|
||||
this.setSuccess(false);
|
||||
this.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
this.setMsg("操作失败!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public static <T> ResultBean<T> fireSuccess() {
|
||||
ResultBean<T> rb = new ResultBean<T>();
|
||||
rb.setSuccess(true);
|
||||
rb.setCode(String.valueOf(HttpStatus.SUCCESS));
|
||||
rb.setMsg("操作成功!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
public static <T> ResultBean<T> fireFail() {
|
||||
ResultBean<T> rb = new ResultBean<T>();
|
||||
rb.setSuccess(false);
|
||||
rb.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
rb.setMsg("操作失败!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
// @ApiModelProperty("无类型的业务数据对象")
|
||||
//// @JsonIgnore
|
||||
// private Map<String, Object> map = Collections.emptyMap();
|
||||
//
|
||||
// public ResultBean<T> clear() {
|
||||
// this.map = null;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public Object get(String key) {
|
||||
// if (this.map == null)
|
||||
// return null;
|
||||
// return this.map.get(key);
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> remove(String key) {
|
||||
// if (this.map == null)
|
||||
// return this;
|
||||
// this.map.remove(key);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> put(String key, Object value) {
|
||||
// if (this.map == null)
|
||||
// this.map = new HashMap<>();
|
||||
// this.map.put(key, value);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public Map<String, Object> getMap() {
|
||||
// return this.map;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> setMap(Map<String, Object> map) {
|
||||
// this.map = map;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> putAll(Map<String, Object> map) {
|
||||
// if (this.map == null)
|
||||
// this.map = new HashMap<>();
|
||||
// this.map.putAll(map);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置返回code及msg
|
||||
*
|
||||
* @param codeMsg Code和Msg的枚举
|
||||
* @return
|
||||
*/
|
||||
public ResultBean<T> setCode(IResultCodeMsg codeMsg) {
|
||||
this.code = codeMsg.getCode();
|
||||
this.msg = codeMsg.getMsg();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败信息,并指定结果code
|
||||
* @param codeMsg Code和Msg的枚举
|
||||
* @return
|
||||
*/
|
||||
public ResultBean<T> fail(IResultCodeMsg codeMsg) {
|
||||
this.setSuccess(false);
|
||||
this.code = codeMsg.getCode();
|
||||
this.msg = codeMsg.getMsg();
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
import com.yxt.common.core.constant.HttpStatus;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: yxt-common-core <br/>
|
||||
* File: ResultBean.java <br/>
|
||||
* Class: com.yxt.common.core.result.ResultBean <br/>
|
||||
* Description: 通过接口、Rest、逻辑处理执行后的结果信息. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/8/4 0:51 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(description = "返回结果")
|
||||
public class ResultBeanOfEnum<T> implements Serializable {
|
||||
private static final long serialVersionUID = 4529658978692424234L;
|
||||
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private Class<T> clazz() {
|
||||
// Class<T> targetClass = (Class<T>) ((ParameterizedType) this.getClass().getGenericSuperclass())
|
||||
// .getActualTypeArguments()[0];
|
||||
//// if(targetClass==null)
|
||||
//// targetClass=Object.class;
|
||||
// return targetClass;
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private T obj() {
|
||||
// T instance = null;
|
||||
// Class<T> targetClass = (Class<T>) ((ParameterizedType) this.getClass().getGenericSuperclass())
|
||||
// .getActualTypeArguments()[1];
|
||||
// try {
|
||||
// instance = targetClass.newInstance();
|
||||
// } catch (InstantiationException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// } catch (IllegalAccessException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return instance;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("对象创建的时间戳")
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
// 是否成功
|
||||
@ApiModelProperty("是否成功: true or false")
|
||||
private boolean success;
|
||||
|
||||
// 消息 返回结果的说明
|
||||
@ApiModelProperty("返回结果的说明")
|
||||
private String msg;
|
||||
|
||||
// 结果状态码
|
||||
@ApiModelProperty("结果状态码")
|
||||
private String code;
|
||||
|
||||
// 数据
|
||||
@ApiModelProperty("业务数据")
|
||||
private T data;
|
||||
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum() {
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(boolean success, String msg) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(boolean success, String msg, String code) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(T data) {
|
||||
this.success = true;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(String code, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum(String code, String msg, T data) {
|
||||
this.success = true;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setCode(CodeMsg codeMsg) {
|
||||
// this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
// if (this.data == null && this.map != null && !this.map.isEmpty()) {
|
||||
//// Object t = new Object();
|
||||
//// Object r = (Object)this.map;map
|
||||
//// BeanUtil.fillBeanWithMap(this.map, t, false);
|
||||
// this.data = obj();
|
||||
// BeanUtil.copyProperties(this.map, this.data, true);
|
||||
//// this.data = (T) t;
|
||||
//// return t;
|
||||
// }
|
||||
return data;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> setData(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
public ResultBeanOfEnum<T> successOne() {
|
||||
this.setSuccess(true);
|
||||
this.setCode("0");
|
||||
this.setMessage("成功!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> failOne() {
|
||||
this.setSuccess(false);
|
||||
this.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
this.setMessage("操作失败!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> success() {
|
||||
this.setSuccess(true);
|
||||
this.setCode(String.valueOf(HttpStatus.SUCCESS));
|
||||
this.setMsg("操作成功!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResultBeanOfEnum<T> fail() {
|
||||
this.setSuccess(false);
|
||||
this.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
this.setMsg("操作失败!");
|
||||
return this;
|
||||
}
|
||||
|
||||
public static <T> ResultBeanOfEnum<T> fireSuccess() {
|
||||
ResultBeanOfEnum<T> rb = new ResultBeanOfEnum<T>();
|
||||
rb.setSuccess(true);
|
||||
rb.setCode(String.valueOf(HttpStatus.SUCCESS));
|
||||
rb.setMsg("操作成功!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
public static <T> ResultBeanOfEnum<T> fireFail() {
|
||||
ResultBeanOfEnum<T> rb = new ResultBeanOfEnum<T>();
|
||||
rb.setSuccess(false);
|
||||
rb.setCode(String.valueOf(HttpStatus.ERROR));
|
||||
rb.setMsg("操作失败!");
|
||||
return rb;
|
||||
}
|
||||
|
||||
// @ApiModelProperty("无类型的业务数据对象")
|
||||
//// @JsonIgnore
|
||||
// private Map<String, Object> map = Collections.emptyMap();
|
||||
//
|
||||
// public ResultBean<T> clear() {
|
||||
// this.map = null;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public Object get(String key) {
|
||||
// if (this.map == null)
|
||||
// return null;
|
||||
// return this.map.get(key);
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> remove(String key) {
|
||||
// if (this.map == null)
|
||||
// return this;
|
||||
// this.map.remove(key);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> put(String key, Object value) {
|
||||
// if (this.map == null)
|
||||
// this.map = new HashMap<>();
|
||||
// this.map.put(key, value);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public Map<String, Object> getMap() {
|
||||
// return this.map;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> setMap(Map<String, Object> map) {
|
||||
// this.map = map;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public ResultBean<T> putAll(Map<String, Object> map) {
|
||||
// if (this.map == null)
|
||||
// this.map = new HashMap<>();
|
||||
// this.map.putAll(map);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public enum CodeMsg{
|
||||
/**
|
||||
* 返回正常
|
||||
*/
|
||||
HTML200("200","返回正常"),
|
||||
|
||||
/**
|
||||
* 页面不存在
|
||||
*/
|
||||
HTML404("404","页面不存在"),
|
||||
|
||||
/**
|
||||
* 服务器错误
|
||||
*/
|
||||
HTML500("500","服务器错误");
|
||||
|
||||
private String code;
|
||||
private String msg;
|
||||
|
||||
private CodeMsg(String code,String msg){
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getMsg(){
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code得到枚举实例
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static CodeMsg byCode(String code){
|
||||
for(CodeMsg cm: CodeMsg.values()){
|
||||
if(cm.getCode().equals(code)){
|
||||
return cm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yxt.common.core.utils;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/30 17:38
|
||||
* @description
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface ExportEntityMap {
|
||||
|
||||
String EnName() default "数据库列名";
|
||||
String CnName() default "实体映射名";
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.yxt.common.core.utils.desensitized;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/10/9 11:33
|
||||
* @description 脱敏工具类
|
||||
*/
|
||||
|
||||
public class DesensitizedUtils {
|
||||
|
||||
/**
|
||||
* 对字符串进行脱敏操作
|
||||
*
|
||||
* @param origin 原始字符串
|
||||
* @param prefixNoMaskLen 左侧需要保留几位明文字段
|
||||
* @param suffixNoMaskLen 右侧需要保留几位明文字段
|
||||
* @param maskStr 用于遮罩的字符串, 如'*'
|
||||
* @return 脱敏后结果
|
||||
*/
|
||||
public static String desValue(String origin, int prefixNoMaskLen, int suffixNoMaskLen, String maskStr) {
|
||||
if (origin == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0, n = origin.length(); i < n; i++) {
|
||||
if (i < prefixNoMaskLen) {
|
||||
sb.append(origin.charAt(i));
|
||||
continue;
|
||||
}
|
||||
if (i > (n - suffixNoMaskLen - 1)) {
|
||||
sb.append(origin.charAt(i));
|
||||
continue;
|
||||
}
|
||||
sb.append(maskStr);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 【中文姓名】只显示最后一个汉字,其他隐藏为星号,比如:**梦
|
||||
*
|
||||
* @param fullName 姓名
|
||||
* @return 结果
|
||||
*/
|
||||
public static String chineseName(String fullName) {
|
||||
if (fullName == null) {
|
||||
return null;
|
||||
}
|
||||
if (fullName.length() == 2) {
|
||||
return desValue(fullName, 1, 0, "*");
|
||||
}else{
|
||||
return desValue(fullName, 1, 1, "*");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 【身份证号】显示前六位, 四位,其他隐藏。共计18位或者15位,比如:340304*******1234
|
||||
*
|
||||
* @param id 身份证号码
|
||||
* @return 结果
|
||||
*/
|
||||
public static String idCardNum(String id) {
|
||||
return desValue(id, 4, 4, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 【固定电话】后四位,其他隐藏,比如 ****1234
|
||||
*
|
||||
* @param num 固定电话
|
||||
* @return 结果
|
||||
*/
|
||||
public static String fixedPhone(String num) {
|
||||
return desValue(num, 0, 4, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 【手机号码】前三位,后四位,其他隐藏,比如135****6810
|
||||
*
|
||||
* @param num 手机号码
|
||||
* @return 结果
|
||||
*/
|
||||
public static String mobilePhone(String num) {
|
||||
return desValue(num, 3, 4, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 【地址】只显示到地区,不显示详细地址,比如:北京市海淀区****
|
||||
*
|
||||
* @param address 地址
|
||||
* @return 结果
|
||||
*/
|
||||
public static String address(String address) {
|
||||
return desValue(address, 6, 0, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 【电子邮箱 邮箱前缀仅显示第一个字母,前缀其他隐藏,用星号代替,@及后面的地址显示,比如:d**@126.com
|
||||
*
|
||||
* @param email 电子邮箱
|
||||
* @return 结果
|
||||
*/
|
||||
public static String email(String email) {
|
||||
if (email == null) {
|
||||
return null;
|
||||
}
|
||||
int index = StrUtil.indexOf(email, '@');
|
||||
if (index <= 1) {
|
||||
return email;
|
||||
}
|
||||
String preEmail = desValue(email.substring(0, index), 1, 0, "*");
|
||||
return preEmail + email.substring(index);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 【银行卡号】前六位,后四位,其他用星号隐藏每位1个星号,比如:622260**********1234
|
||||
*
|
||||
* @param cardNum 银行卡号
|
||||
* @return 结果
|
||||
*/
|
||||
public static String bankCard(String cardNum) {
|
||||
return desValue(cardNum, 6, 4, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 【密码】密码的全部字符都用*代替,比如:******
|
||||
*
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public static String password(String password) {
|
||||
if (password == null) {
|
||||
return null;
|
||||
}
|
||||
return "******";
|
||||
}
|
||||
|
||||
/**
|
||||
* 【密钥】密钥除了最后三位,全部都用*代替,比如:***xdS 脱敏后长度为6,如果明文长度不足三位,则按实际长度显示,剩余位置补*
|
||||
*
|
||||
* @param key 密钥
|
||||
* @return 结果
|
||||
*/
|
||||
public static String key(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
int viewLength = 6;
|
||||
StringBuilder tmpKey = new StringBuilder(desValue(key, 0, 3, "*"));
|
||||
if (tmpKey.length() > viewLength) {
|
||||
return tmpKey.substring(tmpKey.length() - viewLength);
|
||||
} else if (tmpKey.length() < viewLength) {
|
||||
int buffLength = viewLength - tmpKey.length();
|
||||
for (int i = 0; i < buffLength; i++) {
|
||||
tmpKey.insert(0, "*");
|
||||
}
|
||||
return tmpKey.toString();
|
||||
} else {
|
||||
return tmpKey.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yxt.common.core.utils.desensitized;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/10/9 11:50
|
||||
* @description 对象脱敏注解类
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
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.FIELD)
|
||||
@JacksonAnnotationsInside
|
||||
@JsonSerialize(using = SensitiveSerialize.class)
|
||||
public @interface Sensitive {
|
||||
|
||||
/**
|
||||
* 脱敏数据类型, 非Customer时, 将忽略 refixNoMaskLen 和 suffixNoMaskLen 和 maskStr
|
||||
*/
|
||||
SensitiveTypeEnum type() default SensitiveTypeEnum.CUSTOMER;
|
||||
|
||||
/**
|
||||
* 前置不需要打码的长度
|
||||
*/
|
||||
int prefixNoMaskLen() default 0;
|
||||
|
||||
/**
|
||||
* 后置不需要打码的长度
|
||||
*/
|
||||
int suffixNoMaskLen() default 0;
|
||||
|
||||
/**
|
||||
* 用什么打码
|
||||
*/
|
||||
String maskStr() default "*";
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.yxt.common.core.utils.desensitized;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.BeanProperty;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/10/9 11:35
|
||||
* @description 脱敏序列化类
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SensitiveSerialize extends JsonSerializer<String> implements ContextualSerializer {
|
||||
|
||||
private SensitiveTypeEnum type;
|
||||
|
||||
private Integer prefixNoMaskLen;
|
||||
|
||||
private Integer suffixNoMaskLen;
|
||||
|
||||
private String maskStr;
|
||||
|
||||
@Override
|
||||
public void serialize(final String origin, final JsonGenerator jsonGenerator,
|
||||
final SerializerProvider serializerProvider) throws IOException {
|
||||
switch (type) {
|
||||
case CHINESE_NAME:
|
||||
jsonGenerator.writeString(DesensitizedUtils.chineseName(origin));
|
||||
break;
|
||||
case ID_CARD:
|
||||
jsonGenerator.writeString(DesensitizedUtils.idCardNum(origin));
|
||||
break;
|
||||
case FIXED_PHONE:
|
||||
jsonGenerator.writeString(DesensitizedUtils.fixedPhone(origin));
|
||||
break;
|
||||
case MOBILE_PHONE:
|
||||
jsonGenerator.writeString(DesensitizedUtils.mobilePhone(origin));
|
||||
break;
|
||||
case ADDRESS:
|
||||
jsonGenerator.writeString(DesensitizedUtils.address(origin));
|
||||
break;
|
||||
case EMAIL:
|
||||
jsonGenerator.writeString(DesensitizedUtils.email(origin));
|
||||
break;
|
||||
case BANK_CARD:
|
||||
jsonGenerator.writeString(DesensitizedUtils.bankCard(origin));
|
||||
break;
|
||||
case PASSWORD:
|
||||
jsonGenerator.writeString(DesensitizedUtils.password(origin));
|
||||
break;
|
||||
case KEY:
|
||||
jsonGenerator.writeString(DesensitizedUtils.key(origin));
|
||||
break;
|
||||
case CUSTOMER:
|
||||
jsonGenerator.writeString(DesensitizedUtils.desValue(origin, prefixNoMaskLen, suffixNoMaskLen, maskStr));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknow sensitive type enum " + type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonSerializer<?> createContextual(final SerializerProvider serializerProvider,
|
||||
final BeanProperty beanProperty) throws JsonMappingException {
|
||||
if (beanProperty != null) {
|
||||
if (Objects.equals(beanProperty.getType().getRawClass(), String.class)) {
|
||||
Sensitive sensitive = beanProperty.getAnnotation(Sensitive.class);
|
||||
if (sensitive == null) {
|
||||
sensitive = beanProperty.getContextAnnotation(Sensitive.class);
|
||||
}
|
||||
if (sensitive != null) {
|
||||
return new SensitiveSerialize(sensitive.type(), sensitive.prefixNoMaskLen(),
|
||||
sensitive.suffixNoMaskLen(), sensitive.maskStr());
|
||||
}
|
||||
}
|
||||
return serializerProvider.findValueSerializer(beanProperty.getType(), beanProperty);
|
||||
}
|
||||
return serializerProvider.findNullValueSerializer(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.yxt.common.core.utils.desensitized;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2021/10/9 11:34
|
||||
* @description 敏感信息枚举类
|
||||
*/
|
||||
|
||||
public enum SensitiveTypeEnum {
|
||||
|
||||
/**
|
||||
* 自定义
|
||||
*/
|
||||
CUSTOMER,
|
||||
/**
|
||||
* 用户名, 刘*华, 徐*
|
||||
*/
|
||||
CHINESE_NAME,
|
||||
/**
|
||||
* 身份证号, 110110********1234
|
||||
*/
|
||||
ID_CARD,
|
||||
/**
|
||||
* 座机号, ****1234
|
||||
*/
|
||||
FIXED_PHONE,
|
||||
/**
|
||||
* 手机号, 176****1234
|
||||
*/
|
||||
MOBILE_PHONE,
|
||||
/**
|
||||
* 地址, 北京********
|
||||
*/
|
||||
ADDRESS,
|
||||
/**
|
||||
* 电子邮件, s*****o@xx.com
|
||||
*/
|
||||
EMAIL,
|
||||
/**
|
||||
* 银行卡, 622202************1234
|
||||
*/
|
||||
BANK_CARD,
|
||||
/**
|
||||
* 密码, 永远是 ******, 与长度无关
|
||||
*/
|
||||
PASSWORD,
|
||||
/**
|
||||
* 密钥, 永远是 ******, 与长度无关
|
||||
*/
|
||||
KEY
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/22 15:40
|
||||
* @description
|
||||
*/
|
||||
|
||||
public class BlockPuzzleCaptchaVO extends CaptchaBaseVO {
|
||||
|
||||
/**
|
||||
* 点选坐标
|
||||
*/
|
||||
private Point point;
|
||||
|
||||
/**
|
||||
* 滑块图片base64
|
||||
*/
|
||||
private String jigsawImageBase64;
|
||||
|
||||
public Point getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
public void setPoint(Point point) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public String getJigsawImageBase64() {
|
||||
return jigsawImageBase64;
|
||||
}
|
||||
|
||||
public void setJigsawImageBase64(String jigsawImageBase64) {
|
||||
this.jigsawImageBase64 = jigsawImageBase64;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/22 15:39
|
||||
* @description 验证码返回基础对象
|
||||
*/
|
||||
|
||||
public class CaptchaBaseVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 原生图片base64
|
||||
*/
|
||||
private String originalImageBase64;
|
||||
|
||||
public String getOriginalImageBase64() {
|
||||
return originalImageBase64;
|
||||
}
|
||||
|
||||
public void setOriginalImageBase64(String originalImageBase64) {
|
||||
this.originalImageBase64 = originalImageBase64;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import java.util.List;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/22 15:41
|
||||
* @description
|
||||
*/
|
||||
|
||||
public class ClickWordCaptchaVO extends CaptchaBaseVO {
|
||||
|
||||
/**
|
||||
* 点选文字
|
||||
*/
|
||||
private List<String> wordList;
|
||||
|
||||
/**
|
||||
* 点选坐标
|
||||
*/
|
||||
private List<Point> pointList;
|
||||
|
||||
public List<String> getWordList() {
|
||||
return wordList;
|
||||
}
|
||||
|
||||
public void setWordList(List<String> wordList) {
|
||||
this.wordList = wordList;
|
||||
}
|
||||
|
||||
public List<Point> getPointList() {
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public void setPointList(List<Point> pointList) {
|
||||
this.pointList = pointList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.yxt.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;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel(description = "返回的分页结果")
|
||||
public class PagerVo<T> implements Serializable {
|
||||
|
||||
@ApiModelProperty("总页数")
|
||||
private long pages = 1L; //总页数
|
||||
@ApiModelProperty("总记录数")
|
||||
private long total = 0L; //总记录数
|
||||
@ApiModelProperty("每页记录数")
|
||||
private long size = 10L; //每页记录数
|
||||
@ApiModelProperty("当前页号")
|
||||
private long current = 1L; //当前页号
|
||||
|
||||
@ApiModelProperty("当前页的数据")
|
||||
private List<T> records = Collections.emptyList(); //当前页的数据
|
||||
@ApiModelProperty("统计信息")
|
||||
private String msg = "";
|
||||
@ApiModelProperty("其它信息")
|
||||
private Map<String, Object> map = Collections.emptyMap();
|
||||
|
||||
|
||||
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 String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Map<String, Object> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<String, Object> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
// @ApiModelProperty("每页记录数,size的别名")
|
||||
// public long get_p_size() {
|
||||
// return size;
|
||||
// }
|
||||
//
|
||||
// @ApiModelProperty("当前页号,current的别名")
|
||||
// public long get_p_no() {
|
||||
// return current;
|
||||
// }
|
||||
//
|
||||
// @ApiModelProperty("总记录数,total的别名")
|
||||
// public long get_p_total() {
|
||||
// return total;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: Tail.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.vo.Tail <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/21 下午3:22 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface Tail extends Serializable {
|
||||
public Object get(String key);
|
||||
public void set(String key,Object value);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: TailBean.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.vo.TailBean <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/21 下午3:22 <br/>
|
||||
*
|
||||
* @author popo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class TailBean implements Tail {
|
||||
|
||||
protected Map<String, Object> extMap = new HashMap<String, Object>();
|
||||
|
||||
public Object get(String key) {
|
||||
return extMap.get(key);
|
||||
}
|
||||
|
||||
public void set(String key, Object value) {
|
||||
this.extMap.put(key, value);
|
||||
}
|
||||
|
||||
public Map<String, Object> getTails() {
|
||||
return extMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.common.core.vo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import com.yxt.common.core.domain.Entity;
|
||||
|
||||
/**
|
||||
* Project: jbsc-commons <br/>
|
||||
* File: Vo.java <br/>
|
||||
* Class: org.jbase.jbsc.commons.core.vo.Vo <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2020/9/18 0:03 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.common.core.result;
|
||||
|
||||
|
||||
import com.yxt.common.core.constant.HttpStatus;
|
||||
|
||||
|
||||
public class ResultBeanOfEnumTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ResultBeanOfEnum rb = ResultBeanOfEnum.fireFail();
|
||||
// ResultBean.CodeMsg.HTML200;
|
||||
rb.setCode("");
|
||||
rb.setCode(ResultBeanOfEnum.CodeMsg.HTML404);
|
||||
|
||||
rb.setCode(""+HttpStatus.ERROR);
|
||||
|
||||
ResultBeanOfEnum.CodeMsg[] values = ResultBeanOfEnum.CodeMsg.values();
|
||||
|
||||
|
||||
for (ResultBeanOfEnum.CodeMsg cm : values){
|
||||
System.out.println(cm);
|
||||
System.out.println(cm.name());
|
||||
System.out.println(cm.ordinal());
|
||||
System.out.println(cm.getMsg());
|
||||
System.out.println(cm.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
96
yxt-common/yxt-common-core/yxt-common-core.iml
Normal file
96
yxt-common/yxt-common-core/yxt-common-core.iml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
<sourceRoots>
|
||||
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
</sourceRoots>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-annotations:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-core:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.25.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-android" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.checkerframework:checker-compat-qual:2.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-core:5.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.20.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user