|
@@ -15,7 +15,9 @@ import org.jeecg.modules.activiti.service.IActBusinessService;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -54,6 +56,8 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
|
|
|
|
Map<String, Object> busiData = this.baseMapper.getBusiData(tableId, tableName);
|
|
Map<String, Object> busiData = this.baseMapper.getBusiData(tableId, tableName);
|
|
String[] fileds = filedNames.split(",");
|
|
String[] fileds = filedNames.split(",");
|
|
|
|
+
|
|
|
|
+ Date date = new Date();
|
|
if (MapUtil.isEmpty(busiData)){ //没有,新增逻辑
|
|
if (MapUtil.isEmpty(busiData)){ //没有,新增逻辑
|
|
StringBuilder filedsB = new StringBuilder("id");
|
|
StringBuilder filedsB = new StringBuilder("id");
|
|
StringBuilder filedsVB = new StringBuilder("'"+tableId+"'");
|
|
StringBuilder filedsVB = new StringBuilder("'"+tableId+"'");
|
|
@@ -67,6 +71,9 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //创建时间
|
|
|
|
+ filedsB.append(",create_time");
|
|
|
|
+ filedsVB.append(",'"+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date) +"'");
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)",tableName,filedsB.toString(),filedsVB.toString()));
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)",tableName,filedsB.toString(),filedsVB.toString()));
|
|
|
|
|
|
//子表是否存在
|
|
//子表是否存在
|
|
@@ -92,7 +99,9 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
//排序
|
|
//排序
|
|
filedIdB.append(",sort");
|
|
filedIdB.append(",sort");
|
|
filedIdVB.append(",'" + i + "'");
|
|
filedIdVB.append(",'" + i + "'");
|
|
-
|
|
|
|
|
|
+ //创建时间
|
|
|
|
+ filedIdB.append(",create_time");
|
|
|
|
+ filedIdVB.append(",'" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date) + "'");
|
|
//新增子表
|
|
//新增子表
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", tableNameB, filedIdB.toString(), filedIdVB.toString()));
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", tableNameB, filedIdB.toString(), filedIdVB.toString()));
|
|
}
|
|
}
|
|
@@ -125,7 +134,9 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
//排序
|
|
//排序
|
|
filedIdB.append(",sort");
|
|
filedIdB.append(",sort");
|
|
filedIdVB.append(",'" + i + "'");
|
|
filedIdVB.append(",'" + i + "'");
|
|
-
|
|
|
|
|
|
+ //创建时间
|
|
|
|
+ filedIdB.append(",create_time");
|
|
|
|
+ filedIdVB.append(",'" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date) + "'");
|
|
//新增子表
|
|
//新增子表
|
|
String childTableName = tableNameChildrenList.get(j - 1);
|
|
String childTableName = tableNameChildrenList.get(j - 1);
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", childTableName, filedIdB.toString(), filedIdVB.toString()));
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", childTableName, filedIdB.toString(), filedIdVB.toString()));
|
|
@@ -142,6 +153,7 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
setSql.append(String.format("%s = '%s',",filed, parameter));
|
|
setSql.append(String.format("%s = '%s',",filed, parameter));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ setSql.append(String.format("update_time = '%s',", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date)));
|
|
String substring = setSql.substring(0, setSql.length()-1);//去掉最后一个,号
|
|
String substring = setSql.substring(0, setSql.length()-1);//去掉最后一个,号
|
|
this.baseMapper.insertBusiData(String.format("update %s set %s where id = '%s'",tableName,substring,tableId));
|
|
this.baseMapper.insertBusiData(String.format("update %s set %s where id = '%s'",tableName,substring,tableId));
|
|
//子表修改逻辑
|
|
//子表修改逻辑
|
|
@@ -169,6 +181,9 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
//排序
|
|
//排序
|
|
filedIdB.append(",sort");
|
|
filedIdB.append(",sort");
|
|
filedIdVB.append(",'" + i + "'");
|
|
filedIdVB.append(",'" + i + "'");
|
|
|
|
+ //创建时间
|
|
|
|
+ filedIdB.append(",create_time");
|
|
|
|
+ filedIdVB.append(",'" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date) + "'");
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", tableNameB, filedIdB.toString(), filedIdVB.toString()));
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", tableNameB, filedIdB.toString(), filedIdVB.toString()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -204,6 +219,10 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
|
|
//排序
|
|
//排序
|
|
filedIdB.append(",sort");
|
|
filedIdB.append(",sort");
|
|
filedIdVB.append(",'" + i + "'");
|
|
filedIdVB.append(",'" + i + "'");
|
|
|
|
+
|
|
|
|
+ //创建时间
|
|
|
|
+ filedIdB.append(",create_time");
|
|
|
|
+ filedIdVB.append(",'" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date) + "'");
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", childTableName, filedIdB.toString(), filedIdVB.toString()));
|
|
this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)", childTableName, filedIdB.toString(), filedIdVB.toString()));
|
|
}
|
|
}
|
|
}
|
|
}
|