优化代码生成模板
parent
5bfbe78913
commit
b3519d6782
|
|
@ -6,6 +6,8 @@ import ${import};
|
|||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
#elseif($table.tree)
|
||||
|
|
@ -23,6 +25,8 @@ import com.ruoyi.common.core.web.domain.TreeEntity;
|
|||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
@Data
|
||||
@Table("${tableName}")
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -62,15 +66,7 @@ public class ${ClassName} extends ${Entity}
|
|||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
|
|
@ -86,20 +82,5 @@ public class ${ClassName} extends ${Entity}
|
|||
}
|
||||
|
||||
#end
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
.append("${column.javaField}", get${AttrName}())
|
||||
#end
|
||||
#if($table.sub)
|
||||
.append("${subclassName}List", get${subClassName}List())
|
||||
#end
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ package ${packageName}.service;
|
|||
|
||||
import java.util.List;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
/**
|
||||
* ${functionName}Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
public interface I${ClassName}Service extends IService<${ClassName}>
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.ruoyi.common.core.utils.DateUtils;
|
|||
#end
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
#if($table.sub)
|
||||
import java.util.ArrayList;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
|
|
@ -26,7 +27,7 @@ import ${packageName}.service.I${ClassName}Service;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
|
|
|||
Loading…
Reference in New Issue