com.jeesuite.mybatis.crud.SqlTemplate Maven / Gradle / Ivy
/**
*
*/
package com.jeesuite.mybatis.crud;
/**
* @description
* @author vakin
* @date 2016年10月25日
*/
public class SqlTemplate {
public static final String IF_TAG_TEAMPLATE = "%s, ";
public static final String SCRIPT_TEMAPLATE = "";
public static final String TRIM_PREFIX = "\n";
public static final String TRIM_SUFFIX = " ";
public static final String INSERT = "INSERT INTO %s \n %s \n VALUES \n %s";
public static final String UPDATE_BY_KEY = "UPDATE %s %s \n WHERE %s = #{%s}";
public static final String BATCH_INSERT = "INSERT INTO %s \n %s \n VALUES \n %s ";
public static final String SELECT_BY_KEYS = "SELECT * FROM %s WHERE %s IN #{id} ";
public static String wrapIfTag(String fieldName,String expr,boolean skip){
if(skip)return expr;
return String.format(IF_TAG_TEAMPLATE, fieldName,expr);
}
}