fix: 代码生成模板问题修复
This commit is contained in:
@@ -10,6 +10,7 @@ import lombok.Setter;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment}
|
* $!{table.comment}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import ${package.Parent}.model.query.${entity}PageQuery;
|
|||||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||||
import ${package.Parent}.service.${table.serviceName};
|
import ${package.Parent}.service.${table.serviceName};
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.youlai.system.common.result.PageResult;
|
import com.youlai.common.result.PageResult;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.common.result.Result;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
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.form.${entity}Form;
|
||||||
import ${package.Parent}.model.bo.${entity}BO;
|
import ${package.Parent}.model.bo.${entity}BO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $!{table.comment}转换器
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since ${date}
|
||||||
|
*/
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface ${entity}Converter{
|
public interface ${entity}Converter{
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package ${package.Parent}.model.dto;
|
package ${package.Parent}.model.dto;
|
||||||
|
|
||||||
#if(${springdoc})
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
#elseif(${swagger})
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
#end
|
|
||||||
#if(${entityLombokModel})
|
#if(${entityLombokModel})
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -14,6 +10,7 @@ import lombok.Setter;
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
/**
|
/**
|
||||||
* $!{table.comment} DTO
|
* $!{table.comment} DTO
|
||||||
*
|
*
|
||||||
@@ -27,11 +24,7 @@ import java.io.Serializable;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
@Schema( description = "$!{table.comment}传输层对象")
|
||||||
@Schema(name = "${entity}", description = "$!{table.comment}")
|
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModel(value = "${entity}对象", description = "$!{table.comment}")
|
|
||||||
#end
|
|
||||||
#if(${superEntityClass})
|
#if(${superEntityClass})
|
||||||
public class ${entity}DTO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
public class ${entity}DTO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||||
#elseif(${activeRecord})
|
#elseif(${activeRecord})
|
||||||
@@ -52,15 +45,7 @@ public class ${entity}DTO {
|
|||||||
#set($keyPropertyName=${field.propertyName})
|
#set($keyPropertyName=${field.propertyName})
|
||||||
#end
|
#end
|
||||||
#if("$!field.comment" != "")
|
#if("$!field.comment" != "")
|
||||||
#if(${springdoc})
|
|
||||||
@Schema(description = "${field.comment}")
|
@Schema(description = "${field.comment}")
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModelProperty("${field.comment}")
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* ${field.comment}
|
|
||||||
*/
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
private ${field.propertyType} ${field.propertyName};
|
private ${field.propertyType} ${field.propertyName};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment}
|
* $!{table.comment}实体
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ package ${package.Parent}.model.form;
|
|||||||
#foreach($pkg in ${table.importPackages})
|
#foreach($pkg in ${table.importPackages})
|
||||||
import ${pkg};
|
import ${pkg};
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
#elseif(${swagger})
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
#end
|
|
||||||
#if(${entityLombokModel})
|
#if(${entityLombokModel})
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -30,11 +25,7 @@ import lombok.Setter;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
@Schema(description = "$!{table.comment}表单对象")
|
||||||
@Schema(name = "${entity}", description = "$!{table.comment}")
|
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModel(value = "${entity}对象", description = "$!{table.comment}")
|
|
||||||
#end
|
|
||||||
#if(${superEntityClass})
|
#if(${superEntityClass})
|
||||||
public class ${entity}Form extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
public class ${entity}Form extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||||
#elseif(${activeRecord})
|
#elseif(${activeRecord})
|
||||||
@@ -55,15 +46,7 @@ public class ${entity}Form {
|
|||||||
#set($keyPropertyName=${field.propertyName})
|
#set($keyPropertyName=${field.propertyName})
|
||||||
#end
|
#end
|
||||||
#if("$!field.comment" != "")
|
#if("$!field.comment" != "")
|
||||||
#if(${springdoc})
|
|
||||||
@Schema(description = "${field.comment}")
|
@Schema(description = "${field.comment}")
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModelProperty("${field.comment}")
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* ${field.comment}
|
|
||||||
*/
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
private ${field.propertyType} ${field.propertyName};
|
private ${field.propertyType} ${field.propertyName};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import ${mapperAnnotationClass.name};
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import ${package.Parent}.model.bo.${entity}BO;
|
import ${package.Parent}.model.bo.${entity}BO;
|
||||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment} Mapper 接口
|
* $!{table.comment} Mapper 接口
|
||||||
@@ -19,6 +20,7 @@ import ${package.Parent}.model.query.${entity}PageQuery;
|
|||||||
@${mapperAnnotationClass.simpleName}
|
@${mapperAnnotationClass.simpleName}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
@Mapper
|
||||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,19 +40,16 @@
|
|||||||
<!-- ${table.comment}分页列表 -->
|
<!-- ${table.comment}分页列表 -->
|
||||||
<select id="listPaged${entity}s" resultType="${package.Parent}.model.bo.${entity}BO">
|
<select id="listPaged${entity}s" resultType="${package.Parent}.model.bo.${entity}BO">
|
||||||
SELECT
|
SELECT
|
||||||
${Base_Column_List}
|
<include refid="Base_Column_List"/>
|
||||||
FROM
|
FROM
|
||||||
${table.name}
|
${table.name}
|
||||||
<where>
|
<where>
|
||||||
deleted = 0
|
is_deleted = 0
|
||||||
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
|
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
|
||||||
AND (
|
AND (
|
||||||
name LIKE CONCAT('%',#{queryParams.keywords},'%')
|
name LIKE CONCAT('%',#{queryParams.keywords},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test='queryParams.status!=null'>
|
|
||||||
AND status = #{queryParams.status}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.startTime != null">
|
<if test="queryParams.startTime != null">
|
||||||
AND create_time >= #{queryParams.startTime}
|
AND create_time >= #{queryParams.startTime}
|
||||||
</if>
|
</if>
|
||||||
@@ -60,6 +57,7 @@
|
|||||||
AND create_time <= #{queryParams.endTime}
|
AND create_time <= #{queryParams.endTime}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package ${package.Parent}.model.query;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment}分页查询对象
|
* $!{table.comment}分页查询对象
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ package ${package.Parent}.model.vo;
|
|||||||
#foreach($pkg in ${table.importPackages})
|
#foreach($pkg in ${table.importPackages})
|
||||||
import ${pkg};
|
import ${pkg};
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
#elseif(${swagger})
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
#end
|
|
||||||
#if(${entityLombokModel})
|
#if(${entityLombokModel})
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -30,11 +25,7 @@ import lombok.Setter;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
@Schema( description = "$!{table.comment}分页视图对象")
|
||||||
@Schema(name = "${entity}", description = "$!{table.comment}")
|
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModel(value = "${entity}分页视图对象", description = "$!{table.comment}")
|
|
||||||
#end
|
|
||||||
#if(${superEntityClass})
|
#if(${superEntityClass})
|
||||||
public class ${entity}PageVO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
public class ${entity}PageVO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||||
#elseif(${activeRecord})
|
#elseif(${activeRecord})
|
||||||
@@ -55,15 +46,7 @@ public class ${entity}PageVO {
|
|||||||
#set($keyPropertyName=${field.propertyName})
|
#set($keyPropertyName=${field.propertyName})
|
||||||
#end
|
#end
|
||||||
#if("$!field.comment" != "")
|
#if("$!field.comment" != "")
|
||||||
#if(${springdoc})
|
|
||||||
@Schema(description = "${field.comment}")
|
@Schema(description = "${field.comment}")
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModelProperty("${field.comment}")
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* ${field.comment}
|
|
||||||
*/
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
private ${field.propertyType} ${field.propertyName};
|
private ${field.propertyType} ${field.propertyName};
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
|||||||
/**
|
/**
|
||||||
* 删除$!{table.comment}
|
* 删除$!{table.comment}
|
||||||
*
|
*
|
||||||
* @param idsStr $!{table.comment}ID,多个以英文逗号(,)分割
|
* @param ids $!{table.comment}ID,多个以英文逗号(,)分割
|
||||||
* @return
|
* @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 ${superServiceImplClassPackage};
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
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.form.${entity}Form;
|
||||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||||
import ${package.Parent}.model.bo.${entity}BO;
|
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.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment} 服务实现类
|
* $!{table.comment}服务实现类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
@@ -101,17 +100,17 @@ public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.m
|
|||||||
/**
|
/**
|
||||||
* 删除$!{table.comment}
|
* 删除$!{table.comment}
|
||||||
*
|
*
|
||||||
* @param idsStr $!{table.comment}ID,多个以英文逗号(,)分割
|
* @param ids $!{table.comment}ID,多个以英文逗号(,)分割
|
||||||
* @return true|false
|
* @return true|false
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean delete${entity}s(String idsStr) {
|
public boolean delete${entity}s(String ids) {
|
||||||
Assert.isTrue(StrUtil.isNotBlank(idsStr), "删除的$!{table.comment}数据为空");
|
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的$!{table.comment}数据为空");
|
||||||
// 逻辑删除
|
// 逻辑删除
|
||||||
List<Long> ids = Arrays.stream(idsStr.split(","))
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
return this.removeByIds(ids);
|
return this.removeByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
package ${package.Parent}.model.vo;
|
package ${package.Parent}.model.vo;
|
||||||
|
|
||||||
#foreach($pkg in ${table.importPackages})
|
import java.io.Serializable;
|
||||||
import ${pkg};
|
import java.time.LocalDateTime;
|
||||||
#end
|
|
||||||
#if(${springdoc})
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
#elseif(${swagger})
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
#end
|
|
||||||
#if(${entityLombokModel})
|
#if(${entityLombokModel})
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -30,11 +24,7 @@ import lombok.Setter;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if(${springdoc})
|
@Schema( description = "$!{table.comment}视图对象")
|
||||||
@Schema(name = "${entity}", description = "$!{table.comment}")
|
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModel(value = "${entity}视图对象", description = "$!{table.comment}")
|
|
||||||
#end
|
|
||||||
#if(${superEntityClass})
|
#if(${superEntityClass})
|
||||||
public class ${entity}VO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
public class ${entity}VO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||||
#elseif(${activeRecord})
|
#elseif(${activeRecord})
|
||||||
@@ -55,15 +45,7 @@ public class ${entity}VO {
|
|||||||
#set($keyPropertyName=${field.propertyName})
|
#set($keyPropertyName=${field.propertyName})
|
||||||
#end
|
#end
|
||||||
#if("$!field.comment" != "")
|
#if("$!field.comment" != "")
|
||||||
#if(${springdoc})
|
|
||||||
@Schema(description = "${field.comment}")
|
@Schema(description = "${field.comment}")
|
||||||
#elseif(${swagger})
|
|
||||||
@ApiModelProperty("${field.comment}")
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* ${field.comment}
|
|
||||||
*/
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
private ${field.propertyType} ${field.propertyName};
|
private ${field.propertyType} ${field.propertyName};
|
||||||
|
|||||||
Reference in New Issue
Block a user