Open wangran99 opened 1 year ago
是不是跟Userinfo.java属性字段都是大写字母有关或者跟Jackson序列化到前端的字母都是小写有关,谢谢~~
如果 @Schema(description = "用户ID") 注解到实体类的get,set方法,就可以产生文档说明。 经过测试发现,实体类的属性字段都是大写,配置文件的Jackson未使用驼峰。如果实体类属性都是小写可以生成文档。配置的Mybatis-Plus:
#在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射 address_book ---> addressBook
mybatis-plus.configuration.map-underscore-to-camel-case=false
Describe the bug 使用springdoc注解@Schema(description = "用户名") 实体类,controller返回实体对象,但是文档没有显示实体对象属性的参数说明。
To Reproduce Steps to reproduce the behavior:
2.controller返回该类的对象
Expected behavior 期望doc.html文档生成该接口返回数据的字段说明,但是没有生成字段说明。
Screenshots If applicable, add screenshots to help explain your problem.
Knife4j Version (please complete the following information): `
`
Additional context springboot版本: 3.1.2
用户信息实体类(属性字段都是大写):
`import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size;
import java.io.Serializable; import java.time.LocalDateTime; import lombok.Data;
import java.time.LocalDateTime; import io.swagger.v3.oas.annotations.media.Schema; import org.hibernate.validator.constraints.Length;
/**
@TableName SYS_USERINFO */ @Data @Schema(description = "人员") public class SysUserinfo implements Serializable {
@NotBlank(message="[用户ID]不能为空") @Size(max= 32,message="编码长度不能超过32") @Schema(description = "用户ID") private String USERUUID;
@NotBlank(message="[用户名]不能为空") @Size(max= 32,message="编码长度不能超过32") @Schema(description = "用户名") private String USERID;
@Size(max= 32,message="编码长度不能超过32") @Schema(description = "密码") private String USERPWD;
} `
配置文件:
`
mybatis数据库配置
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver spring.datasource.url=jdbc:oracle:thin:@192.168.0.143:1521:ITARGE spring.datasource.username=itarge spring.datasource.password=itarge
#在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射 address_book ---> addressBook mybatis-plus.configuration.map-underscore-to-camel-case=false
显示mybatis-plus查询sql(如果不需要显示sql,可以注释该行)
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
redis配置
spring.data.redis.host=192.168.0.44 spring.data.redis.port=6379
springdoc.packagesToScan=com.laowang.springboot3template, com.package2 springdoc.swagger-ui.path=/swagger-ui.html `
doc.html页面截图: