Merge remote-tracking branch 'origin/beetlsql3-dev' into beetlsql3-dev

beetlsql3-dev
姚丹ab 2 years ago
commit 3d02f0bace

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>admin</artifactId>
<groupId>com.ibeetl</groupId>
<version>1.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-convert-pdf</artifactId>
<description>任意格式转换成PDF的工具包</description>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>admin-core</artifactId>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.3</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>18.10</version>
<classifier>jdk16</classifier>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>18.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>AsposeJavaAPI</id>
<url>https://repository.aspose.com/repo/</url>
</pluginRepository>
</pluginRepositories>
</project>

@ -0,0 +1,436 @@
package util.convertPDF;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.itextpdf.text.Document;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.xslf.usermodel.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static util.convertPDF.PDFConverUtil.TypeEnum.*;
/**
* : <br>
* PDF
*
* @Author: lx
* @Date: 2022/12/13 16:26
*/
public final class PDFConverUtil {
final private static Map<TypeEnum, List<String>> types = new HashMap<>();
public static enum TypeEnum {
WORD, EXCEL, PPT, PPTX
}
static {
types.put(WORD, Arrays.asList("DOC", "DOCX", "OOXML", "RTF HTML", "OpenDocument", "PDF","EPUB", "XPS", "SWF"));
types.put(EXCEL, Arrays.asList("XLS", "XLSX"));
types.put(PPT, Arrays.asList("PPT"));
types.put(PPTX, Arrays.asList("PPTX"));
}
/**
* @param inputStream
* @param outputStream pdf
**/
public static boolean imgToPdf(InputStream inputStream, OutputStream outputStream) {
Document document = null;
try {
// 创建文档,设置PDF页面的大小 A2-A9, 个人觉得A3最合适
document = new Document(PageSize.A6, 20, 20, 20, 20);
// 新建pdf文档,具体逻辑看.getInstance方法
PdfWriter.getInstance(document, outputStream);
document.open();
document.newPage();
// 将文件流转换为字节流,便于格式转换
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int length = 0 ;
while (-1 != (length = bufferedInputStream.read(bytes))) {
byteArrayOutputStream.write(bytes, 0, length);
}
// 处理img图片
Image image = Image.getInstance(byteArrayOutputStream.toByteArray());
float height = image.getHeight();
float width = image.getWidth();
float percent = 0.0f;
// 设置像素或者长宽高,将会影响图片的清晰度,因为只是对图片放大或缩小
if (height > width) {
// A4 - A9
percent = PageSize.A6.getHeight() / height * 100;
} else {
percent = PageSize.A6.getWidth() / width * 100;
}
image.setAlignment(Image.MIDDLE);
image.scalePercent(percent);
// 将图片放入文档中完成pdf转换
document.add(image);
System.out.println("image转换完毕");
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
try {
if (document != null) {
document.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return true;
}
/**
* @param inputStream
* @param outputStream pdf
**/
public static boolean wordToPdfByAspose(InputStream inputStream, OutputStream outputStream) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getLicense()) {
return false;
}
try {
// 将源文件保存在com.aspose.words.Document中具体的转换格式依靠里面的save方法
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
doc.save(outputStream, SaveFormat.PDF);
System.out.println("word转换完毕");
} catch (Exception e) {
e.printStackTrace();
return false;
}finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return true;
}
// 官方文档的要求 无需理会
public static boolean getLicense() {
boolean result = false;
try {
String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* @param inputStream
* @param outputStream pdf
**/
public static boolean excelToPdf(InputStream inputStream, OutputStream outputStream) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getExeclLicense()) {
return false;
}
try {
// 原始excel路径
com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(inputStream);
com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(false);
int[] autoDrawSheets={3};
//当excel中对应的sheet页宽度太大时在PDF中会拆断并分页。此处等比缩放。
autoDraw(wb,autoDrawSheets);
int[] showSheets={0};
//隐藏workbook中不需要的sheet页。
printSheetPage(wb,showSheets);
wb.save(outputStream, pdfSaveOptions);
outputStream.flush();
outputStream.close();
System.out.println("excel转换完毕");
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/**
* sheet
* @param wb
* @param page sheet
*/
public static void autoDraw(com.aspose.cells.Workbook wb,int[] page){
if(null!=page&&page.length>0){
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).getHorizontalPageBreaks().clear();
wb.getWorksheets().get(i).getVerticalPageBreaks().clear();
}
}
}
/**
* workbooksheet
*
* @param wb
* @param page sheet
*/
public static void printSheetPage(com.aspose.cells.Workbook wb, int[] page) {
for (int i = 1; i < wb.getWorksheets().getCount(); i++) {
wb.getWorksheets().get(i).setVisible(false);
}
if (null == page || page.length == 0) {
wb.getWorksheets().get(0).setVisible(true);
} else {
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).setVisible(true);
}
}
}
public static boolean getExeclLicense() {
boolean result = false;
try {
String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
com.aspose.cells.License aposeLic = new com.aspose.cells.License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* pptToPdf
* @param inputStream
* @param outputStream
* @return
*/
public static boolean pptToPdf(InputStream inputStream, OutputStream outputStream) {
Document document = null;
HSLFSlideShow hslfSlideShow = null;
PdfWriter pdfWriter = null;
try {
hslfSlideShow = new HSLFSlideShow(inputStream);
// 获取ppt文件页面
Dimension dimension = hslfSlideShow.getPageSize();
document = new Document();
// pdfWriter实例
pdfWriter = PdfWriter.getInstance(document, outputStream);
document.open();
PdfPTable pdfPTable = new PdfPTable(1);
List<HSLFSlide> hslfSlideList = hslfSlideShow.getSlides();
for (int i=0; i < hslfSlideList.size(); i++) {
HSLFSlide hslfSlide = hslfSlideList.get(i);
// 设置字体, 解决中文乱码
for (HSLFShape shape : hslfSlide.getShapes()) {
HSLFTextShape textShape = (HSLFTextShape) shape;
for (HSLFTextParagraph textParagraph : textShape.getTextParagraphs()) {
for (HSLFTextRun textRun : textParagraph.getTextRuns()) {
textRun.setFontFamily("宋体");
}
}
}
BufferedImage bufferedImage = new BufferedImage((int)dimension.getWidth(), (int)dimension.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2d = bufferedImage.createGraphics();
graphics2d.setPaint(Color.white);
graphics2d.setFont(new java.awt.Font("宋体", java.awt.Font.PLAIN, 12));
hslfSlide.draw(graphics2d);
graphics2d.dispose();
Image image = Image.getInstance(bufferedImage, null);
image.scalePercent(50f);
// 写入单元格
pdfPTable.addCell(new PdfPCell(image, true));
document.add(image);
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (document != null) {
document.close();
}
if (pdfWriter != null) {
pdfWriter.close();
}
}
System.out.println("ppt转换完毕");
return true;
}
/**
* pptxToPdf
* @param inputStream
* @param outputStream
* @return
*/
public static boolean pptxToPdf(InputStream inputStream, OutputStream outputStream) {
Document document = null;
XMLSlideShow slideShow = null;
PdfWriter pdfWriter = null;
try {
slideShow = new XMLSlideShow(inputStream);
Dimension dimension = slideShow.getPageSize();
document = new Document();
pdfWriter = PdfWriter.getInstance(document, outputStream);
document.open();
PdfPTable pdfPTable = new PdfPTable(1);
List<XSLFSlide> slideList = slideShow.getSlides();
for (int i = 0, row = slideList.size(); i < row; i++) {
XSLFSlide slide = slideList.get(i);
// 设置字体, 解决中文乱码
for (XSLFShape shape : slide.getShapes()) {
XSLFTextShape textShape = (XSLFTextShape) shape;
for (XSLFTextParagraph textParagraph : textShape.getTextParagraphs()) {
for (XSLFTextRun textRun : textParagraph.getTextRuns()) {
textRun.setFontFamily("宋体");
}
}
}
BufferedImage bufferedImage = new BufferedImage((int)dimension.getWidth(), (int)dimension.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2d = bufferedImage.createGraphics();
graphics2d.setPaint(Color.white);
graphics2d.setFont(new java.awt.Font("宋体", java.awt.Font.PLAIN, 12));
slide.draw(graphics2d);
graphics2d.dispose();
Image image = Image.getInstance(bufferedImage, null);
image.scalePercent(50f);
// 写入单元格
pdfPTable.addCell(new PdfPCell(image, true));
document.add(image);
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (document != null) {
document.close();
}
if (pdfWriter != null) {
pdfWriter.close();
}
}
System.out.println("pptx转换完毕");
return true;
}
/**
* : <br>
*
*
* @return {@link boolean}
* @Author: lx
* @Date: 2022/12/13 16:37
*/
public static boolean convertToPDFByFileNameSuffix(String fileName, InputStream inputStream, OutputStream outputStream) {
String fileSuffix = getFileSuffix(fileName);
if (types.get(WORD).contains(fileSuffix)) {
return wordToPdfByAspose(inputStream, outputStream);
}
if (types.get(PPT).contains(fileSuffix)) {
return pptToPdf(inputStream, outputStream);
}
if (types.get(PPTX).contains(fileSuffix)) {
return pptxToPdf(inputStream, outputStream);
}
if (types.get(EXCEL).contains(fileSuffix)) {
return excelToPdf(inputStream, outputStream);
}
return false;
}
/**
* : <br>
*
*
* @param fileName
* @return {@link String}
* @Author: lx
* @Date: 2022/12/13 21:51
*/
private static String getFileSuffix(String fileName) {
String[] split = fileName.split("\\.");
int length = split.length;
return split[length - 1];
}
}

@ -505,3 +505,4 @@ ALTER TABLE resources_training ADD COLUMN resources_training_status int(2) COMME
ALTER TABLE course_label ADD COLUMN add_type varchar(20) COMMENT '添加类型枚举AddTypeEnum'; ALTER TABLE course_label ADD COLUMN add_type varchar(20) COMMENT '添加类型枚举AddTypeEnum';
ALTER TABLE resources_question ADD COLUMN add_type varchar(20) COMMENT '添加类型枚举AddTypeEnum'; ALTER TABLE resources_question ADD COLUMN add_type varchar(20) COMMENT '添加类型枚举AddTypeEnum';
ALTER TABLE resources_info ADD COLUMN add_type varchar(20) COMMENT '添加类型枚举AddTypeEnum';

@ -12,12 +12,14 @@
<spring.boot.version>2.5.2</spring.boot.version> <spring.boot.version>2.5.2</spring.boot.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<pro.version>1.3.1</pro.version>
</properties> </properties>
<modules> <modules>
<module>admin-core</module> <module>admin-core</module>
<module>admin-console</module> <module>admin-console</module>
<module>web</module> <module>web</module>
<module>admin-test</module> <module>admin-test</module>
<module>admin-convert-pdf</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>
@ -33,18 +35,22 @@
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-core</artifactId> <artifactId>admin-core</artifactId>
<version>1.3.1</version> <version>${pro.version}</version>
</dependency> </dependency>
<!-- admin-console 包含了系统管理管理的所有功能,子系统可以不使用这部分 --> <dependency>
<groupId>com.ibeetl</groupId>
<artifactId>admin-convert-pdf</artifactId>
<version>${pro.version}</version>
</dependency> <!-- admin-console 包含了系统管理管理的所有功能,子系统可以不使用这部分 -->
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-console</artifactId> <artifactId>admin-console</artifactId>
<version>1.3.1</version> <version>${pro.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-test</artifactId> <artifactId>admin-test</artifactId>
<version>1.3.1</version> <version>${pro.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

@ -20,18 +20,19 @@
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-core</artifactId> <artifactId>admin-core</artifactId>
<version>${pro.version}</version> </dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>admin-convert-pdf</artifactId>
</dependency> </dependency>
<!-- admin-console 包含了系统管理管理的所有功能,子系统可以不使用这部分 --> <!-- admin-console 包含了系统管理管理的所有功能,子系统可以不使用这部分 -->
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-console</artifactId> <artifactId>admin-console</artifactId>
<version>${pro.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-test</artifactId> <artifactId>admin-test</artifactId>
<version>${pro.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

@ -41,6 +41,8 @@ public class FileEntity extends BaseEntity {
static{ static{
for(int i=0;i<50;i++){ for(int i=0;i<50;i++){
if(parentPath.split("web").length == 1){ if(parentPath.split("web").length == 1){
// linux的路径处理
parentPath = parentPath.replaceAll("^file:", "");
break; break;
}else { }else {
File file = new File(parentPath); File file = new File(parentPath);

@ -1,7 +1,10 @@
package com.ibeetl.jlw.entity; package com.ibeetl.jlw.entity;
import cn.jlw.validate.ValidateConfig; import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.annotation.DictEnum;
import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.jlw.enums.AddTypeEnum;
import org.beetl.sql.annotation.entity.AutoID; import org.beetl.sql.annotation.entity.AutoID;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -11,7 +14,7 @@ import javax.validation.constraints.NotNull;
* - * -
* gen by Spring Boot2 Admin 2021-06-25 * gen by Spring Boot2 Admin 2021-06-25
*/ */
public class ResourcesInfo extends BaseEntity{ public class ResourcesInfo extends BaseEntity {
//ID //ID
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
@ -47,12 +50,17 @@ public class ResourcesInfo extends BaseEntity{
//组织机构ID //组织机构ID
@Dict(type = "core_org.name.del_flag=0")
private Long orgId ; private Long orgId ;
//后台用户ID //后台用户ID
private Long userId ; private Long userId ;
// 来源类型
@DictEnum
private AddTypeEnum addType ;
public ResourcesInfo(){ public ResourcesInfo(){
} }
@ -158,4 +166,12 @@ public class ResourcesInfo extends BaseEntity{
public void setOrderIndex(String orderIndex) { public void setOrderIndex(String orderIndex) {
this.orderIndex = orderIndex; this.orderIndex = orderIndex;
} }
public AddTypeEnum getAddType() {
return addType;
}
public void setAddType(AddTypeEnum addType) {
this.addType = addType;
}
} }

@ -1,12 +1,17 @@
package com.ibeetl.jlw.web; package com.ibeetl.jlw.web;
import cn.hutool.core.io.FileUtil;
import cn.jlw.Interceptor.RFile; import cn.jlw.Interceptor.RFile;
import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.FileEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import util.convertPDF.PDFConverUtil;
import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -68,13 +73,19 @@ public class TempFileController {
//单个文件上传 //单个文件上传
@PostMapping(MODEL + "/update.do") @PostMapping(MODEL + "/update.do")
@ResponseBody @ResponseBody
public JsonResult update(@RFile FileEntity fileEntity) { public JsonResult update(@RFile FileEntity fileEntity) throws FileNotFoundException {
//数据库处理完毕后调用 文件移动 //数据库处理完毕后调用 文件移动
//绝对路径 //绝对路径
//fileEntity.moveTo("D://"); //fileEntity.moveTo("D://");
//相对路径 //相对路径
//fileEntity.moveTo("/image"); //fileEntity.moveTo("/image");
if (null != fileEntity) {
String absoluteUrl = fileEntity.getAbsoluteUrl();
BufferedInputStream inputStream = FileUtil.getInputStream(absoluteUrl);
FileOutputStream outputStream = new FileOutputStream(absoluteUrl.replaceAll("\\.[^\\.]+", ".pdf"));
PDFConverUtil.convertToPDFByFileNameSuffix(absoluteUrl, inputStream, outputStream);
}
return JsonResult.success(fileEntity); return JsonResult.success(fileEntity);
//return JsonResult.success(); //return JsonResult.success();

@ -3,6 +3,7 @@ package com.ibeetl.jlw.web.query;
import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.annotation.Query;
import com.ibeetl.admin.core.web.query.PageParam; import com.ibeetl.admin.core.web.query.PageParam;
import com.ibeetl.jlw.entity.ResourcesInfo; import com.ibeetl.jlw.entity.ResourcesInfo;
import com.ibeetl.jlw.enums.AddTypeEnum;
import static com.ibeetl.admin.core.annotation.Query.TYPE_DICT; import static com.ibeetl.admin.core.annotation.Query.TYPE_DICT;
import static com.ibeetl.admin.core.util.enums.CoreDictType.RESOURCES_INFO_TYPE; import static com.ibeetl.admin.core.util.enums.CoreDictType.RESOURCES_INFO_TYPE;
@ -30,7 +31,10 @@ public class ResourcesInfoQuery extends PageParam {
private Long orgId; private Long orgId;
@Query(name = "后台用户ID", display = false) @Query(name = "后台用户ID", display = false)
private Long userId; private Long userId;
@Query(name = "来源类型", display = false)
private AddTypeEnum addType;
@Query(name = "查看自己和系统分配的")
private Boolean seeSelf ;
private String resourcesInfoIds; private String resourcesInfoIds;
private String courseInfoIds; private String courseInfoIds;
@ -89,6 +93,7 @@ public class ResourcesInfoQuery extends PageParam {
pojo.setOrderIndex(this.getOrderIndex()); pojo.setOrderIndex(this.getOrderIndex());
pojo.setOrgId(this.getOrgId()); pojo.setOrgId(this.getOrgId());
pojo.setUserId(this.getUserId()); pojo.setUserId(this.getUserId());
pojo.setAddType(this.getAddType());
return pojo; return pojo;
} }
@ -124,4 +129,20 @@ public class ResourcesInfoQuery extends PageParam {
public void setOrderIndex(String orderIndex) { public void setOrderIndex(String orderIndex) {
this.orderIndex = orderIndex; this.orderIndex = orderIndex;
} }
public AddTypeEnum getAddType() {
return addType;
}
public void setAddType(AddTypeEnum addType) {
this.addType = addType;
}
public Boolean getSeeSelf() {
return seeSelf;
}
public void setSeeSelf(Boolean seeSelf) {
this.seeSelf = seeSelf;
}
} }

@ -32,9 +32,9 @@ queryByCondition
and t.user_id =#userId# and t.user_id =#userId#
@} @}
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){ @if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'SYSTEM_ADD' or t.user_id = #userId#) and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@} @}
and t.add_type is not null and trim(t.add_type) != ''
deleteCourseLabelByIds deleteCourseLabelByIds
=== ===
@ -101,6 +101,6 @@ getValuesByQueryNotWithPermission
and t.add_type =#addType# and t.add_type =#addType#
@} @}
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){ @if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'SYSTEM_ADD' or t.user_id = #userId#) and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@} @}
and t.add_type is not null and trim(t.add_type) != ''

@ -36,10 +36,17 @@ queryByCondition
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@if(!isEmpty(userId)){ @if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(isEmpty(seeSelf) && !isEmpty(userId)){
and t.user_id =#userId# and t.user_id =#userId#
@} @}
ORDER BY t.resources_info_id DESC @if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@}
ORDER BY t.resources_info_id DESC
deleteResourcesInfoByIds deleteResourcesInfoByIds
@ -82,10 +89,15 @@ getValuesByQuery
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@if(!isEmpty(userId)){ @if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(isEmpty(seeSelf) && !isEmpty(userId)){
and t.user_id =#userId# and t.user_id =#userId#
@} @}
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@}
getResourcesInfoValues getResourcesInfoValues
=== ===
@ -113,6 +125,9 @@ getResourcesInfoValues
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@if(!isEmpty(addType)){
and t.add_type =#addType#
@}
@if(!isEmpty(userId)){ @if(!isEmpty(userId)){
and t.user_id =#userId# and t.user_id =#userId#
@} @}

@ -85,12 +85,12 @@ queryByCondition
and t.add_type =#addType# and t.add_type =#addType#
@} @}
@if(!isEmpty(seeSelf) && seeSelf && seeSelf && !isEmpty(userId)){ @if(!isEmpty(seeSelf) && seeSelf && seeSelf && !isEmpty(userId)){
and (t.add_type = 'SYSTEM_ADD' or t.user_id = #userId#) and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@} @}
@if(!isEmpty(questionStatus)){ @if(!isEmpty(questionStatus)){
and t.question_status =#questionStatus# and t.question_status =#questionStatus#
@} @}
and t.add_type is not null and trim(t.add_type) != ''
ORDER BY t.resources_question_id DESC ORDER BY t.resources_question_id DESC
@ -170,7 +170,7 @@ getValuesByQuery
and t.add_type =#addType# and t.add_type =#addType#
@} @}
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){ @if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'SYSTEM_ADD' or t.user_id = #userId#) and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@} @}
@if(!isEmpty(resourcesApplicationId)){ @if(!isEmpty(resourcesApplicationId)){
and t.course_info_id IN (SELECT course_info_id FROM course_info WHERE course_info_parent_id IN (SELECT course_info_id FROM resources_application_course WHERE resources_application_id = #resourcesApplicationId#)) and t.course_info_id IN (SELECT course_info_id FROM course_info WHERE course_info_parent_id IN (SELECT course_info_id FROM resources_application_course WHERE resources_application_id = #resourcesApplicationId#))
@ -190,7 +190,7 @@ getValuesByQuery
ORDER BY RAND() ORDER BY RAND()
limit #judgeNum# limit #judgeNum#
@} @}
and t.add_type is not null and trim(t.add_type) != ''
getValuesByQueryNotWithPermission getValuesByQueryNotWithPermission
=== ===
@ -254,9 +254,9 @@ getValuesByQueryNotWithPermission
@if(!isEmpty(addType)){ @if(!isEmpty(addType)){
and t.add_type =#addType# and t.add_type =#addType#
@} @}
and t.add_type is not null and trim(t.add_type) != ''
@if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){ @if(!isEmpty(seeSelf) && seeSelf && !isEmpty(userId)){
and (t.add_type = 'SYSTEM_ADD' or t.user_id = #userId#) and (t.add_type = 'ADMIN_ADD' or t.user_id = #userId#)
@} @}
@if(!isEmpty(resourcesApplicationId)){ @if(!isEmpty(resourcesApplicationId)){
and t.course_info_id IN (SELECT course_info_id FROM course_info WHERE course_info_parent_id IN (SELECT course_info_id FROM resources_application_course WHERE resources_application_id = #resourcesApplicationId#)) and t.course_info_id IN (SELECT course_info_id FROM course_info WHERE course_info_parent_id IN (SELECT course_info_id FROM resources_application_course WHERE resources_application_id = #resourcesApplicationId#))

@ -103,7 +103,10 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
} }
}, },
{ {
field: 'unfinishedYD', width: 150, title: '上传院校', align: "center" field: 'addTypeText', width: 150, title: '来源', align: "center"
},
{
field: 'orgIdText', width: 150, title: '上传院校', align: "center"
}, },
{ {
field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2PPT 3PDF) field: 'resourcesInfoType', width: 150, title: '资源类型', align: "center", templet: function (d) {//(1视频 2PPT 3PDF)

Loading…
Cancel
Save