PDManer模板编辑

模板代码

  • 模板代码(dot.js语法)
    • 基础模板
      • 实体类
      • Mapper

模板代码(dot.js语法)

基础模板

实体类



import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

 /**
 * @author : Y.P
 * @date : 2023-11-28
 */
@Data
@Table(name = "FCA_APPLICATION_SCORE")
public class FcaApplicationScore {
    // F主键
    @Column(name ="ID")
    @Id
    private String id ;
    // 流水号
    @Column(name ="APP_NO")
    private String appNo ;
}
{{  var today=new Date();
    var fullYear=today.getFullYear();
    var month=today.getMonth() + 1;
    var days=today.getDate();
    
    var pkVarName = "undefinedId";
    var pkDataType = "String";
    it.entity.fields.forEach(function(field){
        if(field.primaryKey){
            pkVarName = it.func.camel(field.defKey,false);
            pkDataType = field["type"];
            return;
        }
    });
    
    var pkgName = it.entity.env.base.nameSpace;
    var beanClass = it.entity.env.base.codeRoot;
    var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);
    var serviceClass = beanClass+'Service';
    var serviceVarName= beanVarName+'Service';
    
}}
$blankline
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
$blankline

 /**
 * @author : Y.P
 * @date : {{=fullYear}}-{{=month}}-{{=days}}
 */
@Data
@Table(name = "{{=it.entity.defKey}}")
public class {{=beanClass}} {
{{~it.entity.fields:field:index}}
    // {{=field.defName}}
    @Column(name ="{{=field.defKey}}")
    {{? field.primaryKey }}
    @Id
    {{?}}
    private {{? field.type === 'varchar' }}String{{??}}{{=field.type}}{{?}} {{=it.func.camel(field.defKey,false)}} ;

{{~}}
$blankline

}

Mapper


import com.baomidou.mybatisplus.core.mapper.BaseMapper;

 /**
 * FCA_APPLICATION_SCORE    
 * @author : Y.P
 * @date : 2023-12-4
 */
@Mapper
public interface FcaApplicationScoreMapper extends BaseMapper<FcaApplicationScore> {
}
{{  var today=new Date();
    var fullYear=today.getFullYear();
    var month=today.getMonth() + 1;
    var days=today.getDate();
    
    var pkVarName = "undefinedId";
    var pkDataType = "String";
    it.entity.fields.forEach(function(field){
        if(field.primaryKey){
            pkVarName = it.func.camel(field.defKey,false);
            pkDataType = field["type"];
            return;
        }
    });
    
    var pkgName = it.entity.env.base.nameSpace;
    var beanClass = it.entity.env.base.codeRoot;
    var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);
    var serviceClass = beanClass+'Service';
    var serviceVarName= beanVarName+'Service';
    
}}
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
$blankline

 /**
 * {{=it.entity.defKey}}    {{=it.entity.defName}}
 * @author : Y.P
 * @date : {{=fullYear}}-{{=month}}-{{=days}}
 */
@Mapper
public interface {{=beanClass}}Mapper extends BaseMapper<{{=beanClass}}> {
  
}

你可能感兴趣的:(小案例,数据库,java)