/** * 获取查询sql <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String countSql(Object obj) { // 构建query语句 SqlBuilder.BEGIN(); SqlBuilder.SELECT("COUNT(1)"); SqlBuilder.FROM(this.tableName); if (!ObjectUtils.isEmpty(obj)) { MetaObject metaObject = MetaObjectUtils.forObject(obj); for (Entry<String, String> entryTemp : queryConditionKey2SqlMapping.entrySet()) { String queryKeyName = entryTemp.getKey(); Object valueObj = metaObject.getValue(queryKeyName); if (ObjectUtils.isEmpty(valueObj)) { continue; } SqlBuilder.WHERE(entryTemp.getValue()); } } for (String conditionExpressionTemp : otherCondition) { SqlBuilder.WHERE(conditionExpressionTemp); } String querySql = SqlBuilder.SQL(); SqlBuilder.RESET(); return querySql; }
/** * 获取查询sql <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String updateSql(Object obj) { AssertUtils.notEmpty(obj, "update obj must not empty."); // 获取当前对象中有哪些属性 MetaObject metaObject = MetaObjectUtils.forObject(obj); Set<String> keySet = new HashSet<String>(); for (String getterName : metaObject.getGetterNames()) { keySet.add(getterName); } AssertUtils.isTrue( keySet.contains(this.pkName), "obj:{} must contains pk{}.", new Object[] {obj, this.pkName}); // 构建query语句 SqlBuilder.BEGIN(); SqlBuilder.UPDATE(this.tableName); for (String propertyName : updateAblePropertyNames) { if (!keySet.contains(propertyName)) { continue; } // Object value = metaObject.getValue(propertyName); String columnName = getter2columnNameMapping.get(propertyName); SqlBuilder.SET(columnName + " = ?"); } SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? "); String updateSql = SqlBuilder.SQL(); SqlBuilder.RESET(); return updateSql; }
public String updateByExampleSelective(Map<String, Object> parameter) { News record = (News) parameter.get("record"); NewsExample example = (NewsExample) parameter.get("example"); BEGIN(); UPDATE("news"); if (record.getId() != null) { SET("id = #{record.id,jdbcType=BIGINT}"); } if (record.getHost() != null) { SET("host = #{record.host,jdbcType=VARCHAR}"); } if (record.getTitle() != null) { SET("title = #{record.title,jdbcType=VARCHAR}"); } if (record.getUrl() != null) { SET("url = #{record.url,jdbcType=VARCHAR}"); } applyWhere(example, true); return SQL(); }
public String countByExample(StudentLogAssignExample example) { BEGIN(); SELECT("count(*)"); FROM("student_log_assign"); applyWhere(example, false); return SQL(); }
public String countByExample(NewsExample example) { BEGIN(); SELECT("count (*)"); FROM("news"); applyWhere(example, false); return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String countByExample(VoltageRankClassifyExample example) { BEGIN(); SELECT("count(*)"); FROM("voltage_rank_classify"); applyWhere(example, false); return SQL(); }
public String selectByExample(StudentLogAssignExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("assign_id"); } else { SELECT("assign_id"); } SELECT("student_id"); SELECT("depart_code"); SELECT("depart_name"); SELECT("job_code"); SELECT("job_name"); SELECT("job_days"); SELECT("job_deadline"); SELECT("assigned_to"); SELECT("create_time"); SELECT("create_user"); FROM("student_log_assign"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String updateByExample(Map<String, Object> parameter) { BEGIN(); UPDATE("voltage_rank_classify"); SET("id = #{record.id,jdbcType=INTEGER}"); SET("name = #{record.name,jdbcType=VARCHAR}"); SET("value = #{record.value,jdbcType=INTEGER}"); SET("bigEquipment = #{record.bigequipment,jdbcType=INTEGER}"); VoltageRankClassifyExample example = (VoltageRankClassifyExample) parameter.get("example"); applyWhere(example, true); return SQL(); }
public String updateByExampleSelective(Map<String, Object> parameter) { StudentLogAssign record = (StudentLogAssign) parameter.get("record"); StudentLogAssignExample example = (StudentLogAssignExample) parameter.get("example"); BEGIN(); UPDATE("student_log_assign"); if (record.getAssignId() != null) { SET("assign_id = #{record.assignId,jdbcType=BIGINT}"); } if (record.getStudentId() != null) { SET("student_id = #{record.studentId,jdbcType=BIGINT}"); } if (record.getDepartCode() != null) { SET("depart_code = #{record.departCode,jdbcType=CHAR}"); } if (record.getDepartName() != null) { SET("depart_name = #{record.departName,jdbcType=VARCHAR}"); } if (record.getJobCode() != null) { SET("job_code = #{record.jobCode,jdbcType=CHAR}"); } if (record.getJobName() != null) { SET("job_name = #{record.jobName,jdbcType=VARCHAR}"); } if (record.getJobDays() != null) { SET("job_days = #{record.jobDays,jdbcType=INTEGER}"); } if (record.getJobDeadline() != null) { SET("job_deadline = #{record.jobDeadline,jdbcType=DATE}"); } if (record.getAssignedTo() != null) { SET("assigned_to = #{record.assignedTo,jdbcType=VARCHAR}"); } if (record.getCreateTime() != null) { SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } if (record.getCreateUser() != null) { SET("create_user = #{record.createUser,jdbcType=VARCHAR}"); } applyWhere(example, true); return SQL(); }
public String updateByExample(Map<String, Object> parameter) { BEGIN(); UPDATE("news"); SET("id = #{record.id,jdbcType=BIGINT}"); SET("host = #{record.host,jdbcType=VARCHAR}"); SET("title = #{record.title,jdbcType=VARCHAR}"); SET("url = #{record.url,jdbcType=VARCHAR}"); NewsExample example = (NewsExample) parameter.get("example"); applyWhere(example, true); return SQL(); }
public String insertSelective(StudentLogAssign record) { BEGIN(); INSERT_INTO("student_log_assign"); if (record.getAssignId() != null) { VALUES("assign_id", "#{assignId,jdbcType=BIGINT}"); } if (record.getStudentId() != null) { VALUES("student_id", "#{studentId,jdbcType=BIGINT}"); } if (record.getDepartCode() != null) { VALUES("depart_code", "#{departCode,jdbcType=CHAR}"); } if (record.getDepartName() != null) { VALUES("depart_name", "#{departName,jdbcType=VARCHAR}"); } if (record.getJobCode() != null) { VALUES("job_code", "#{jobCode,jdbcType=CHAR}"); } if (record.getJobName() != null) { VALUES("job_name", "#{jobName,jdbcType=VARCHAR}"); } if (record.getJobDays() != null) { VALUES("job_days", "#{jobDays,jdbcType=INTEGER}"); } if (record.getJobDeadline() != null) { VALUES("job_deadline", "#{jobDeadline,jdbcType=DATE}"); } if (record.getAssignedTo() != null) { VALUES("assigned_to", "#{assignedTo,jdbcType=VARCHAR}"); } if (record.getCreateTime() != null) { VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } if (record.getCreateUser() != null) { VALUES("create_user", "#{createUser,jdbcType=VARCHAR}"); } return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String updateByPrimaryKeySelective(VoltageRankClassify record) { BEGIN(); UPDATE("voltage_rank_classify"); if (record.getName() != null) { SET("name = #{name,jdbcType=VARCHAR}"); } if (record.getValue() != null) { SET("value = #{value,jdbcType=INTEGER}"); } if (record.getBigequipment() != null) { SET("bigEquipment = #{bigequipment,jdbcType=INTEGER}"); } WHERE("id = #{id,jdbcType=INTEGER}"); return SQL(); }
/** * 获取删除语句<br> * <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String deleteSql() { AssertUtils.notEmpty(this.pkName, "pkName is empty."); AssertUtils.isTrue( this.getter2columnNameMapping.containsKey(this.pkName), "property2columnNameMapping not contains pkName:{}.", this.pkName); // 开始构建sql SqlBuilder.BEGIN(); SqlBuilder.DELETE_FROM(this.tableName); SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? "); String deleteSql = SqlBuilder.SQL(); SqlBuilder.RESET(); return deleteSql; }
/** * 获取插入语句 <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String insertSql() { // 开始构建sql SqlBuilder.BEGIN(); SqlBuilder.INSERT_INTO(this.tableName); for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) { SqlBuilder.VALUES(entryTemp.getValue(), "?"); } for (Entry<String, String> entryTemp : otherColumn2expressionMapping.entrySet()) { SqlBuilder.VALUES(entryTemp.getKey(), entryTemp.getValue()); } String insertSql = SqlBuilder.SQL(); SqlBuilder.RESET(); return insertSql; }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * STAR * * @mbggenerated */ public String updateByPrimaryKeySelective(Star record) { BEGIN(); UPDATE("STAR"); if (record.getFirstname() != null) { SET("FIRSTNAME = #{firstname,jdbcType=VARCHAR}"); } if (record.getLastname() != null) { SET("LASTNAME = #{lastname,jdbcType=VARCHAR}"); } WHERE("ID = #{id,jdbcType=INTEGER}"); return SQL(); }
/** * 获取查询单条数据的sql <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String findSql() { AssertUtils.notEmpty(this.pkName, "pkName is empty."); AssertUtils.isTrue( this.getter2columnNameMapping.containsKey(this.pkName), "property2columnNameMapping not contains pkName:{}.", this.pkName); SqlBuilder.BEGIN(); for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) { SqlBuilder.SELECT(entryTemp.getValue()); } SqlBuilder.FROM(this.tableName); SqlBuilder.WHERE(this.getter2columnNameMapping.get(this.pkName) + " = ? "); String findSql = SqlBuilder.SQL(); SqlBuilder.RESET(); return findSql; }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String insertSelective(VoltageRankClassify record) { BEGIN(); INSERT_INTO("voltage_rank_classify"); if (record.getId() != null) { VALUES("id", "#{id,jdbcType=INTEGER}"); } if (record.getName() != null) { VALUES("name", "#{name,jdbcType=VARCHAR}"); } if (record.getValue() != null) { VALUES("value", "#{value,jdbcType=INTEGER}"); } if (record.getBigequipment() != null) { VALUES("bigEquipment", "#{bigequipment,jdbcType=INTEGER}"); } return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String selectByExample(VoltageRankClassifyExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("id"); } else { SELECT("id"); } SELECT("name"); SELECT("value"); SELECT("bigEquipment"); FROM("voltage_rank_classify"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * STAR * * @mbggenerated */ public String insertSelective(Star record) { BEGIN(); INSERT_INTO("STAR"); if (record.getId() != null) { VALUES("ID", "#{id,jdbcType=INTEGER}"); } if (record.getFirstname() != null) { VALUES("FIRSTNAME", "#{firstname,jdbcType=VARCHAR}"); } if (record.getLastname() != null) { VALUES("LASTNAME", "#{lastname,jdbcType=VARCHAR}"); } return SQL(); }
/** * 获取查询sql <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String querySql(Object obj) { AssertUtils.notEmpty(this.pkName, "pkName is empty."); AssertUtils.isTrue( this.getter2columnNameMapping.containsKey(this.pkName), "property2columnNameMapping not contains pkName:{}.", this.pkName); // 构建query语句 SqlBuilder.BEGIN(); for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) { SqlBuilder.SELECT(entryTemp.getValue()); } SqlBuilder.FROM(this.tableName); if (!ObjectUtils.isEmpty(obj)) { MetaObject metaObject = MetaObjectUtils.forObject(obj); for (Entry<String, String> entryTemp : queryConditionKey2SqlMapping.entrySet()) { String queryKeyName = entryTemp.getKey(); Object valueObj = metaObject.getValue(queryKeyName); if (ObjectUtils.isEmpty(valueObj)) { continue; } SqlBuilder.WHERE(entryTemp.getValue()); } } for (String conditionExpressionTemp : otherCondition) { SqlBuilder.WHERE(conditionExpressionTemp); } // 在不存在排序字段时默认使用主键对应字段作为排序字段<br/> if (CollectionUtils.isEmpty(orderList)) { SqlBuilder.ORDER_BY(this.getter2columnNameMapping.get(this.pkName)); } else { for (String order : orderList) { SqlBuilder.ORDER_BY(order); } } String querySql = SqlBuilder.SQL(); SqlBuilder.RESET(); return querySql; }
public String selectByExample(NewsExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("id"); } else { SELECT("id"); } SELECT("host"); SELECT("title"); SELECT("url"); FROM("news"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String updateByExampleSelective(Map<String, Object> parameter) { VoltageRankClassify record = (VoltageRankClassify) parameter.get("record"); VoltageRankClassifyExample example = (VoltageRankClassifyExample) parameter.get("example"); BEGIN(); UPDATE("voltage_rank_classify"); if (record.getId() != null) { SET("id = #{record.id,jdbcType=INTEGER}"); } if (record.getName() != null) { SET("name = #{record.name,jdbcType=VARCHAR}"); } if (record.getValue() != null) { SET("value = #{record.value,jdbcType=INTEGER}"); } if (record.getBigequipment() != null) { SET("bigEquipment = #{record.bigequipment,jdbcType=INTEGER}"); } applyWhere(example, true); return SQL(); }
public String updateByPrimaryKeySelective(News record) { BEGIN(); UPDATE("news"); if (record.getHost() != null) { SET("host = #{host,jdbcType=VARCHAR}"); } if (record.getTitle() != null) { SET("title = #{title,jdbcType=VARCHAR}"); } if (record.getUrl() != null) { SET("url = #{url,jdbcType=VARCHAR}"); } WHERE("id = #{id,jdbcType=BIGINT}"); return SQL(); }
public String insertSelective(News record) { BEGIN(); INSERT_INTO("news"); if (record.getId() != null) { VALUES("id", "#{id,jdbcType=BIGINT}"); } if (record.getHost() != null) { VALUES("host", "#{host,jdbcType=VARCHAR}"); } if (record.getTitle() != null) { VALUES("title", "#{title,jdbcType=VARCHAR}"); } if (record.getUrl() != null) { VALUES("url", "#{url,jdbcType=VARCHAR}"); } return SQL(); }
public String deleteByExample(StudentLogAssignExample example) { BEGIN(); DELETE_FROM("student_log_assign"); applyWhere(example, false); return SQL(); }
public String deleteByExample(NewsExample example) { BEGIN(); DELETE_FROM("news"); applyWhere(example, false); return SQL(); }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String deleteByExample(VoltageRankClassifyExample example) { BEGIN(); DELETE_FROM("voltage_rank_classify"); applyWhere(example, false); return SQL(); }