refactor: 代码模板优化

This commit is contained in:
hxr 2024-04-19 08:03:12 +08:00
parent 88f92fc2e9
commit 815ae1db9d
7 changed files with 14 additions and 78 deletions

View File

@ -10,6 +10,12 @@ import ${package.Parent}.model.vo.${entity}PageVO;
import ${package.Parent}.model.form.${entity}Form;
import ${package.Parent}.model.bo.${entity}BO;
/**
* $!{table.comment}转换器
*
* @author ${author}
* @since ${date}
*/
@Mapper(componentModel = "spring")
public interface ${entity}Converter{

View File

@ -1,12 +1,7 @@
package ${package.Parent}.model.dto;
#if(${springdoc})
import io.swagger.v3.oas.annotations.media.Schema;
#elseif(${swagger})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Getter;
import lombok.Setter;
@ -29,11 +24,7 @@ import java.time.LocalDateTime;
@Accessors(chain = true)
#end
#end
#if(${springdoc})
@Schema(name = "${entity}", description = "$!{table.comment}")
#elseif(${swagger})
@ApiModel(value = "${entity}对象", description = "$!{table.comment}")
#end
@Schema( description = "$!{table.comment}传输层对象")
#if(${superEntityClass})
public class ${entity}DTO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
@ -54,15 +45,7 @@ public class ${entity}DTO {
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${springdoc})
@Schema(description = "${field.comment}")
#elseif(${swagger})
@ApiModelProperty("${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
private ${field.propertyType} ${field.propertyName};

View File

@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
#end
/**
* $!{table.comment}
* $!{table.comment}实体
*
* @author ${author}
* @since ${date}

View File

@ -3,12 +3,7 @@ package ${package.Parent}.model.form;
#foreach($pkg in ${table.importPackages})
import ${pkg};
#end
#if(${springdoc})
import io.swagger.v3.oas.annotations.media.Schema;
#elseif(${swagger})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Getter;
import lombok.Setter;
@ -30,11 +25,7 @@ import lombok.Setter;
@Accessors(chain = true)
#end
#end
#if(${springdoc})
@Schema(name = "${entity}", description = "$!{table.comment}")
#elseif(${swagger})
@ApiModel(value = "${entity}对象", description = "$!{table.comment}")
#end
@Schema(description = "$!{table.comment}表单对象")
#if(${superEntityClass})
public class ${entity}Form extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
@ -55,15 +46,7 @@ public class ${entity}Form {
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${springdoc})
@Schema(description = "${field.comment}")
#elseif(${swagger})
@ApiModelProperty("${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
private ${field.propertyType} ${field.propertyName};

View File

@ -40,19 +40,16 @@
<!-- ${table.comment}分页列表 -->
<select id="listPaged${entity}s" resultType="${package.Parent}.model.bo.${entity}BO">
SELECT
${Base_Column_List}
<include refid="Base_Column_List"/>
FROM
${table.name}
<where>
deleted = 0
is_deleted = 0
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
AND (
name LIKE CONCAT('%',#{queryParams.keywords},'%')
)
</if>
<if test='queryParams.status!=null'>
AND status = #{queryParams.status}
</if>
<if test="queryParams.startTime != null">
AND create_time &gt;= #{queryParams.startTime}
</if>
@ -60,6 +57,7 @@
AND create_time &lt;= #{queryParams.endTime}
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>

View File

@ -3,12 +3,7 @@ package ${package.Parent}.model.vo;
#foreach($pkg in ${table.importPackages})
import ${pkg};
#end
#if(${springdoc})
import io.swagger.v3.oas.annotations.media.Schema;
#elseif(${swagger})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Getter;
import lombok.Setter;
@ -30,11 +25,7 @@ import lombok.Setter;
@Accessors(chain = true)
#end
#end
#if(${springdoc})
@Schema(name = "${entity}", description = "$!{table.comment}")
#elseif(${swagger})
@ApiModel(value = "${entity}分页视图对象", description = "$!{table.comment}")
#end
@Schema( description = "$!{table.comment}分页视图对象")
#if(${superEntityClass})
public class ${entity}PageVO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
@ -55,15 +46,7 @@ public class ${entity}PageVO {
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${springdoc})
@Schema(description = "${field.comment}")
#elseif(${swagger})
@ApiModelProperty("${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
private ${field.propertyType} ${field.propertyName};

View File

@ -2,12 +2,7 @@ package ${package.Parent}.model.vo;
import java.io.Serializable;
import java.time.LocalDateTime;
#if(${springdoc})
import io.swagger.v3.oas.annotations.media.Schema;
#elseif(${swagger})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Getter;
import lombok.Setter;
@ -29,11 +24,7 @@ import lombok.Setter;
@Accessors(chain = true)
#end
#end
#if(${springdoc})
@Schema(name = "${entity}", description = "$!{table.comment}")
#elseif(${swagger})
@ApiModel(value = "${entity}视图对象", description = "$!{table.comment}")
#end
@Schema( description = "$!{table.comment}视图对象")
#if(${superEntityClass})
public class ${entity}VO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
@ -54,15 +45,7 @@ public class ${entity}VO {
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
#if(${springdoc})
@Schema(description = "${field.comment}")
#elseif(${swagger})
@ApiModelProperty("${field.comment}")
#else
/**
* ${field.comment}
*/
#end
#end
private ${field.propertyType} ${field.propertyName};