|
|
@@ -29,14 +29,15 @@ public class SqlAutoCreateTest extends TestCase {
|
|
|
//来源表名称
|
|
|
String srcTabelName = "wcmdocument";
|
|
|
//需要合并到空视图的栏目IDS
|
|
|
- //String channelIds = "1,2";
|
|
|
- //TODO 来源表数据过滤条件
|
|
|
- //String where = " DOCCHANNEL in (" + channelIds + ") ";
|
|
|
- String where = "dockind = 0";
|
|
|
+ String channelIds = "1,2";
|
|
|
+ //来源表数据过滤条件
|
|
|
+ String where = " DOCCHANNEL in (" + channelIds + ") ";
|
|
|
+ //TODO
|
|
|
+
|
|
|
+
|
|
|
//生成批量插入sql
|
|
|
String insertSql = buildInsertSql(srcTabelName, toTabelName, where);
|
|
|
System.out.println("-- insert SQL");
|
|
|
- System.out.println("SET @max_mum = IFNULL((select MAX("+toTabelName+"Id ) from "+toTabelName+"),0);");
|
|
|
System.out.println(insertSql);
|
|
|
//生成chnldoc SQL
|
|
|
String updateChnldocSql = buildUpdateChnldocSql(toViewId, channelIds);
|
|
|
@@ -90,18 +91,6 @@ public class SqlAutoCreateTest extends TestCase {
|
|
|
return deleteViewEmployerSql.toString();
|
|
|
}
|
|
|
|
|
|
- private String buildUpdateDocumentSql(int toViewId, String where) {
|
|
|
-
|
|
|
- StringBuilder updateDocumentSql = new StringBuilder();
|
|
|
- updateDocumentSql.append("UPDATE wcmdocument SET DOCKIND = ")
|
|
|
- .append(toViewId)
|
|
|
- .append(" WHERE DOCCHANNEL in (")
|
|
|
- .append(channelIds)
|
|
|
- .append(") ;");
|
|
|
-
|
|
|
- return updateDocumentSql.toString();
|
|
|
- }
|
|
|
- /*
|
|
|
private String buildUpdateDocumentSql(int toViewId, String channelIds) {
|
|
|
|
|
|
StringBuilder updateDocumentSql = new StringBuilder();
|
|
|
@@ -113,16 +102,9 @@ public class SqlAutoCreateTest extends TestCase {
|
|
|
|
|
|
return updateDocumentSql.toString();
|
|
|
}
|
|
|
- */
|
|
|
- private String buildUpdateChnldocSql(int toViewId, String where) {
|
|
|
- StringBuilder updateChnldocSql = new StringBuilder();
|
|
|
- updateChnldocSql.append("UPDATE wcmchnldoc SET DOCKIND = ")
|
|
|
- .append(toViewId)
|
|
|
- .append(" " + where + ";");
|
|
|
- return updateChnldocSql.toString();
|
|
|
- }
|
|
|
- /*
|
|
|
+
|
|
|
private String buildUpdateChnldocSql(int toViewId, String channelIds) {
|
|
|
+
|
|
|
StringBuilder updateChnldocSql = new StringBuilder();
|
|
|
updateChnldocSql.append("UPDATE wcmchnldoc SET DOCKIND = ")
|
|
|
.append(toViewId)
|
|
|
@@ -132,7 +114,6 @@ public class SqlAutoCreateTest extends TestCase {
|
|
|
|
|
|
return updateChnldocSql.toString();
|
|
|
}
|
|
|
- */
|
|
|
|
|
|
private String buildInsertSql(String srcTabelName, String toTabelName, String where) throws CMyException {
|
|
|
|