fix: 代码生成模板问题修复
This commit is contained in:
@@ -10,6 +10,7 @@ import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
#end
|
||||
#end
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* $!{table.comment}
|
||||
|
||||
@@ -8,8 +8,8 @@ import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||
import ${package.Parent}.service.${table.serviceName};
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.youlai.system.common.result.PageResult;
|
||||
import com.youlai.system.common.result.Result;
|
||||
import com.youlai.common.result.PageResult;
|
||||
import com.youlai.common.result.Result;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@@ -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{
|
||||
|
||||
|
||||
@@ -1,11 +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;
|
||||
@@ -14,6 +10,7 @@ import lombok.Setter;
|
||||
#end
|
||||
#end
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* $!{table.comment} DTO
|
||||
*
|
||||
@@ -27,11 +24,7 @@ import java.io.Serializable;
|
||||
@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})
|
||||
@@ -52,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};
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
|
||||
#end
|
||||
|
||||
/**
|
||||
* $!{table.comment}
|
||||
* $!{table.comment}实体
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -8,6 +8,7 @@ import ${mapperAnnotationClass.name};
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import ${package.Parent}.model.bo.${entity}BO;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* $!{table.comment} Mapper 接口
|
||||
@@ -19,6 +20,7 @@ import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
@${mapperAnnotationClass.simpleName}
|
||||
#end
|
||||
|
||||
@Mapper
|
||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 >= #{queryParams.startTime}
|
||||
</if>
|
||||
@@ -60,6 +57,7 @@
|
||||
AND create_time <= #{queryParams.endTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package ${package.Parent}.model.query;
|
||||
|
||||
import ${package.Parent}.common.base.BasePageQuery;
|
||||
import com.youlai.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* $!{table.comment}分页查询对象
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -53,9 +53,9 @@ public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||
/**
|
||||
* 删除$!{table.comment}
|
||||
*
|
||||
* @param idsStr $!{table.comment}ID,多个以英文逗号(,)分割
|
||||
* @param ids $!{table.comment}ID,多个以英文逗号(,)分割
|
||||
* @return
|
||||
*/
|
||||
boolean delete${entity}s(String idsStr);
|
||||
boolean delete${entity}s(String ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import ${package.Service}.${table.serviceName};
|
||||
import ${superServiceImplClassPackage};
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.youlai.system.common.util.DateUtils;
|
||||
import com.youlai.common.util.DateUtils;
|
||||
import ${package.Parent}.model.form.${entity}Form;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import ${package.Parent}.model.bo.${entity}BO;
|
||||
@@ -18,14 +18,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 服务实现类
|
||||
* $!{table.comment}服务实现类
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
@@ -101,17 +100,17 @@ public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.m
|
||||
/**
|
||||
* 删除$!{table.comment}
|
||||
*
|
||||
* @param idsStr $!{table.comment}ID,多个以英文逗号(,)分割
|
||||
* @param ids $!{table.comment}ID,多个以英文逗号(,)分割
|
||||
* @return true|false
|
||||
*/
|
||||
@Override
|
||||
public boolean delete${entity}s(String idsStr) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(idsStr), "删除的$!{table.comment}数据为空");
|
||||
public boolean delete${entity}s(String ids) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的$!{table.comment}数据为空");
|
||||
// 逻辑删除
|
||||
List<Long> ids = Arrays.stream(idsStr.split(","))
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
return this.removeByIds(ids);
|
||||
.toList();
|
||||
return this.removeByIds(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package ${package.Parent}.model.vo;
|
||||
|
||||
#foreach($pkg in ${table.importPackages})
|
||||
import ${pkg};
|
||||
#end
|
||||
#if(${springdoc})
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
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 +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})
|
||||
@@ -55,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};
|
||||
|
||||
Reference in New Issue
Block a user