update: 代码生成器

V0.5.x
jay 2023-07-04 13:28:32 +08:00
parent c3792a4bfe
commit 2d39ba1d04
5 changed files with 36 additions and 6 deletions

View File

@ -45,6 +45,7 @@ public class ${ClassName}Bo extends BaseDto {
@NotNull(message = "$column.columnComment不能为空", groups = { $Group })
#end
#end
@ApiModelProperty(value = "$column.columnComment", required = ${column.required})
private $column.javaType $column.javaField;
#end

View File

@ -1,6 +1,6 @@
package ${packageName}.data;
import cc.iotkit.data.ICommonData;
import ${packageName}.repository.${ClassName}Repository;
import ${packageName}.data.I${ClassName}Data;
import ${packageName}.data.model.Tb${ClassName};
import ${packageName}.model.${ClassName};
@ -20,6 +20,7 @@ import cc.iotkit.common.api.Paging;
import cc.iotkit.common.utils.StringUtils;
import java.util.Collection;
import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.data.util.PageBuilder;
import static ${packageName}.data.model.QTb${ClassName}.tb${ClassName};
@ -59,10 +60,10 @@ public class ${ClassName}DataImpl implements I${ClassName}Data {
#else
#set($condition='bo.get'+$AttrName+'() != null')
#end
builder.and($condition, ()=>tb${ClassName}.${javaField}.eq(bo.get${AttrName}()));
builder.and($condition, ()->tb${ClassName}.${javaField}.eq(bo.get${AttrName}()));
#else
builder.and(params.get("begin$AttrName") != null && params.get("end$AttrName") != null,
()=>tb${ClassName}.${javaField}.bettwen(params.get("begin$AttrName"), params.get("end$AttrName")));
()->tb${ClassName}.${javaField}.bettwen(params.get("begin$AttrName"), params.get("end$AttrName")));
#end
#end
#end
@ -102,4 +103,30 @@ public class ${ClassName}DataImpl implements I${ClassName}Data {
${ClassName} convert = MapstructUtils.convert(ret, ${ClassName}.class);
return convert;
}
@Override
public long count() {
return baseRepository.count();
}
@Override
public List<IotContributor> findAll() {
return MapstructUtils.convert(baseRepository.findAll(), IotContributor.class);
}
@Override
public List<IotContributor> findAllByCondition(IotContributor data) {
Iterable<TbIotContributor> all = baseRepository.findAll(buildQueryCondition(data));
return MapstructUtils.convert(Lists.newArrayList(all), IotContributor.class);
}
@Override
public IotContributor findOneByCondition(IotContributor data) {
Optional<TbIotContributor> one = baseRepository.findOne(buildQueryCondition(data));
if(one.isPresent()){
return MapstructUtils.convert(one.get(), IotContributor.class);
}
return null;
}
}

View File

@ -1,6 +1,6 @@
package ${packageName}.data.dao;
import cc.iotkit.data.model.Tb${ClassName};
import ${packageName}.data.model.Tb${ClassName};
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

View File

@ -1,5 +1,6 @@
package ${packageName}.data.model;
import ${packageName}.model.IotContributor;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -23,7 +24,8 @@ import lombok.EqualsAndHashCode;
#foreach ($import in $importList)
import ${import};
#end
import javax.persistence.Table;
import javax.persistence.Entity;
/**
* ${functionName}对象 ${tableName}

View File

@ -11,7 +11,6 @@ import cc.iotkit.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
@ -51,6 +50,7 @@ public class ${ClassName}Vo implements Serializable {
#else
@ExcelProperty(value = "${comment}")
#end
@ApiModelProperty(value = "${comment}")
private $column.javaType $column.javaField;
#end