templates.sm.criteria.tpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easyee-auto Show documentation
Show all versions of easyee-auto Show documentation
Code Auto Generator for EasyEE Open Source JavaEE Enterprise Basic Development Platform(https://github.com/ushelp/EasyEE).
The newest version!
package ${pkgName}.criteria;
import ${easyCriteriaImport};
import ${stringUtilsImport};
<#if Imports??>
<#list Imports as item>
import ${item};
#list>
#if>
/**
* ${ClassName} Criteria, generated by EasyAuto
* @author easyproject.cn
* @version 1.0
*
*/
public class ${ClassName}Criteria extends EasyCriteria implements java.io.Serializable {
// Fields
private static final long serialVersionUID = 1L;
/*
* 1. Criteria property
*/
<#if Propertys??>
<#list Propertys as item>
<#assign info=item?split("#")>
private ${info[0]} ${info[1]};
#list>
#if>
/*
* 2. Constructor
*/
public ${ClassName}Criteria() {
super();
}
/*
* 3. 条件生成抽象方法实现
*/
@Override
public String getCondition() {
values.clear(); //清除条件数据
StringBuffer condition = new StringBuffer();
// Your conditions
/*
if (StringUtils.isNotNullAndEmpty(this.getName())) {
condition.append(" and name like ${r"#{"}name}");
values.put("name", "%" + this.getName() + "%");
}
*/
<#if Propertys??>
<#list Propertys as item>
<#assign info=item?split("#")>
<#if info[3]=="like">
if(StringUtils.isNotNullAndEmpty(this.get${info[1]?cap_first}())){
condition.append(" and ${info[2]} like ${r"#{"}${info[1]}}");
values.put("${info[1]}", "%"+this.get${info[1]?cap_first}()+"%");
}
<#else>
if(StringUtils.isNotNullAndEmpty(this.get${info[1]?cap_first}())){
condition.append(" and ${info[2]}=${r"#{"}${info[1]}}");
values.put("${info[1]}", this.get${info[1]?cap_first}());
}
#if>
#list>
#if>
return condition.toString();
}
/*
* 4. Setters & Getters...
*/
<#if Propertys??>
<#list Propertys as item>
<#assign info=item?split("#")>
public ${info[0]} get${info[1]?cap_first}() {
return ${info[1]};
}
public void set${info[1]?cap_first}(${info[0]} ${info[1]}) {
this.${info[1]} = ${info[1]};
}
#list>
#if>
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy