bihuisong 7 ヶ月 前
コミット
27beda4b91

+ 8 - 1
zhjq-admin/src/main/java/com/zhjq/web/controller/system/SysNoticeController.java

@@ -39,7 +39,6 @@ public class SysNoticeController extends BaseController {
     /**
      * 根据通知公告编号获取详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{noticeId}")
     public AjaxResult getInfo(@PathVariable Long noticeId) {
         return success(noticeService.selectNoticeById(noticeId));
@@ -76,4 +75,12 @@ public class SysNoticeController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] noticeIds) {
         return toAjax(noticeService.deleteNoticeByIds(noticeIds));
     }
+
+    /**
+     * 小程序获取通知公告列表
+     */
+    @GetMapping("/appList")
+    public AjaxResult appList(@RequestParam(value = "limit", defaultValue = "2") int limit) {
+        return AjaxResult.success(noticeService.selectNoticeListApp(limit));
+    }
 }

+ 45 - 0
zhjq-system/src/main/java/com/zhjq/system/domain/SysNotice.java

@@ -4,9 +4,11 @@ import com.zhjq.common.core.domain.BaseEntity;
 import com.zhjq.common.xss.Xss;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+import java.util.Date;
 
 /**
  * 通知公告表 sys_notice
@@ -41,6 +43,22 @@ public class SysNotice extends BaseEntity {
      */
     private String status;
 
+    /**
+     * 是否置顶(0是 1否)
+     */
+    private String isTop;
+
+    /**
+     * 作者
+     */
+    private String author;
+
+    /**
+     * 发布时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date releaseTime;
+
     public Long getNoticeId() {
         return noticeId;
     }
@@ -84,6 +102,30 @@ public class SysNotice extends BaseEntity {
         this.status = status;
     }
 
+    public String getIsTop() {
+        return isTop;
+    }
+
+    public void setIsTop(String isTop) {
+        this.isTop = isTop;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public Date getReleaseTime() {
+        return releaseTime;
+    }
+
+    public void setReleaseTime(Date releaseTime) {
+        this.releaseTime = releaseTime;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -92,6 +134,9 @@ public class SysNotice extends BaseEntity {
                 .append("noticeType", getNoticeType())
                 .append("noticeContent", getNoticeContent())
                 .append("status", getStatus())
+                .append("isTop", getIsTop())
+                .append("author", getAuthor())
+                .append("releaseTime", getReleaseTime())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())

+ 9 - 0
zhjq-system/src/main/java/com/zhjq/system/mapper/SysNoticeMapper.java

@@ -1,6 +1,7 @@
 package com.zhjq.system.mapper;
 
 import com.zhjq.system.domain.SysNotice;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -57,4 +58,12 @@ public interface SysNoticeMapper {
      * @return 结果
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+    /**
+     * 小程序查询公告列表
+     *
+     * @param limit 查询条数
+     * @return 公告集合
+     */
+    public List<SysNotice> selectNoticeListApp(@Param("limit") int limit);
 }

+ 8 - 0
zhjq-system/src/main/java/com/zhjq/system/service/ISysNoticeService.java

@@ -57,4 +57,12 @@ public interface ISysNoticeService {
      * @return 结果
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+    /**
+     * 小程序查询公告列表
+     *
+     * @param limit 查询条数
+     * @return 公告集合
+     */
+    public List<SysNotice> selectNoticeListApp(int limit);
 }

+ 11 - 0
zhjq-system/src/main/java/com/zhjq/system/service/impl/SysNoticeServiceImpl.java

@@ -83,4 +83,15 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
     public int deleteNoticeByIds(Long[] noticeIds) {
         return noticeMapper.deleteNoticeByIds(noticeIds);
     }
+
+    /**
+     * 小程序查询公告列表
+     *
+     * @param limit 查询条数
+     * @return 公告集合
+     */
+    @Override
+    public List<SysNotice> selectNoticeListApp(int limit) {
+        return noticeMapper.selectNoticeListApp(limit);
+    }
 }

+ 24 - 0
zhjq-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -10,6 +10,9 @@
         <result property="noticeType" column="notice_type"/>
         <result property="noticeContent" column="notice_content"/>
         <result property="status" column="status"/>
+        <result property="isTop" column="is_top"/>
+        <result property="author" column="author"/>
+        <result property="releaseTime" column="release_time"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
@@ -23,6 +26,9 @@
                notice_type,
                cast(notice_content as char) as notice_content,
                status,
+               is_top,
+               author,
+               release_time,
                create_by,
                create_time,
                update_by,
@@ -60,6 +66,9 @@
         <if test="noticeType != null and noticeType != '' ">notice_type,</if>
         <if test="noticeContent != null and noticeContent != '' ">notice_content,</if>
         <if test="status != null and status != '' ">status,</if>
+        <if test="isTop != null">is_top,</if>
+        <if test="author != null">author,</if>
+        <if test="releaseTime != null">release_time,</if>
         <if test="remark != null and remark != ''">remark,</if>
         <if test="createBy != null and createBy != ''">create_by,</if>
         create_time
@@ -68,6 +77,9 @@
         <if test="noticeType != null and noticeType != ''">#{noticeType},</if>
         <if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
         <if test="status != null and status != ''">#{status},</if>
+        <if test="isTop != null">#{isTop},</if>
+        <if test="author != null">#{author},</if>
+        <if test="releaseTime != null">#{releaseTime},</if>
         <if test="remark != null and remark != ''">#{remark},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
         sysdate()
@@ -81,6 +93,9 @@
             <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
             <if test="noticeContent != null">notice_content = #{noticeContent},</if>
             <if test="status != null and status != ''">status = #{status},</if>
+            <if test="isTop != null">is_top = #{isTop},</if>
+            <if test="author != null">author = #{author},</if>
+            <if test="releaseTime != null">release_time = #{releaseTime},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
         </set>
@@ -100,4 +115,13 @@
         </foreach>
     </delete>
 
+    <select id="selectNoticeListApp" parameterType="SysNotice" resultMap="SysNoticeResult">
+        <include refid="selectNoticeVo"/>
+        where status = 0
+        ORDER BY
+        is_top desc,release_time desc
+        <if test="limit != null and limit != ''">
+            limit #{limit}
+        </if>
+    </select>
 </mapper>

+ 46 - 5
zhjq-ui/src/views/system/notice/index.vue

@@ -79,10 +79,15 @@
           <dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
         </template>
       </el-table-column>
-      <el-table-column align="center" label="创建者" prop="createBy" width="100"/>
-      <el-table-column align="center" label="创建时间" prop="createTime" width="100">
+      <el-table-column align="center" label="是否置顶" prop="isTop" width="100">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+          <dict-tag :options="dict.type.sys_notice_top" :value="scope.row.isTop"/>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="发布人" prop="author" width="100"/>
+      <el-table-column align="center" label="发布时间" prop="releaseTime" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
       <el-table-column align="center" class-name="small-padding fixed-width" label="操作">
@@ -137,7 +142,34 @@
             </el-form-item>
           </el-col>
           <el-col :span="24">
-            <el-form-item label="内容">
+            <el-form-item label="是否置顶">
+              <el-radio-group v-model="form.isTop">
+                <el-radio
+                  v-for="dict in dict.type.sys_notice_top"
+                  :key="dict.value"
+                  :label="dict.value"
+                >{{ dict.label }}
+                </el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="发布人" prop="author">
+              <el-input v-model="form.author" placeholder="请输入发布人"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="发布时间" prop="releaseTime">
+              <el-date-picker
+                style="width: 290px"
+                v-model="form.releaseTime"
+                type="date"
+                placeholder="请选择发布时间">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="内容" prop="noticeContent">
               <editor v-model="form.noticeContent" :min-height="192"/>
             </el-form-item>
           </el-col>
@@ -156,7 +188,7 @@ import {addNotice, delNotice, getNotice, listNotice, updateNotice} from "@/api/s
 
 export default {
   name: "Notice",
-  dicts: ['sys_notice_status', 'sys_notice_type'],
+  dicts: ['sys_notice_status', 'sys_notice_type', 'sys_notice_top'],
   data() {
     return {
       // 遮罩层
@@ -192,6 +224,15 @@ export default {
         noticeTitle: [
           {required: true, message: "公告标题不能为空", trigger: "blur"}
         ],
+        author: [
+          {required: true, message: "发布人不能为空", trigger: "blur"}
+        ],
+        releaseTime: [
+          {required: true, message: "发布时间不能为空", trigger: "change"}
+        ],
+        noticeContent: [
+          {required: true, message: "内容不能为空", trigger: "blur"}
+        ],
       }
     };
   },

+ 37 - 22
zhjq-ui/src/views/system/voice/index.vue

@@ -117,28 +117,43 @@
     <!-- 添加或修改景点播报对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="景点名称" prop="voiceName">
-          <el-input v-model="form.voiceName" placeholder="请输入景点名称"/>
-        </el-form-item>
-        <el-form-item label="语音文件" prop="voiceUrl">
-          <voice-upload v-model="form.voiceUrl"/>
-        </el-form-item>
-        <el-form-item label="作者" prop="author">
-          <el-input v-model="form.author" placeholder="请输入作者"/>
-        </el-form-item>
-        <el-form-item label="发布时间" prop="releaseTime">
-          <el-date-picker
-            v-model="form.releaseTime"
-            type="date"
-            placeholder="请选择发布时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="排序" prop="sort">
-          <el-input-number :min="1" v-model="value" placeholder="请输入排序"/>
-        </el-form-item>
-        <el-form-item label="内容" prop="content">
-          <editor style="height: 300px" label="富文本控件" v-model="form.content"/>
-        </el-form-item>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="景点名称" prop="voiceName">
+              <el-input v-model="form.voiceName" placeholder="请输入景点名称"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="作者" prop="author">
+              <el-input v-model="form.author" placeholder="请输入作者"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="语音文件" prop="voiceUrl">
+              <voice-upload v-model="form.voiceUrl"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="发布时间" prop="releaseTime">
+              <el-date-picker
+                style="width: 400px"
+                v-model="form.releaseTime"
+                type="date"
+                placeholder="请选择发布时间">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="排序" prop="sort">
+              <el-input-number :min="1" v-model="value" placeholder="请输入排序"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="内容" prop="content">
+              <editor style="height: 280px" label="富文本控件" v-model="form.content"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>