项目模块初步完成

This commit is contained in:
2025-05-06 16:38:42 +08:00
parent 5038cebbfa
commit 2eb5ee1207
21 changed files with 1026 additions and 132 deletions

View File

@ -1,6 +1,8 @@
package ${parentPackage}.${dtoPackage};
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
@ -10,7 +12,13 @@ import java.io.Serializable;
* ${entityComment}添加请求体
*/
@Data
@Schema(description = "${entityComment}添加请求体", requiredProperties = {"name", "categoryId", "price", "image", "period", "isShelves"})
@Schema(description = "${entityComment}添加请求体", requiredProperties = {
#foreach($field in ${table.fields})
#if(!$field.keyFlag && $field.propertyName != "id" && $field.propertyName != "createTime" && $field.propertyName != "updateTime" && $field.propertyName != "isDelete")
"${field.propertyName}",
#end
#end
})
public class ${entityName}AddRequest implements Serializable {
#foreach($field in ${table.fields})
@ -18,7 +26,13 @@ public class ${entityName}AddRequest implements Serializable {
/**
* ${field.comment}
*/
@Schema(description = "${field.comment}", example = "${field.example}")
#if($field.propertyType == "String")
@NotBlank(message = "${field.comment}不能为空")
#end
#if($field.propertyType == "Long")
@Min(value = 1L, message = "${field.comment} ID不能小于1")
#end
@Schema(description = "${field.comment}", example = "")
private ${field.propertyType} ${field.propertyName};
#end
@ -27,3 +41,4 @@ public class ${entityName}AddRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,10 +1,13 @@
package ${parentPackage}.${dtoPackage};
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import ${parentPackage}.common.PageRequest;
import com.greenorange.promotion.common.PageRequest;
/**
* ${entityComment}查询请求体,继承自分页请求 PageRequest
@ -17,6 +20,7 @@ public class ${entityName}QueryRequest extends PageRequest implements Serializab
* ${entityComment} ID
*/
@Schema(description = "${entityComment} ID", example = "1")
@Min(value = 1L, message = "${entityComment} ID不能小于1")
private Long id;
#foreach($field in ${table.fields})
@ -24,7 +28,10 @@ public class ${entityName}QueryRequest extends PageRequest implements Serializab
/**
* ${field.comment}
*/
@Schema(description = "${field.comment}", example = "${field.example}")
#if($field.propertyType == "String")
@NotBlank(message = "${field.comment}不能为空")
#end
@Schema(description = "${field.comment}", example = "")
private ${field.propertyType} ${field.propertyName};
#end
@ -33,3 +40,4 @@ public class ${entityName}QueryRequest extends PageRequest implements Serializab
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,6 +1,8 @@
package ${parentPackage}.${dtoPackage};
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
@ -10,21 +12,27 @@ import java.io.Serializable;
* ${entityComment}更新请求体
*/
@Data
@Schema(description = "${entityComment}更新请求体", requiredProperties = {"id", "name", "categoryId", "price", "image", "period", "isShelves"})
@Schema(description = "${entityComment}更新请求体", requiredProperties = {
#foreach($field in ${table.fields})
#if(!$field.keyFlag && $field.propertyName != "createTime" && $field.propertyName != "updateTime" && $field.propertyName != "isDelete")
"${field.propertyName}",
#end
#end
})
public class ${entityName}UpdateRequest implements Serializable {
/**
* ${entityComment} ID
*/
@Schema(description = "${entityComment} ID", example = "1")
private Long id;
#foreach($field in ${table.fields})
#if(!$field.keyFlag && $field.propertyName != "createTime" && $field.propertyName != "updateTime" && $field.propertyName != "isDelete")
/**
* ${field.comment}
*/
@Schema(description = "${field.comment}", example = "${field.example}")
#if($field.propertyType == "String")
@NotBlank(message = "${field.comment}不能为空")
#end
#if($field.propertyType == "Long")
@Min(value = 1L, message = "${field.comment} ID不能小于1")
#end
@Schema(description = "${field.comment}", example = "")
private ${field.propertyType} ${field.propertyName};
#end
@ -32,4 +40,4 @@ public class ${entityName}UpdateRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
}
}