|
@@ -7,6 +7,7 @@ import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
import com.lc.ibps.base.bo.exception.BoBaseException;
|
|
import com.lc.ibps.base.bo.exception.BoBaseException;
|
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
|
import com.lc.ibps.base.core.util.BeanUtils;
|
|
import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
|
|
+import com.lc.ibps.base.core.util.Collections;
|
|
|
import com.lc.ibps.base.core.util.I18nUtil;
|
|
import com.lc.ibps.base.core.util.I18nUtil;
|
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
import com.lc.ibps.base.framework.id.UniqueIdUtil;
|
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
import com.lc.ibps.base.framework.table.ICommonDao;
|
|
@@ -149,16 +150,28 @@ public class UpdateDataTableImpl extends GenericProvider implements UpdateDataTa
|
|
|
//修改方法
|
|
//修改方法
|
|
|
@Override
|
|
@Override
|
|
|
public Integer updateDatasContextTable(String tableName, List<Map<String,String>> paramWhere, Map<String, String> paramCond) {
|
|
public Integer updateDatasContextTable(String tableName, List<Map<String,String>> paramWhere, Map<String, String> paramCond) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- paramCond.put("update_by_", ContextUtil.getCurrentUserId());
|
|
|
|
|
- paramCond.put("update_time_",sdf.format(new Date()));
|
|
|
|
|
|
|
+ if (getFieldByTableName(tableName)){
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ paramCond.put("update_by_", ContextUtil.getCurrentUserId());
|
|
|
|
|
+ paramCond.put("update_time_",sdf.format(new Date()));
|
|
|
|
|
+ }
|
|
|
return updateDataTableDao.updateDatasTable(tableName,paramCond,paramWhere);
|
|
return updateDataTableDao.updateDatasTable(tableName,paramCond,paramWhere);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private boolean getFieldByTableName(String tableName){
|
|
|
|
|
+ String sql = "SELECT *from ibps_bo_column WHERE TABLE_NAME_='%s' and name_ in('update_by_','update_time_')";
|
|
|
|
|
+ List list = commonDao.query(String.format(sql,tableName));
|
|
|
|
|
+ if(!Collections.isEmpty(list) && list.size()==2){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Integer updateBatchContextTable(String tableName, List<Map<String, String>> list) {
|
|
public Integer updateBatchContextTable(String tableName, List<Map<String, String>> list) {
|
|
|
Integer integer = 1;
|
|
Integer integer = 1;
|
|
|
|
|
+ boolean flag = getFieldByTableName(tableName);
|
|
|
if (list!=null&&list.size()>0){
|
|
if (list!=null&&list.size()>0){
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
for (int i = 0; i < list.size(); i++) {
|
|
@@ -167,8 +180,10 @@ public class UpdateDataTableImpl extends GenericProvider implements UpdateDataTa
|
|
|
JSONObject whereObj = JSONObject.parseObject(String.valueOf(list.get(i).get("where")));
|
|
JSONObject whereObj = JSONObject.parseObject(String.valueOf(list.get(i).get("where")));
|
|
|
|
|
|
|
|
if (setObj != null && whereObj != null){
|
|
if (setObj != null && whereObj != null){
|
|
|
- setObj.put("update_by_", ContextUtil.getCurrentUserId());
|
|
|
|
|
- setObj.put("update_time_",sdf.format(new Date()));
|
|
|
|
|
|
|
+ if(flag){
|
|
|
|
|
+ setObj.put("update_by_", ContextUtil.getCurrentUserId());
|
|
|
|
|
+ setObj.put("update_time_",sdf.format(new Date()));
|
|
|
|
|
+ }
|
|
|
StringBuilder wsf = new StringBuilder(" ");
|
|
StringBuilder wsf = new StringBuilder(" ");
|
|
|
StringBuilder psf = new StringBuilder(" ");
|
|
StringBuilder psf = new StringBuilder(" ");
|
|
|
// set sql 拼接
|
|
// set sql 拼接
|