List of usage examples for org.apache.ibatis.jdbc SQL SQL
SQL
From source file:com.sc.mapper.generator.UsersSqlProvider.java
public String selectByExample(UsersExample example) { SQL sql = new SQL(); if (example != null && example.isDistinct()) { sql.SELECT_DISTINCT("CM_USERID"); } else {/*from w w w . j av a 2 s. c om*/ sql.SELECT("CM_USERID"); } sql.SELECT("CM_SHOPNAME"); sql.SELECT("CM_PHONE"); sql.SELECT("CM_ACCOUNT"); sql.SELECT("CM_PASSWORD"); sql.SELECT("CM_INTEGRAL"); sql.SELECT("CM_BALANCE"); sql.SELECT("CM_CARDPATH"); sql.SELECT("CM_STOREPATH"); sql.SELECT("CM_LICENSEPATH"); sql.SELECT("CM_SHOPEADDRESS"); sql.SELECT("CM_SHOPLON"); sql.SELECT("CM_SHOPLAT"); sql.SELECT("CM_LEVEL"); sql.SELECT("CM_CREATETIME"); sql.SELECT("CM_ISEXAMINE"); sql.SELECT("CM_REASON"); sql.SELECT("CM_CARDNO"); sql.SELECT("CM_NAME"); sql.SELECT("CM_CONTACTNAME"); sql.SELECT("CM_CONTACTPHONE"); sql.SELECT("CM_TELEPHONE"); sql.SELECT("CM_PAX"); sql.FROM("TB_USERS"); applyWhere(sql, example, false); if (example != null && example.getOrderByClause() != null) { sql.ORDER_BY(example.getOrderByClause()); } return sql.toString(); }
From source file:com.sc.mapper.generator.UsersSqlProvider.java
public String updateByExampleSelective(Map<String, Object> parameter) { Users record = (Users) parameter.get("record"); UsersExample example = (UsersExample) parameter.get("example"); SQL sql = new SQL(); sql.UPDATE("TB_USERS"); if (record.getCM_USERID() != null) { sql.SET("CM_USERID = #{record.CM_USERID,jdbcType=VARCHAR}"); }// w w w. j a va 2 s .com if (record.getCM_SHOPNAME() != null) { sql.SET("CM_SHOPNAME = #{record.CM_SHOPNAME,jdbcType=VARCHAR}"); } if (record.getCM_PHONE() != null) { sql.SET("CM_PHONE = #{record.CM_PHONE,jdbcType=BIGINT}"); } if (record.getCM_ACCOUNT() != null) { sql.SET("CM_ACCOUNT = #{record.CM_ACCOUNT,jdbcType=VARCHAR}"); } if (record.getCM_PASSWORD() != null) { sql.SET("CM_PASSWORD = #{record.CM_PASSWORD,jdbcType=VARCHAR}"); } if (record.getCM_INTEGRAL() != null) { sql.SET("CM_INTEGRAL = #{record.CM_INTEGRAL,jdbcType=INTEGER}"); } if (record.getCM_BALANCE() != null) { sql.SET("CM_BALANCE = #{record.CM_BALANCE,jdbcType=DOUBLE}"); } if (record.getCM_CARDPATH() != null) { sql.SET("CM_CARDPATH = #{record.CM_CARDPATH,jdbcType=VARCHAR}"); } if (record.getCM_STOREPATH() != null) { sql.SET("CM_STOREPATH = #{record.CM_STOREPATH,jdbcType=VARCHAR}"); } if (record.getCM_LICENSEPATH() != null) { sql.SET("CM_LICENSEPATH = #{record.CM_LICENSEPATH,jdbcType=VARCHAR}"); } if (record.getCM_SHOPEADDRESS() != null) { sql.SET("CM_SHOPEADDRESS = #{record.CM_SHOPEADDRESS,jdbcType=VARCHAR}"); } if (record.getCM_SHOPLON() != null) { sql.SET("CM_SHOPLON = #{record.CM_SHOPLON,jdbcType=DOUBLE}"); } if (record.getCM_SHOPLAT() != null) { sql.SET("CM_SHOPLAT = #{record.CM_SHOPLAT,jdbcType=DOUBLE}"); } if (record.getCM_LEVEL() != null) { sql.SET("CM_LEVEL = #{record.CM_LEVEL,jdbcType=INTEGER}"); } if (record.getCM_CREATETIME() != null) { sql.SET("CM_CREATETIME = #{record.CM_CREATETIME,jdbcType=TIMESTAMP}"); } if (record.getCM_ISEXAMINE() != null) { sql.SET("CM_ISEXAMINE = #{record.CM_ISEXAMINE,jdbcType=INTEGER}"); } if (record.getCM_REASON() != null) { sql.SET("CM_REASON = #{record.CM_REASON,jdbcType=VARCHAR}"); } if (record.getCM_CARDNO() != null) { sql.SET("CM_CARDNO = #{record.CM_CARDNO,jdbcType=VARCHAR}"); } if (record.getCM_NAME() != null) { sql.SET("CM_NAME = #{record.CM_NAME,jdbcType=VARCHAR}"); } if (record.getCM_CONTACTNAME() != null) { sql.SET("CM_CONTACTNAME = #{record.CM_CONTACTNAME,jdbcType=VARCHAR}"); } if (record.getCM_CONTACTPHONE() != null) { sql.SET("CM_CONTACTPHONE = #{record.CM_CONTACTPHONE,jdbcType=VARCHAR}"); } if (record.getCM_TELEPHONE() != null) { sql.SET("CM_TELEPHONE = #{record.CM_TELEPHONE,jdbcType=VARCHAR}"); } if (record.getCM_PAX() != null) { sql.SET("CM_PAX = #{record.CM_PAX,jdbcType=VARCHAR}"); } applyWhere(sql, example, true); return sql.toString(); }
From source file:com.sc.mapper.generator.UsersSqlProvider.java
public String updateByExample(Map<String, Object> parameter) { SQL sql = new SQL(); sql.UPDATE("TB_USERS"); sql.SET("CM_USERID = #{record.CM_USERID,jdbcType=VARCHAR}"); sql.SET("CM_SHOPNAME = #{record.CM_SHOPNAME,jdbcType=VARCHAR}"); sql.SET("CM_PHONE = #{record.CM_PHONE,jdbcType=BIGINT}"); sql.SET("CM_ACCOUNT = #{record.CM_ACCOUNT,jdbcType=VARCHAR}"); sql.SET("CM_PASSWORD = #{record.CM_PASSWORD,jdbcType=VARCHAR}"); sql.SET("CM_INTEGRAL = #{record.CM_INTEGRAL,jdbcType=INTEGER}"); sql.SET("CM_BALANCE = #{record.CM_BALANCE,jdbcType=DOUBLE}"); sql.SET("CM_CARDPATH = #{record.CM_CARDPATH,jdbcType=VARCHAR}"); sql.SET("CM_STOREPATH = #{record.CM_STOREPATH,jdbcType=VARCHAR}"); sql.SET("CM_LICENSEPATH = #{record.CM_LICENSEPATH,jdbcType=VARCHAR}"); sql.SET("CM_SHOPEADDRESS = #{record.CM_SHOPEADDRESS,jdbcType=VARCHAR}"); sql.SET("CM_SHOPLON = #{record.CM_SHOPLON,jdbcType=DOUBLE}"); sql.SET("CM_SHOPLAT = #{record.CM_SHOPLAT,jdbcType=DOUBLE}"); sql.SET("CM_LEVEL = #{record.CM_LEVEL,jdbcType=INTEGER}"); sql.SET("CM_CREATETIME = #{record.CM_CREATETIME,jdbcType=TIMESTAMP}"); sql.SET("CM_ISEXAMINE = #{record.CM_ISEXAMINE,jdbcType=INTEGER}"); sql.SET("CM_REASON = #{record.CM_REASON,jdbcType=VARCHAR}"); sql.SET("CM_CARDNO = #{record.CM_CARDNO,jdbcType=VARCHAR}"); sql.SET("CM_NAME = #{record.CM_NAME,jdbcType=VARCHAR}"); sql.SET("CM_CONTACTNAME = #{record.CM_CONTACTNAME,jdbcType=VARCHAR}"); sql.SET("CM_CONTACTPHONE = #{record.CM_CONTACTPHONE,jdbcType=VARCHAR}"); sql.SET("CM_TELEPHONE = #{record.CM_TELEPHONE,jdbcType=VARCHAR}"); sql.SET("CM_PAX = #{record.CM_PAX,jdbcType=VARCHAR}"); UsersExample example = (UsersExample) parameter.get("example"); applyWhere(sql, example, true);//w w w. j a v a 2s. c o m return sql.toString(); }
From source file:com.sc.mapper.manage.ManageSqlProvider.java
public String getSellerDetail(String sellerid) { SQL sql = new SQL(); sql.SELECT("c.CM_CREATETIME,\n" + " c.CM_PHONE,\n" + " c.CM_NAME,\n" + " c.CM_CONTACTNAME,\n" + " c.CM_CONTACTPHONE,\n" + " c.CM_PAX,\n" + " c.CM_STOREPATH,\n" + " c.CM_CARDNO,\n" + " c.CM_CARDPATH,\n" + " c.CM_ISEXAMINE,\n" + " c.CM_LICENSEPATH,\n" + " c.CM_REASON,\n" + " c.CM_SELLERID,\n" + " c.CM_ADDRESS,\n" + " c.CM_SELLERNAME,\n" + " c.CM_LAT,\n" + " c.CM_LON,\n" + " g.CM_BRAND"); sql.FROM("TB_SELLERS c"); sql.LEFT_OUTER_JOIN("TB_BRANDS g ON c.CM_BRANDID = g.CM_BRANDID"); sql.WHERE("c.CM_SELLERID =" + sellerid); return sql.toString(); }
From source file:com.zzy.mybatis.mapper.MapperProvider.java
License:Open Source License
/** * ?//from w w w .j a va 2 s .c o m * * @param ms */ public void selectByPrimaryKey(MappedStatement ms) { final Class<?> entityClass = getSelectReturnType(ms); //? List<ParameterMapping> parameterMappings = getPrimaryKeyParameterMappings(ms); //sql String sql = new SQL() { { //select SELECT(EntityHelper.getSelectColumns(entityClass)); //from FROM(tableName(entityClass)); //where?=#{property} WHERE(EntityHelper.getPrimaryKeyWhere(entityClass)); } }.toString(); //??SqlSource StaticSqlSource sqlSource = new StaticSqlSource(ms.getConfiguration(), sql, parameterMappings); //?SqlSource setSqlSource(ms, sqlSource); // setResultType(ms, entityClass); }
From source file:com.zzy.mybatis.mapper.MapperProvider.java
License:Open Source License
/** * /* ww w.j a va 2 s .com*/ * * @param ms */ public void deleteByPrimaryKey(MappedStatement ms) { final Class<?> entityClass = getSelectReturnType(ms); List<ParameterMapping> parameterMappings = getPrimaryKeyParameterMappings(ms); //sql String sql = new SQL() { { //delete from table DELETE_FROM(tableName(entityClass)); //where =#{property} ? WHERE(EntityHelper.getPrimaryKeyWhere(entityClass)); } }.toString(); //??SqlSource StaticSqlSource sqlSource = new StaticSqlSource(ms.getConfiguration(), sql, parameterMappings); //?SqlSource setSqlSource(ms, sqlSource); }
From source file:com.zzy.mybatis.mapper.MapperProvider.java
License:Open Source License
/** * // www. j a v a2s. co m * * @param ms */ public void updateByPrimaryKey(MappedStatement ms) { final Class<?> entityClass = getSelectReturnType(ms); //??set=?where=? //?set List<ParameterMapping> parameterMappings = getColumnParameterMappings(ms); //?where parameterMappings.addAll(getPrimaryKeyParameterMappings(ms)); //sql String sql = new SQL() { { //update table UPDATE(tableName(entityClass)); //? List<EntityHelper.EntityColumn> columnList = EntityHelper.getColumns(entityClass); //set column = ? for (EntityHelper.EntityColumn column : columnList) { SET(column.getColumn() + " = ?"); } //where =#{property} ? WHERE(EntityHelper.getPrimaryKeyWhere(entityClass)); } }.toString(); //??SqlSource StaticSqlSource sqlSource = new StaticSqlSource(ms.getConfiguration(), sql, parameterMappings); //?SqlSource setSqlSource(ms, sqlSource); }
From source file:intec.sli.iwstudy.teamcalendar.infrastructure.mybatis.EventSqlProvider.java
License:Open Source License
/** * ?? Event ???SQL???//www .j a v a 2 s. c om * * @return Event ?SQL */ public String countAllEvent() { return new SQL().SELECT("count(*)").FROM("events").toString(); }
From source file:intec.sli.iwstudy.teamcalendar.infrastructure.mybatis.EventSqlProvider.java
License:Open Source License
/** * Event ?SQL???//from w w w . j a v a 2s . co m * * @param event Event * @return Event SQL */ public String updateEvent(final Event event) { return new SQL() { { UPDATE("events"); if (event.getFrom() != null) { SET("start_date = #{from}"); } if (event.getTo() != null) { SET("end_date = #{to}"); } if (event.getText() != null) { SET("event_name = #{text}"); } WHERE("event_id = #{id}"); } }.toString(); }
From source file:message.mybatis.common.provider.MapperProvider.java
License:Open Source License
/** * ???//w w w.j av a 2 s . com * * @param ms */ public void delete(MappedStatement ms) { final Class<?> entityClass = getSelectReturnType(ms); List<ParameterMapping> parameterMappings = getPrimaryKeyParameterMappings(ms); //sql String sql = new SQL() { { //delete from table DELETE_FROM(tableName(entityClass)); //where =#{property} ? WHERE(EntityHelper.getPrimaryKeyWhere(entityClass)); } }.toString(); //??SqlSource StaticSqlSource sqlSource = new StaticSqlSource(ms.getConfiguration(), sql, parameterMappings); //?SqlSource setSqlSource(ms, sqlSource); }