1.add uniform swagger doc for comment,friend,gathering,tag

main
Gary 1 year ago
parent 77a89dc245
commit aa49c13837

@ -1,19 +1,41 @@
package com.luoo.comment;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import util.IdWorker;
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class CommentApplication {
public static void main(String[] args) {
SpringApplication.run(CommentApplication.class);
}
static Logger logger= LoggerFactory.getLogger(CommentApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application=SpringApplication.run(CommentApplication.class, args);
Environment env = application.getEnvironment();
logger.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:{}\n\t" +
"External: \thttp://{}:{}\n\t"+
"Doc: \thttp://{}:{}/doc.html\n"+
"----------------------------------------------------------",
env.getProperty("spring.application.name"),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));
}
@Bean
public IdWorker idWorker(){

@ -0,0 +1,27 @@
package com.luoo.comment.config;
import org.springframework.context.annotation.Configuration;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import swagger.BaseSwaggerConfig;
import swagger.SwaggerProperties;
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.luoo.comment.controller")
.title("luoo-comment API")
.description("luoo-comment 后端接口文档")
.contactName("宇鹏")
.version("1.0")
.enableSecurity(false)
.build();
}
}

@ -0,0 +1,15 @@
package com.luoo.comment.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}

@ -1,11 +1,19 @@
package com.luoo.friend;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import util.JwtUtil;
@SpringBootApplication
@ -13,9 +21,23 @@ import util.JwtUtil;
@EnableDiscoveryClient
@EnableFeignClients
public class FriendApplication {
public static void main(String[] args) {
SpringApplication.run(FriendApplication.class);
}
static Logger logger= LoggerFactory.getLogger(FriendApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application=SpringApplication.run(FriendApplication.class, args);
Environment env = application.getEnvironment();
logger.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:{}\n\t" +
"External: \thttp://{}:{}\n\t"+
"Doc: \thttp://{}:{}/doc.html\n"+
"----------------------------------------------------------",
env.getProperty("spring.application.name"),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));
}
@Bean
public JwtUtil jwtUtil(){

@ -1,19 +1,32 @@
package com.luoo.friend.config;
import com.luoo.friend.interceptor.JwtInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import com.luoo.friend.interceptor.JwtInterceptor;
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
@Autowired
private JwtInterceptor jwtInterceptor;
protected void addInterceptors(InterceptorRegistry registry) {
String[] excludePathPatterns = { "/user/login/**","/user/appLogin/**","/user/sendsms/**","/user/touristLogin","/doc.html/**","/swagger-resources/**","/webjars/**","/v2/**"};
registry.addInterceptor(jwtInterceptor).
addPathPatterns("/**").
excludePathPatterns("/login/**");
excludePathPatterns(excludePathPatterns);
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}

@ -0,0 +1,27 @@
package com.luoo.friend.config;
import org.springframework.context.annotation.Configuration;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import swagger.BaseSwaggerConfig;
import swagger.SwaggerProperties;
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.luoo.friend.controller")
.title("luoo-friend API")
.description("luoo-friend 后端接口文档")
.contactName("jeffrey")
.version("1.0")
.enableSecurity(false)
.build();
}
}

@ -1,17 +1,39 @@
package com.luoo.gathering;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import util.IdWorker;
@SpringBootApplication
@EnableCaching
@EnableEurekaClient
public class GatheringApplication {
public static void main(String[] args) {
SpringApplication.run(GatheringApplication.class, args);
static Logger logger= LoggerFactory.getLogger(GatheringApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application=SpringApplication.run(GatheringApplication.class, args);
Environment env = application.getEnvironment();
logger.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:{}\n\t" +
"External: \thttp://{}:{}\n\t"+
"Doc: \thttp://{}:{}/doc.html\n"+
"----------------------------------------------------------",
env.getProperty("spring.application.name"),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));
}
@Bean

@ -0,0 +1,27 @@
package com.luoo.gathering.config;
import org.springframework.context.annotation.Configuration;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import swagger.BaseSwaggerConfig;
import swagger.SwaggerProperties;
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.luoo.gathering.controller")
.title("luoo-gathering API")
.description("luoo-gathering 后端接口文档")
.contactName("")
.version("1.0")
.enableSecurity(false)
.build();
}
}

@ -0,0 +1,15 @@
package com.luoo.gathering.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}

@ -1,52 +1,44 @@
<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.luoo</groupId>
<artifactId>luoo_parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>luoo_tag</artifactId>
<dependencies>
<dependency>
<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.luoo</groupId>
<artifactId>luoo_parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>luoo_tag</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.luoo</groupId>
<artifactId>luoo_common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.luoo</groupId>
<artifactId>luoo_common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<finalName>app</finalName>
<plugins>
@ -54,15 +46,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- docker的maven插件官网 https://github.com/spotify/docker-maven-plugin -->
<!-- docker的maven插件官网
https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>116.62.145.60:5000/${project.artifactId}:${project.version}</imageName>
<imageName>
116.62.145.60:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
<entryPoint>["java",
"-jar","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>

@ -1,11 +1,18 @@
package com.luoo.tag;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import util.IdWorker;
@ -17,8 +24,22 @@ import util.IdWorker;
@EnableJpaAuditing
public class TagApplication {
public static void main(String[] args) {
SpringApplication.run(TagApplication.class, args);
static Logger logger= LoggerFactory.getLogger(TagApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application=SpringApplication.run(TagApplication.class, args);
Environment env = application.getEnvironment();
logger.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:{}\n\t" +
"External: \thttp://{}:{}\n\t"+
"Doc: \thttp://{}:{}/doc.html\n"+
"----------------------------------------------------------",
env.getProperty("spring.application.name"),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"));
}
@Bean

@ -0,0 +1,27 @@
package com.luoo.tag.config;
import org.springframework.context.annotation.Configuration;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import swagger.BaseSwaggerConfig;
import swagger.SwaggerProperties;
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.luoo.tag.controller")
.title("luoo-tag API")
.description("luoo-tag 后端接口文档")
.contactName("itao")
.version("1.0")
.enableSecurity(false)
.build();
}
}

@ -0,0 +1,15 @@
package com.luoo.tag.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}

@ -5,108 +5,78 @@ import com.luoo.tag.pojo.TagDTO;
import com.luoo.tag.pojo.TagQueryReq;
import com.luoo.tag.pojo.TagUpdateReq;
import com.luoo.tag.service.TagService;
import entity.Result;
import entity.ResultVO;
import entity.StatusCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
/**
* Web
*/
@RestController
@CrossOrigin
@Tag(name = "标签API")
@Api(tags = "标签API")
@RequestMapping("/tag")
@RequiredArgsConstructor
public class TagController {
private final TagService tagService;
private final TagService tagService;
@Operation(
description = "查询标签列表",
summary = "查询标签列表",
parameters = {
@Parameter(name = "queryReq", description = "查询参数", required = true),
@Parameter(name = "pageNum", description = "页码", required = true),
@Parameter(name = "pageSize", description = "每页数", required = true)
}
)
@GetMapping("/list")
public ResultVO<Page<TagDTO>> getById(@Validated TagQueryReq queryReq){
return ResultVO.success(tagService.queryPage(queryReq));
}
@ApiOperation(value = "查询标签列表", notes = "查询标签列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "queryReq", value = "查询参数", required = true),
@ApiImplicitParam(name = "pageNum", value = "页码", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页数", required = true) })
@GetMapping("/list")
public ResultVO<Page<TagDTO>> getById(@Validated TagQueryReq queryReq) {
return ResultVO.success(tagService.queryPage(queryReq));
}
@Operation(
description = "查询标签详情",
summary = "查询标签详情",
parameters = {
@Parameter(name = "id", description = "标签ID", required = true)
}
)
@GetMapping("/{id}")
public ResultVO<TagDTO> getById(@PathVariable String id){
return ResultVO.success(tagService.queryById(id));
}
@ApiOperation(value = "查询标签详情", notes = "查询标签详情")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@GetMapping("/{id}")
public ResultVO<TagDTO> getById(@PathVariable String id) {
return ResultVO.success(tagService.queryById(id));
}
@Operation(
description = "新增标签信息",
summary = "新增标签信息",
parameters = {
@Parameter(name = "createReq", description = "创建参数", required = true)
}
)
@PostMapping
public ResultVO<Void> create(@Validated @RequestBody TagCreateReq createReq){
tagService.create(createReq);
return ResultVO.success("创建成功");
}
@ApiOperation(value = "新增标签信息", notes = "新增标签信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "createReq", value = "创建参数", required = true) })
@PostMapping
public ResultVO<Void> create(@Validated @RequestBody TagCreateReq createReq) {
tagService.create(createReq);
return ResultVO.success("创建成功");
}
@Operation(
description = "更新标签信息",
summary = "更新标签信息",
parameters = {
@Parameter(name = "updateReq", description = "更新参数", required = true),
@Parameter(name = "id", description = "标签ID", required = true)
}
)
@PutMapping("/{id}")
public ResultVO<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id){
updateReq.setId(id);
tagService.update(updateReq);
return ResultVO.success("更新成功");
}
@ApiOperation(value = "更新标签信息", notes = "更新标签信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "updateReq", value = "更新参数", required = true),
@ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@PutMapping("/{id}")
public ResultVO<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
updateReq.setId(id);
tagService.update(updateReq);
return ResultVO.success("更新成功");
}
@Operation(
description = "更新标签状态",
summary = "更新标签状态",
parameters = {
@Parameter(name = "id", description = "标签ID", required = true),
@Parameter(name = "state", description = "标签状态", required = true)
}
)
@PutMapping("/status/{id}")
public ResultVO<Void> updateStatus(@PathVariable String id, @RequestParam Integer state){
tagService.updateState(id, state);
return ResultVO.success("状态更新成功");
}
@ApiOperation(value = "更新标签状态", notes = "更新标签状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标签ID", required = true),
@ApiImplicitParam(name = "state", value = "标签状态", required = true) })
@PutMapping("/status/{id}")
public ResultVO<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
tagService.updateState(id, state);
return ResultVO.success("状态更新成功");
}
@Operation(
description = "删除标签",
summary = "删除标签",
parameters = {
@Parameter(name = "id", description = "标签ID", required = true)
}
)
@DeleteMapping("/{id}")
public ResultVO<Void> delete(@PathVariable String id){
tagService.delete(id);
return ResultVO.success("删除成功");
}
@ApiOperation(value = "删除标签", notes = "删除标签")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@DeleteMapping("/{id}")
public ResultVO<Void> delete(@PathVariable String id) {
tagService.delete(id);
return ResultVO.success("删除成功");
}
}

@ -1,8 +1,8 @@
package com.luoo.tag.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -10,18 +10,18 @@ import java.io.Serializable;
*
*/
@Data
@Schema(description = "标签创建请求")
@ApiModel(value = "标签创建请求")
public class TagCreateReq implements Serializable {
private static final long serialVersionUID = -3431829126574541980L;
@Schema(description = "父标签ID")
@ApiModelProperty(value = "父标签ID")
private String parentId;
@Schema(description = "标签中文名")
@ApiModelProperty(value = "标签中文名")
@NotBlank(message = "标签中文名称必填")
private String nameCh;
@Schema(description = "标签英文名")
@ApiModelProperty(value = "标签英文名")
@NotBlank(message = "标签英文名称必填")
private String nameEn;
}

@ -1,48 +1,49 @@
package com.luoo.tag.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Schema(description = "标签DTO")
@ApiModel(value = "标签DTO")
public class TagDTO implements Serializable {
private static final long serialVersionUID = -1198060864891902188L;
@Schema(description = "标签ID")
@ApiModelProperty(value = "标签ID")
private String id;
@Schema(description = "父标签ID")
@ApiModelProperty(value = "父标签ID")
private String parentId;
@Schema(description = "父标签名称")
@ApiModelProperty(value = "父标签名称")
private String parentNameCh = "";
@Schema(description = "标签中文名称")
@ApiModelProperty(value = "标签中文名称")
private String nameCh;
@Schema(description = "标签英文名称")
@ApiModelProperty(value = "标签英文名称")
private String nameEn;
@Schema(description = "标签状态 0=禁用1=启用")
@ApiModelProperty(value = "标签状态 0=禁用1=启用")
private Integer state;
@Schema(description = "子标签数量")
@ApiModelProperty(value = "子标签数量")
private Long childTagCount = 0L;
@Schema(description = "关联期刊数量TODO")
@ApiModelProperty(value = "关联期刊数量TODO")
private Long articleRefCount = 0L;
@Schema(description = "关联歌曲数量")
@ApiModelProperty(value = "关联歌曲数量")
private Long songRefCount = 0L;
@Schema(description = "创建人")
@ApiModelProperty(value = "创建人")
private String creatorName;
@Schema(description = "创建时间")
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

@ -1,7 +1,8 @@
package com.luoo.tag.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ -12,38 +13,38 @@ import java.time.LocalDateTime;
*
*/
@Data
@Schema(description = "标签列表查询请求")
@ApiModel(value = "标签列表查询请求")
public class TagQueryReq implements Serializable {
private static final long serialVersionUID = -1198060864891902188L;
@NotNull(message = "标签层级不能为空1=一级2=二级")
@Schema(description = "标签层级 1=一级2=二级")
@ApiModelProperty(value = "标签层级 1=一级2=二级")
private Integer level;
@Schema(description = "标签ID")
@ApiModelProperty(value = "标签ID")
private String id;
@Schema(description = "父标签ID")
@ApiModelProperty(value = "父标签ID")
private String parentId;
@Schema(description = "标签名称")
@ApiModelProperty(value = "标签名称")
private String name;
@Schema(description = "标签状态 0=禁用1=启用")
@ApiModelProperty(value = "标签状态 0=禁用1=启用")
private Integer state;
@Schema(description = "创建人ID")
@ApiModelProperty(value = "创建人ID")
private String creatorId;
@Schema(description = "创建时间-开始")
@ApiModelProperty(value = "创建时间-开始")
private LocalDateTime createTimeStart;
@Schema(description = "创建时间-结束")
@ApiModelProperty(value = "创建时间-结束")
private LocalDateTime createTimeEnd;
@Schema(description = "分页: 页码", defaultValue = "1")
@ApiModelProperty(value = "分页: 页码", example = "1")
private int pageNum = 1;
@Schema(description = "分页: 每页数量", defaultValue = "10")
@ApiModelProperty(value = "分页: 每页数量", example = "10")
private int pageSize = 10;
}

@ -1,29 +1,27 @@
package com.luoo.tag.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*/
@Data
@Schema(description = "标签更新请求")
@ApiModel(value = "标签更新请求")
public class TagUpdateReq implements Serializable {
private static final long serialVersionUID = -8810544476079524714L;
@Schema(description = "标签ID")
@ApiModelProperty(value = "标签ID")
private String id;
@Schema(description = "标签中文名")
@ApiModelProperty(value = "标签中文名")
@NotBlank(message = "标签中文名称必填")
private String nameCh;
@Schema(description = "标签英文名")
@ApiModelProperty(value = "标签英文名")
@NotBlank(message = "标签英文名称必填")
private String nameEn;
}

Loading…
Cancel
Save