提交 d0665a21 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 d2974490
......@@ -35,10 +35,10 @@ import io.swagger.annotations.ApiOperation;
@Api(description = "资源管理-导出任务")
public class DatabaseController {
private String url = "jdbc:mysql://192.168.2.229:3306/zzfszzy-resource";
private String fileurl = "jdbc:mysql://192.168.2.229:3306/zzfszzy-file";
private String url = "jdbc:mysql://192.168.2.229:3306/hxwza_resource";
private String fileurl = "jdbc:mysql://192.168.2.229:3306/hxwza_file";
private String userName = "root";
private String password = "root";
private String password = "zrqx2020";
@ApiOperation(value = "批量导出文件", notes = "批量导出文件")
@GetMapping(value = "/file")
......@@ -46,7 +46,7 @@ public class DatabaseController {
HttpSession session = request.getSession();
session.setAttribute("percentage", "0%");
String basePath = "/opt/upload/zzfszzy/";
String basePath = "/opt/upload/hxwza/";
String zipPath = "zip/" + UUIDUtil.getUUID() + ".zip";
String zipFileName = basePath + zipPath;
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFileName)));
......@@ -124,8 +124,8 @@ public class DatabaseController {
// 前置路径
String command = "/usr/bin/mysqldump -f -c -q ";
Process process = null;
String fileinfo = "-uroot -proot -t -h192.168.2.229 zzfszzy-file";
String resource = "-uroot -proot -t -h192.168.2.229 zzfszzy-resource";
String fileinfo = "-uroot -proot -t -h192.168.2.229 hxwza-file";
String resource = "-uroot -proot -t -h192.168.2.229 hxwza-resource";
// 导出fileinfo库
Set<String> fileList = new HashSet<String>();
if (codes.contains(",")) {
......@@ -150,60 +150,45 @@ public class DatabaseController {
// 导出 resource库
// 附件库
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) {
StringBuffer ids = new StringBuffer();
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
if (codes.contains(",")) {
String[] codeStr = codes.split(",");
String sql = "select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where";
String sql1 = "";
for (String code : codeStr) {
sql += " rt.code like '" + code + "%' or";
sql1 += " code like '" + code + "%' or";
}
sql = sql.substring(0, sql.length() - 2);
sql1 = sql1.substring(0, sql1.length() - 2);
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_annex_library_diy_type --where \"" + sql1
+ "\" > " + path + "annextype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
} else {
try (PreparedStatement ps = conn.prepareStatement(
"select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
+ codes + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_annex_library_diy_type --where \"code like '"
+ codes + "%'\" > " + path + "annextype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
}
}
if (ids.length() > 0) {
ids = ids.deleteCharAt(ids.length() - 1);
String cmdannex = command + resource + " res_annex_library --where \"id in (" + ids + ")\" > " + path
+ "annex.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannex });
process.waitFor();
String cmdannexcontent = command + resource
+ " res_annex_library_label_content_diy_type --where \"annexId in (" + ids + ")\" > " + path
+ "annexcontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
process.waitFor();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_annex_library_diy_type --where \""
* + sql1 + "\" > " + path + "annextype.sql";
*
* process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c",
* cmdannextype }); process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_annex_library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "annextype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_annex_library --where \"id in (" + ids
* + ")\" > " + path + "annex.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_annex_library_label_content_diy_type --where \"annexId in (" + ids +
* ")\" > " + path + "annexcontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); } }
*/
// 音频
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.AUDIO.getCode().toString())) {
StringBuffer ids = new StringBuffer();
......@@ -260,60 +245,46 @@ public class DatabaseController {
}
// 图片
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) {
StringBuffer ids = new StringBuffer();
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
if (codes.contains(",")) {
String[] codeStr = codes.split(",");
String sql = "select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where";
String sql1 = "";
for (String code : codeStr) {
sql += " rt.code like '" + code + "%' or";
sql1 += " code like '" + code + "%' or";
}
sql = sql.substring(0, sql.length() - 2);
sql1 = sql1.substring(0, sql1.length() - 2);
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_image_Library_diy_type --where \"" + sql1
+ "\" > " + path + "audiotype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
} else {
try (PreparedStatement ps = conn.prepareStatement(
"select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where rt.code like '"
+ codes + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_image_Library_diy_type --where \"code like '"
+ codes + "%'\" > " + path + "imagetype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
}
}
if (ids.length() > 0) {
ids = ids.deleteCharAt(ids.length() - 1);
String cmdannex = command + resource + " res_image_Library --where \"id in (" + ids + ")\" > " + path
+ "image.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannex });
process.waitFor();
String cmdannexcontent = command + resource
+ " res_image_Library_label_content_diy_type --where \"imageId in (" + ids + ")\" > " + path
+ "imagecontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
process.waitFor();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_image_Library_diy_type --where \""
* + sql1 + "\" > " + path + "audiotype.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
* process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_image_Library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "imagetype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_image_Library --where \"id in (" + ids
* + ")\" > " + path + "image.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_image_Library_label_content_diy_type --where \"imageId in (" + ids +
* ")\" > " + path + "imagecontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); }
*
* }
*/
// pdf
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
StringBuffer ids = new StringBuffer();
......@@ -370,7 +341,7 @@ public class DatabaseController {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
if (codes.contains(",")) {
String[] codeStr = codes.split(",");
String sql = "select r.id from res_video_Library r inner join res_video_Library_diy_type rt on r.id =rt.vlid where";
String sql = "select r.id from res_video_Library r inner join res_video_Library_diy_type rt on r.id =rt.videoid where";
String sql1 = "";
for (String code : codeStr) {
sql += " rt.code like '" + code + "%' or";
......@@ -390,7 +361,7 @@ public class DatabaseController {
process.waitFor();
} else {
try (PreparedStatement ps = conn.prepareStatement(
"select r.id from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.vlid where rt.code like '"
"select r.id from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.videoid where rt.code like '"
+ codes + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
......@@ -412,7 +383,7 @@ public class DatabaseController {
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannex });
process.waitFor();
String cmdannexcontent = command + resource
+ " res_video_library_label_content_diy_type --where \"vlid in (" + ids + ")\" > " + path
+ " res_video_library_label_content_diy_type --where \"videoid in (" + ids + ")\" > " + path
+ "videocontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
process.waitFor();
......@@ -420,60 +391,46 @@ public class DatabaseController {
}
// 课程
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) {
StringBuffer ids = new StringBuffer();
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
if (codes.contains(",")) {
String[] codeStr = codes.split(",");
String sql = "select r.id from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where";
String sql1 = "";
for (String code : codeStr) {
sql += " rt.code like '" + code + "%' or";
sql1 += " code like '" + code + "%' or";
}
sql = sql.substring(0, sql.length() - 2);
sql1 = sql1.substring(0, sql1.length() - 2);
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_course_library_diy_type --where \"" + sql1
+ "\" > " + path + "coursetype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
} else {
try (PreparedStatement ps = conn.prepareStatement(
"select r.id from res_video_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
+ codes + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
ids.append("'").append(resultSet.getString("id")).append("',");
}
}
String cmdannextype = command + resource + " res_video_library_diy_type --where \"code like '"
+ codes + "%'\" > " + path + "coursetype.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
process.waitFor();
}
}
if (ids.length() > 0) {
ids = ids.deleteCharAt(ids.length() - 1);
String cmdannex = command + resource + " res_course_library --where \"id in (" + ids + ")\" > " + path
+ "course.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannex });
process.waitFor();
String cmdannexcontent = command + resource
+ " res_course_library_label_content_diy_type --where \"courseLibraryId in (" + ids + ")\" > " + path
+ "coursecontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
process.waitFor();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_course_library_diy_type --where \""
* + sql1 + "\" > " + path + "coursetype.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
* process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_video_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_video_library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "coursetype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_course_library --where \"id in (" + ids
* + ")\" > " + path + "course.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_course_library_label_content_diy_type --where \"courseLibraryId in (" +
* ids + ")\" > " + path + "coursecontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); }
*
* }
*/
// 文章
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.ARTICLE.getCode().toString())) {
StringBuffer ids = new StringBuffer();
......@@ -522,7 +479,7 @@ public class DatabaseController {
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannex });
process.waitFor();
String cmdannexcontent = command + resource
+ " res_article_library_label_content_diy_type --where \"vlid in (" + ids + ")\" > " + path
+ " res_article_library_label_content_diy_type --where \"videoid in (" + ids + ")\" > " + path
+ "articlecontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
process.waitFor();
......@@ -580,7 +537,7 @@ public class DatabaseController {
+ "ebook.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdebook });
process.waitFor();
String cmdebookcontent = command + resource + " res_ebook_label_content_diy_type --where \"vlid in ("
String cmdebookcontent = command + resource + " res_ebook_label_content_diy_type --where \"videoid in ("
+ ids + ")\" > " + path + "ebookcontent.sql";
process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdebookcontent });
process.waitFor();
......@@ -599,7 +556,7 @@ public class DatabaseController {
}
}
//打包生成zip
String basePath = "/opt/upload/zzfszzy/";
String basePath = "/opt/upload/hxwza/";
String zipPath = "zip/" + UUIDUtil.getUUID() + ".zip";
String zipFileName = basePath + zipPath;
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFileName)));
......@@ -628,49 +585,44 @@ public class DatabaseController {
Set<String> fileList = new HashSet<String>();
// 附件
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.annex,r.cover from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("annex") != null) {
fileList.add(resultSet.getString("annex"));
}
if (resultSet.getString("cover") != null) {
fileList.add(resultSet.getString("cover"));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.annex,r.cover from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("annex") != null) {
* fileList.add(resultSet.getString("annex")); } if
* (resultSet.getString("cover") != null) {
* fileList.add(resultSet.getString("cover")); } } } } }
*/
// 文章
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.ARTICLE.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.pdf,r.img from res_article_library r inner join res_article_library_diy_type rt on r.id =rt.alid where rt.code like '"
"select r.pdf,r.cover from res_article_library r inner join res_article_library_diy_type rt on r.id =rt.alid where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("pdf") != null) {
fileList.add(resultSet.getString("pdf"));
}
if (resultSet.getString("img") != null) {
fileList.add(resultSet.getString("img"));
if (resultSet.getString("cover") != null) {
fileList.add(resultSet.getString("cover"));
}
}
}
try (PreparedStatement ps = conn.prepareStatement(
"select r.pdf,r.img from res_article_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
"select r.pdf,r.cover from res_article_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("pdf") != null) {
fileList.add(resultSet.getString("pdf"));
}
if (resultSet.getString("img") != null) {
fileList.add(resultSet.getString("img"));
if (resultSet.getString("cover") != null) {
fileList.add(resultSet.getString("cover"));
}
}
}
......@@ -696,38 +648,28 @@ public class DatabaseController {
}
}
// 图片
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.image,r.image_sl from res_image_library r inner join res_image_library_diy_type rt on r.id =rt.ilid where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("image") != null) {
fileList.add(resultSet.getString("image"));
}
if (resultSet.getString("image_sl") != null) {
fileList.add(resultSet.getString("image_sl"));
}
}
}
try (PreparedStatement ps = conn.prepareStatement(
"select r.image,r.image_sl from res_image_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("image") != null) {
fileList.add(resultSet.getString("image"));
}
if (resultSet.getString("image_sl") != null) {
fileList.add(resultSet.getString("image_sl"));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.image,r.image_sl from res_image_library r inner join res_image_library_diy_type rt on r.id =rt.ilid where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("image") != null) {
* fileList.add(resultSet.getString("image")); } if
* (resultSet.getString("image_sl") != null) {
* fileList.add(resultSet.getString("image_sl")); } }
*
* } try (PreparedStatement ps = conn.prepareStatement(
* "select r.image,r.image_sl from res_image_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("image") != null) {
* fileList.add(resultSet.getString("image")); } if
* (resultSet.getString("image_sl") != null) {
* fileList.add(resultSet.getString("image_sl")); } }
*
* } } }
*/
// pdf
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
......@@ -748,7 +690,7 @@ public class DatabaseController {
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.VIDEO.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.video,r.cover from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.vlid where rt.code like '"
"select r.video,r.cover from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.videoid where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
......@@ -764,21 +706,18 @@ public class DatabaseController {
}
}
// 课程
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.cover from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
+ code + "%'")) {
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("cover") != null) {
fileList.add(resultSet.getString("cover"));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.cover from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("cover") != null) {
* fileList.add(resultSet.getString("cover")); } }
*
* } } }
*/
// 图书
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.BOOK.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论