Commit e9a295e2 authored by yanzg's avatar yanzg

压缩视频

parent fa7bc6d3
......@@ -98,7 +98,7 @@ public class DaoConst {
/**
* 加载SQL语句模板
*/
public static final String SQL_LOAD = "SELECT a.*{FIELD} FROM {TABLE} AS a {INNER} WHERE 1=1 {WHERE}";
public static final String SQL_LOAD = "{SELECT_OUTER_BEGIN}SELECT {FIELD} FROM {TABLE} AS a {INNER} WHERE 1=1 {WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}{SELECT_OUTER_END}";
/**
* 表名代码片段
*/
......@@ -107,6 +107,14 @@ public class DaoConst {
* 字段代码片段
*/
public static final String CODE_FIELD = "{FIELD}";
/**
* SQL加载
*/
public static final String CODE_FIELD_DEFAULT = "a.*";
/**
* SQL加载
*/
public static final String CODE_FIELD_DEFAULT_NAME = "CODE_FIELD_DEFAULT_NAME";
/**
* 值代码片段
*/
......
......@@ -2,9 +2,9 @@ package com.yanzuoguang.dao.impl;
import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.dao.TableAnnotation;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.base.MethodField;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.StringHelper;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -520,6 +520,7 @@ public class TableStruct {
// 生成添加的SQL语句
String text = DaoConst.SQL_LOAD.replace(DaoConst.CODE_TABLE, this.name);
SqlData sql = new SqlData(DaoConst.LOAD, text);
sql.addParaConst(DaoConst.CODE_FIELD_DEFAULT_NAME, DaoConst.CODE_FIELD, DaoConst.CODE_FIELD_DEFAULT);
sql.setSqlType(DaoConst.SQL_TYPE_LOAD);
// 生成加载语句的WHERE条件
addWhereField(sql, DaoConst.CODE_TAG, false);
......@@ -649,6 +650,7 @@ public class TableStruct {
*/
private void addSaveWithSql(TableSqlCache tableStruct, String sqlName, List<TableFieldVo> whereFields) {
SqlData sqlData = this.releaseSql(DaoConst.SQL_TYPE_SAVE_WITH, sqlName, DaoConst.SQL_LOAD, StringHelper.EMPTY, new ArrayList<>(), whereFields);
sqlData.addParaConst(DaoConst.CODE_FIELD_DEFAULT_NAME, DaoConst.CODE_FIELD, DaoConst.CODE_FIELD_DEFAULT);
tableStruct.add(sqlData);
}
......@@ -671,8 +673,11 @@ public class TableStruct {
* @param updateFields 需要增加的值的字段
*/
private void addGroupSql(TableSqlCache sqlTableData, List<TableFieldVo> whereFields, List<TableFieldVo> updateFields) {
sqlTableData.add(this.releaseSql(DaoConst.SQL_TYPE_ADD_GROUP, DaoConst.GROUP_QUERY, DaoConst.SQL_LOAD,
StringHelper.EMPTY, new ArrayList<>(), whereFields));
SqlData sqlLoad = this.releaseSql(DaoConst.SQL_TYPE_ADD_GROUP, DaoConst.GROUP_QUERY, DaoConst.SQL_LOAD,
StringHelper.EMPTY, new ArrayList<>(), whereFields);
sqlLoad.addParaConst(DaoConst.CODE_FIELD_DEFAULT_NAME, DaoConst.CODE_FIELD, DaoConst.CODE_FIELD_DEFAULT);
sqlTableData.add(sqlLoad);
sqlTableData.add(this.releaseSql(DaoConst.SQL_TYPE_ADD_GROUP, DaoConst.GROUP_ADD, DaoConst.SQL_UPDATE,
DaoConst.CODE_GROUP_ADD, updateFields, this.getFieldActionList(DaoConst.FIELD_PRIMARY)));
}
......@@ -687,9 +692,9 @@ public class TableStruct {
*/
public void addExist(TableSqlCache sqlTableData, String sqlName, TableFieldString mustField, TableFieldString allowNullField) {
// String[] fields
SqlData sql = new SqlData(sqlName, DaoConst.SQL_LOAD.replace(DaoConst.CODE_TABLE, this.name));
sql.addParaConst(DaoConst.CODE_FIELD_DEFAULT_NAME, DaoConst.CODE_FIELD, DaoConst.CODE_FIELD_DEFAULT);
String text = DaoConst.SQL_LOAD.replace(DaoConst.CODE_TABLE, this.name);
SqlData sql = new SqlData(sqlName, text);
sql.setSqlType(DaoConst.SQL_TYPE_EXISTS);
sql.addConst(this.getKey().inputName,
String.format(DaoConst.CODE_WHERE_NOT_EQUALS_PARA, this.getKey().name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment