Browse Source

feat: 添加获取通知公告接口

pangqijun 8 months ago
parent
commit
1da21a0959

+ 16 - 2
src/main/java/org/springblade/modules/api/controller/CommonController.java

@@ -17,6 +17,8 @@
 package org.springblade.modules.api.controller;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -26,15 +28,17 @@ import lombok.SneakyThrows;
 import org.springblade.common.cache.ParamCache;
 import org.springblade.common.constant.CacheBizConstant;
 import org.springblade.common.constant.CommonConstant;
-import org.springblade.common.enums.YesOrNoEnum;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.base.BaseEntity;
 import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.SmsTemplate;
 import org.springblade.core.sms.model.SmsCode;
 import org.springblade.core.sms.model.SmsData;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.modules.desk.entity.Notice;
+import org.springblade.modules.desk.service.INoticeService;
 import org.springblade.modules.mall.entity.CategoryInfo;
 import org.springblade.modules.mall.service.ICategoryInfoService;
 import org.springblade.modules.platform.entity.Ads;
@@ -72,6 +76,7 @@ public class CommonController extends BladeController {
 	private final IArticleService articleService;
 	private final SmsBuilder smsBuilder;
 	private final BladeRedis bladeRedis;
+	private final INoticeService noticeService;
 
 	@GetMapping("/payments-list")
 	@ApiOperationSupport(order = 1)
@@ -124,4 +129,13 @@ public class CommonController extends BladeController {
 		return R.data(articleService.getById(id));
 	}
 
+	@ApiOperation("获取通知公告")
+	@ApiOperationSupport(order = 6)
+	@GetMapping("notice")
+	public R<List<Notice>> getNotice(@ApiParam(value = "类型 1-小程序公告 2-商家端公告", required = true)  @RequestParam Integer type) {
+		IPage<Notice> page = noticeService.page(Condition.getPage(new Query()), Wrappers.lambdaQuery(Notice.class)
+				.eq(Notice::getCategory, type).eq(BaseEntity::getStatus, 1));
+		return R.data(page.getRecords());
+	}
+
 }

+ 0 - 2
src/main/java/org/springblade/modules/desk/entity/Notice.java

@@ -59,6 +59,4 @@ public class Notice extends TenantEntity {
 	 */
 	@ApiModelProperty(value = "内容")
 	private String content;
-
-
 }

+ 37 - 37
src/main/resources/application.yml

@@ -55,43 +55,43 @@ spring:
         session-stat-enable: true
         session-stat-max-count: 10
   #单机部署不需要开启此配置
-  quartz:
-    #相关属性配置
-    properties:
-      #quartz集群配置
-      org:
-        quartz:
-          # 1、Configure 调度器属性
-          scheduler:
-            instanceName: DefaultQuartzScheduler
-            #ID设置为自动获取 每一个必须不同
-            instanceId: AUTO
-          # 2、Configure JobStore
-          jobStore:
-            # 信息保存时间 默认值60秒
-            misfireThreshold: 60000
-            #数据保存方式为数据库持久化
-            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
-            #数据库代理类,一般org.quartz.impl.jdbcjobstore.StdJDBCDelegate可以满足大部分数据库
-            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-            #表的前缀,默认QRTZ_
-            tablePrefix: QRTZ_
-            #是否加入集群
-            isClustered: true
-            #调度实例失效的检查时间间隔
-            clusterCheckinInterval: 10000
-            useProperties: false
-          # 3、Configure ThreadPool
-          threadPool:
-            #线程池的实现类(一般使用SimpleThreadPool即可满足几乎所有用户的需求)
-            class: org.quartz.simpl.SimpleThreadPool
-            #指定线程数,至少为1(无默认值)(一般设置为1-100直接的整数合适)
-            threadCount: 10
-            #设置线程的优先级(最大为java.lang.Thread.MAX_PRIORITY 10,最小为Thread.MIN_PRIORITY 1,默认为5)
-            threadPriority: 5
-            threadsInheritContextClassLoaderOfInitializingThread: true
-    #数据库方式
-    job-store-type: jdbc
+#  quartz:
+#    #相关属性配置
+#    properties:
+#      #quartz集群配置
+#      org:
+#        quartz:
+#          # 1、Configure 调度器属性
+#          scheduler:
+#            instanceName: DefaultQuartzScheduler
+#            #ID设置为自动获取 每一个必须不同
+#            instanceId: AUTO
+#          # 2、Configure JobStore
+#          jobStore:
+#            # 信息保存时间 默认值60秒
+#            misfireThreshold: 60000
+#            #数据保存方式为数据库持久化
+#            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
+#            #数据库代理类,一般org.quartz.impl.jdbcjobstore.StdJDBCDelegate可以满足大部分数据库
+#            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+#            #表的前缀,默认QRTZ_
+#            tablePrefix: QRTZ_
+#            #是否加入集群
+#            isClustered: true
+#            #调度实例失效的检查时间间隔
+#            clusterCheckinInterval: 10000
+#            useProperties: false
+#          # 3、Configure ThreadPool
+#          threadPool:
+#            #线程池的实现类(一般使用SimpleThreadPool即可满足几乎所有用户的需求)
+#            class: org.quartz.simpl.SimpleThreadPool
+#            #指定线程数,至少为1(无默认值)(一般设置为1-100直接的整数合适)
+#            threadCount: 10
+#            #设置线程的优先级(最大为java.lang.Thread.MAX_PRIORITY 10,最小为Thread.MIN_PRIORITY 1,默认为5)
+#            threadPriority: 5
+#            threadsInheritContextClassLoaderOfInitializingThread: true
+#    #数据库方式
+#    job-store-type: jdbc
 
 
 # mybatis