Commit acef36f1 authored by yanzg's avatar yanzg

将源码打包进jar包

parent d82a57fe
......@@ -98,7 +98,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
List<Object> paraList = new ArrayList<>();
for (Object item : list) {
List<Object> paras = new ArrayList<>();
String sql = this.getPara(paras, sqlData, item);
String sql = this.getPara(paras, sqlData, item, true);
if (sqlList.length() > 0) {
sql = sql.replaceAll(DaoConst.SQL_LIST_FROM, DaoConst.SQL_LIST_TO);
}
......@@ -402,10 +402,6 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
if (queryPara != null && queryPara.isFullCond()) {
return model;
}
// 对查询条件进行初始化
if (model instanceof InitDaoQuery) {
((InitDaoQuery) model).initCond();
}
// 获取来源主键
Object from = this.table.getKeyObject(model);
return from;
......
......@@ -11,10 +11,7 @@ import com.yanzuoguang.util.cache.MemoryCache;
import com.yanzuoguang.util.helper.ArrayHelper;
import com.yanzuoguang.util.helper.StringFormatHandle;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.MapRow;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.PageSizeReq;
import com.yanzuoguang.util.vo.PageSizeReqVo;
import com.yanzuoguang.util.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
......@@ -190,7 +187,7 @@ public abstract class BaseDaoSql {
*/
protected int updateSql(SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<Object>();
String sql = this.getPara(paras, sqlData, model);
String sql = this.getPara(paras, sqlData, model, true);
int ret = this.getDb().update(this.getClass(), sqlData.getName(), sql, paras.toArray());
this.onUpdateSql(model);
return ret;
......@@ -251,7 +248,7 @@ public abstract class BaseDaoSql {
*/
protected <T extends Object> List<T> queryData(Class<T> cls, SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<Object>();
String sql = this.getPara(paras, sqlData, model);
String sql = this.getPara(paras, sqlData, model, false);
List<T> list = this.queryWithCache(cls, sqlData.getName(), sql, paras.toArray());
return list;
}
......@@ -266,7 +263,7 @@ public abstract class BaseDaoSql {
*/
protected <T extends Object> void queryData(Class<T> cls, DbRow<T> handle, SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<>();
String sql = this.getPara(paras, sqlData, model);
String sql = this.getPara(paras, sqlData, model, false);
// 查询数据
this.getDb().query(this.getClass(), cls, handle, sqlData.getName(), sql, paras.toArray());
}
......@@ -305,7 +302,7 @@ public abstract class BaseDaoSql {
sqlData = getSqlQueryPara(sqlData, queryPara, true);
List<Object> paras = new ArrayList<>();
String sql = this.getPara(paras, sqlData, model);
String sql = this.getPara(paras, sqlData, model, false);
Object cell = this.queryCellWithCache(sqlData.getName(), sql, paras.toArray());
return cell;
}
......@@ -527,7 +524,7 @@ public abstract class BaseDaoSql {
// 按照分页查询数据
List<Object> baseParas = new ArrayList<Object>();
String sql = this.getPara(baseParas, to, model);
String sql = this.getPara(baseParas, to, model, false);
// 查询实体数据
List<T> list = this.queryWithCache(cls, sqlName, sql, baseParas.toArray());
data.setList(list);
......@@ -544,7 +541,7 @@ public abstract class BaseDaoSql {
// 按照分页查询数据
List<Object> baseParas = new ArrayList<Object>();
String sql = this.getPara(baseParas, fromPageSize, model);
String sql = this.getPara(baseParas, fromPageSize, model, false);
sql = sql.trim();
// 查询总数据量
String sqlSize = "SELECT COUNT(1) FROM (" +
......@@ -569,7 +566,18 @@ public abstract class BaseDaoSql {
* @param model 参数的实体
* @return SQL条件
*/
protected String getPara(List<Object> paras, SqlData sqlData, Object model) {
protected String getPara(List<Object> paras, SqlData sqlData, Object model, boolean isUpdate) {
if (isUpdate) {
if (model instanceof InitDao) {
InitDao to = (InitDao) model;
to.init();
}
} else {
// 对查询条件进行初始化
if (model instanceof InitDaoQuery) {
((InitDaoQuery) model).initCond();
}
}
// 将SQL语句进行代码片段追加
StringBuilder sb = new StringBuilder(sqlData.getSql());
for (String code : DaoConst.LAST_AUTO_ADD) {
......
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