更新beetlsql api
This commit is contained in:
parent
8cfa74b829
commit
774ec56703
2
pom.xml
2
pom.xml
|
|
@ -19,7 +19,7 @@
|
||||||
<shiro.version>1.3.2</shiro.version>
|
<shiro.version>1.3.2</shiro.version>
|
||||||
<log4j2.version>2.7</log4j2.version>
|
<log4j2.version>2.7</log4j2.version>
|
||||||
<beetl.version>2.7.11</beetl.version>
|
<beetl.version>2.7.11</beetl.version>
|
||||||
<beetlsql.version>2.8.2</beetlsql.version>
|
<beetlsql.version>2.8.3</beetlsql.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class ConfigListener implements ServletContextListener {
|
||||||
public void contextInitialized(ServletContextEvent evt) {
|
public void contextInitialized(ServletContextEvent evt) {
|
||||||
ServletContext sc = evt.getServletContext();
|
ServletContext sc = evt.getServletContext();
|
||||||
// 项目路径
|
// 项目路径
|
||||||
conf.put("realPath", sc.getRealPath("/").replaceFirst("/", ""));
|
conf.put("realPath", sc.getRealPath("/"));
|
||||||
conf.put("contextPath", sc.getContextPath());
|
conf.put("contextPath", sc.getContextPath());
|
||||||
|
|
||||||
Properties prop = PropKit.use(Const.PROPERTY_FILE).getProperties();
|
Properties prop = PropKit.use(Const.PROPERTY_FILE).getProperties();
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ public class Blade {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据实体类集合批量更新
|
* 根据实体类集合批量更新(更新全部字段)
|
||||||
* @param list 实体类集合
|
* @param list 实体类集合
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -480,6 +480,44 @@ public class Blade {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据实体类集合批量更新(只更新非空字段)
|
||||||
|
* @param list 实体类集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int[] updateBatchTemplateById(List<?> list) {
|
||||||
|
int[] n = getSqlManager().updateBatchTemplateById(this.modelClass, list);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或修改一条数据(为null的字段不更新)
|
||||||
|
* @param model 实体类
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean saveOrUpdate(Object model) {
|
||||||
|
Object idValue = this.getIdValue(model);
|
||||||
|
if(Func.isEmpty(idValue)){
|
||||||
|
return saveAndSetKey(model);
|
||||||
|
} else {
|
||||||
|
return getSqlManager().updateTemplateById(model) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或修改一条数据(为null的字段也更新)
|
||||||
|
* @param model 实体类
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean saveOrUpdateEveryCol(Object model) {
|
||||||
|
Object idValue = this.getIdValue(model);
|
||||||
|
if(Func.isEmpty(idValue)){
|
||||||
|
return saveAndSetKey(model);
|
||||||
|
} else {
|
||||||
|
return getSqlManager().updateById(model) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id删除数据
|
* 根据id删除数据
|
||||||
* @param id 主键值
|
* @param id 主键值
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class DefaultFileProxyFactory implements IFileProxy {
|
||||||
//避免网络延迟导致时间不同步
|
//避免网络延迟导致时间不同步
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
|
||||||
StringBuilder uploadPath = new StringBuilder().append(File.separator)
|
StringBuilder uploadPath = new StringBuilder()
|
||||||
.append(getFileDir(dir, Cst.me().getUploadRealPath()))
|
.append(getFileDir(dir, Cst.me().getUploadRealPath()))
|
||||||
.append(time)
|
.append(time)
|
||||||
.append(getFileExt(f.getName()));
|
.append(getFileExt(f.getName()));
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,9 @@ public class GenerateController extends CurdController<Generate> {
|
||||||
|
|
||||||
String tableName = gen.getTablename();
|
String tableName = gen.getTablename();
|
||||||
String pkName = gen.getPkname();
|
String pkName = gen.getPkname();
|
||||||
String path = File.separator + realPath + File.separator + "java" + File.separator + packageName.replace(StrKit.DOT, File.separator);
|
String path = realPath + File.separator + "java" + File.separator + packageName.replace(StrKit.DOT, File.separator);
|
||||||
String resourcesPath = File.separator + realPath + File.separator + "resources";
|
String resourcesPath = realPath + File.separator + "resources";
|
||||||
String webappPath = File.separator + realPath + File.separator + "webapp" + File.separator + "WEB-INF" + File.separator + "view";
|
String webappPath = realPath + File.separator + "webapp" + File.separator + "WEB-INF" + File.separator + "view";
|
||||||
|
|
||||||
//java
|
//java
|
||||||
String controllerPath = path + File.separator + "controller" + File.separator + upperModelName + "Controller.java";
|
String controllerPath = path + File.separator + "controller" + File.separator + upperModelName + "Controller.java";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user