Cloud Starter Data


License

License

Categories

Categories

Data
GroupId

GroupId

com.minlia.cloud.starter
ArtifactId

ArtifactId

cloud-starter-data
Last Version

Last Version

2.0.0.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

Cloud Starter Data
Cloud Starter Data
Source Code Management

Source Code Management

https://github.com/minlia-projects/cloud-starter-data

Download cloud-starter-data

How to add to project

<!-- https://jarcasting.com/artifacts/com.minlia.cloud.starter/cloud-starter-data/ -->
<dependency>
    <groupId>com.minlia.cloud.starter</groupId>
    <artifactId>cloud-starter-data</artifactId>
    <version>2.0.0.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.minlia.cloud.starter/cloud-starter-data/
implementation 'com.minlia.cloud.starter:cloud-starter-data:2.0.0.RELEASE'
// https://jarcasting.com/artifacts/com.minlia.cloud.starter/cloud-starter-data/
implementation ("com.minlia.cloud.starter:cloud-starter-data:2.0.0.RELEASE")
'com.minlia.cloud.starter:cloud-starter-data:jar:2.0.0.RELEASE'
<dependency org="com.minlia.cloud.starter" name="cloud-starter-data" rev="2.0.0.RELEASE">
  <artifact name="cloud-starter-data" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.minlia.cloud.starter', module='cloud-starter-data', version='2.0.0.RELEASE')
)
libraryDependencies += "com.minlia.cloud.starter" % "cloud-starter-data" % "2.0.0.RELEASE"
[com.minlia.cloud.starter/cloud-starter-data "2.0.0.RELEASE"]

Dependencies

compile (9)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.0.0.RELEASE
org.projectlombok : lombok Optional jar 1.16.18
org.apache.commons : commons-lang3 Optional jar 3.7
org.springframework.boot : spring-boot-starter-security Optional jar 2.0.0.RELEASE
org.springframework.boot : spring-boot-starter-jdbc Optional jar 2.0.0.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.0.0.RELEASE
com.minlia.cloud.starter : cloud-starter-stateful jar 2.0.0.RELEASE
com.baomidou : mybatis-plus jar 2.2.0
com.baomidou : mybatis-plus-boot-starter jar 2.2.0

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.0.0.RELEASE

Project Modules

There are no modules declared in this project.

数据访问自动化

同时启用Mybatis与Data Jpa

@Data
@Entity
@Table(name = TABLE_NAME)
@TableName(TABLE_NAME)
public class Role extends AbstractEntity {

    private static final String TABLE_NAME="system_role";

    /**
     * 忽略掉集合类型
     */
    @Transient
    @TableField(exist=false)
    @ApiModelProperty(value = "权限集合")
    private List<Permission> permissions;
}

与单独的JPA使用时不同的是需要独立出中间对象
新增一个Mapping后缀,定义为实体中间表

@Data
@Entity
@Table(name = TABLE_NAME)
@TableName(TABLE_NAME)
public class RolePermissionMapping extends AbstractEntity {

    private static final String TABLE_NAME="map_role_permission";

    @ApiModelProperty(value = "角色id")
    private String roleId;

    @ApiModelProperty(value = "权限id")
    private String permissionId;
}

结合mybatis与mybatisplus框架提供的强大功能,提供数据访问自动化的能力

Maven Central Apache License 2 Build Status Waffle.io - Columns and their card count

集成到自已的项目时添加依赖项

<dependency>
  <groupId>com.minlia.cloud.starter</groupId>
  <artifactId>cloud-starter-data</artifactId>
  <version>2.0.0.RELEASE</version>
</dependency>

后端Endpoint层代码

  @PostMapping(value = "/api/status/post")
  @ApiOperation(value = "状态", notes = "测试提交", httpMethod = "POST")
  public StatefulBody postStatus(@RequestBody WithIdBody body) {
    Assertion.is(true, ApiCode.ACCOUNT_DISABLED);
    return SuccessResponseBody.builder().build();
  }

返回报文示例

{
  "payload":{
    "id":33333333333,
    "balance":228866.00
  }
  "code": 1,//业务返回码
  "message": "OK",//业务返回释义
  "requestId": "cZCu5aAftUn2ivn2rcKb2YUhb6N7ijP420180402212405106502",//当前请求编号
  "status": 200,//请求的http状态码
  "timestamp": 1522675445311//当前请求时间戳
}
com.minlia.cloud.starter

MINLIA

Versions

Version
2.0.0.RELEASE