
META-INF.dao_entity.ftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of generator-maven-plugin Show documentation
Show all versions of generator-maven-plugin Show documentation
The mvc-generator makes it easier to write code with spring-mvc
applications. mvc-generator generate code with freemarker template of controller, service and dao etc level object using maven plugin.
Simplicity is the biggest advantage of the generator code over generating code
tools.
package ${entity.javaPackage};
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ${entity.commonPackage}.dao.sqlhandler.DeleteSqlFilter;
import ${entity.commonPackage}.dao.sqlhandler.InsertSqlFilter;
import ${entity.commonPackage}.dao.sqlhandler.UpdateSqlFilter;
import ${entity.commonPackage}.domain.${entity.base?cap_first};
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
/**
* This code is generated by bianwentao
* @author bianwentao
*
*/
@Component
@DataSource("dataSource")
public interface ${entity.base?cap_first}Dao {
String table = " ${entity.base} ";
@Insert("insert into"+table+"${'#'}values:{<#list entity.properties as property><#if property.propertyName !="id">${property.propertyName}#if><#if property.propertyName !="id" && property_has_next>, #if>#list>}")
@Options(useGeneratedKeys = true)
@Lang(InsertSqlFilter.class)
int insert(${entity.base?cap_first} ${entity.base});
@Update("update"+table+"${'#'}set:{<#list entity.properties as property><#if property.propertyName !="id">${property.propertyName}#if><#if property.propertyName !="id" && property_has_next>,#if>#list>}")
@Lang(UpdateSqlFilter.class)
int update(${entity.base?cap_first} ${entity.base});
@Select("")
List<${entity.base?cap_first}> selectAll();
@Select("select * from"+table+" where id=${'#'}{id}")
${entity.base?cap_first} selectById(int id);
@Delete("delete from"+table+"where id = ${'#'}{id}")
@Lang(DeleteSqlFilter.class)
void delete(@Param("id")int id);
@Delete("delete from "+ table + " where id ${'#'}in:{ids}")
@Lang(DeleteSqlFilter.class)
void deleteBatch(@Param("ids")List ids);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy