diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java b/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java index 5665537e..a16286d3 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java @@ -53,6 +53,8 @@ public class BeetlConf { @Resource SearchConditionFunction searchConditionFunction; + @Resource + SearchIsShowFunction searchIsShowFunction; @Resource DataAccessFactory dataAccessFactory; @@ -94,8 +96,8 @@ public class BeetlConf { groupTemplate.registerFunction("core.file", fileFunction); groupTemplate.registerFormat("xss", new XXSDefenderFormat()); groupTemplate.registerFunction("uuid", new UUIDFunction()); - groupTemplate.registerFunction("uuid", new UUIDFunction()); groupTemplate.registerFunction("session",sessionFunction); + groupTemplate.registerFunction("core.searchIsShow", searchIsShowFunction); groupTemplate.registerFunctionPackage("dict", dictDownQueryFunction); // 模板页面判断是否有按钮权限,比如canAccess groupTemplate.registerFunction("canAccess", (paras, ctx) -> { diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/SearchIsShowFunction.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/SearchIsShowFunction.java new file mode 100644 index 00000000..8189e0fc --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/SearchIsShowFunction.java @@ -0,0 +1,37 @@ +package com.ibeetl.admin.core.util.beetl; + +import cn.hutool.core.util.ObjectUtil; +import com.ibeetl.admin.core.annotation.Query; +import com.ibeetl.admin.core.util.AnnotationUtil; +import org.beetl.core.Context; +import org.beetl.core.Function; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; + +/** + * 根据ClassName 获取Query的数量,方便显示搜索按钮 + * @author lx + */ +@Component +public class SearchIsShowFunction implements Function { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + @Override + public Object call(Object[] objects, Context context) { + String className = (String) objects[0]; + try { + List> list = AnnotationUtil.getInstance().getAnnotations(Query.class, Class.forName(className)); + // 获取实体类中的注解,过滤属性display值为true + return ObjectUtil.isNotEmpty(list) && list.stream().anyMatch(e -> Boolean.parseBoolean(String.valueOf(e.get("display")))); + } catch (ClassNotFoundException e ) { + e.printStackTrace(); + log.error("异常信息:SearchIsShowFunction {}", e.getMessage()); + return false; + } + } +} diff --git a/admin-core/src/main/resources/codeTemplate/html/index.html b/admin-core/src/main/resources/codeTemplate/html/index.html index 5ef3c790..53857c16 100644 --- a/admin-core/src/main/resources/codeTemplate/html/index.html +++ b/admin-core/src/main/resources/codeTemplate/html/index.html @@ -7,7 +7,7 @@ diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/edit.html b/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/edit.html new file mode 100644 index 00000000..bbe6f79d --- /dev/null +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/edit.html @@ -0,0 +1,89 @@ + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ + + + + + diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/index.html b/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/index.html new file mode 100644 index 00000000..aae738a5 --- /dev/null +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseHomeworkSetting/index.html @@ -0,0 +1,29 @@ + + + +
+ + + + diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseMergeSchoolClass/index.html b/web/src/main/resources/templates/jlw/teacherOpenCourseMergeSchoolClass/index.html index 32021621..6375834e 100644 --- a/web/src/main/resources/templates/jlw/teacherOpenCourseMergeSchoolClass/index.html +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseMergeSchoolClass/index.html @@ -7,7 +7,7 @@