lchao hace 5 meses
padre
commit
1bd8ff48a4

+ 21 - 5
qmjszx-admin/src/main/java/beilv/web/controller/system/SysNoticeController.java

@@ -6,11 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import beilv.common.annotation.Log;
 import beilv.common.core.controller.BaseController;
 import beilv.common.core.domain.AjaxResult;
@@ -53,6 +49,7 @@ public class SysNoticeController extends BaseController
         return getDataTable(list);
     }
 
+
     /**
      * 新增公告
      */
@@ -110,6 +107,13 @@ public class SysNoticeController extends BaseController
         mmap.put("notice", noticeService.selectNoticeById(noticeId));
         return prefix + "/view";
     }
+    /**
+     * 小程序查询公告详细
+     */
+    @GetMapping(value = "/{noticeId}")
+    public AjaxResult getInfo(@PathVariable Long noticeId) {
+        return success(noticeService.selectNoticeById(noticeId));
+    }
 
     /**
      * 删除公告
@@ -122,4 +126,16 @@ public class SysNoticeController extends BaseController
     {
         return toAjax(noticeService.deleteNoticeByIds(ids));
     }
+
+
+    /**
+     * 小程序获取通知公告列表
+     */
+    @GetMapping("/appList")
+    public TableDataInfo appList(SysNotice notice)
+    {
+        startPage();
+        List<SysNotice> list = noticeService.selectNoticeListApp(notice);
+        return getDataTable(list);
+    }
 }

+ 40 - 40
qmjszx-admin/src/main/resources/templates/system/mall/add.html

@@ -11,21 +11,21 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label is-required">商品名称:</label>
                 <div class="col-sm-8">
-                    <input name="goodsName" class="form-control" type="text" required>
+                    <input name="goodsName" class="form-control" type="text" maxlength="15" required>
                 </div>
             </div>
         </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label is-required" >商品条码:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsCode" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">商品条码:</label>
-                <div class="col-sm-8">
-                    <input name="goodsCode" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">商品种类:</label>
+                <label class="col-sm-3 control-label ">商品种类:</label>
                 <div class="col-sm-8">
                     <select name="goodsType" class="form-control" th:with="type=${@dict.getType('goods_type')}">
                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
@@ -33,14 +33,14 @@
                 </div>
             </div>
         </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">计量单位:</label>
-                <div class="col-sm-8">
-                    <input name="goodsUnit" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label is-required">计量单位:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsUnit" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
                 <label class="col-sm-3 control-label">时价商品:</label>
@@ -53,39 +53,39 @@
         </div>
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">销售单价:</label>
-                <div class="col-sm-8">
-                    <input name="salePrice" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">建议售价:</label>
-                <div class="col-sm-8">
-                    <input name="suggestionPrice" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">商品库存:</label>
+                <label class="col-sm-3 control-label is-required">销售单价:</label>
                 <div class="col-sm-8">
-                    <input name="goodsInventory" class="form-control" type="text">
+                    <input name="salePrice" class="form-control" type="text" maxlength="15" required>
                 </div>
             </div>
         </div>
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">库存成本:</label>
+                <label class="col-sm-3 control-label is-required">建议售价:</label>
                 <div class="col-sm-8">
-                    <input name="inventoryCost" class="form-control" type="text">
+                    <input name="suggestionPrice" class="form-control" type="text" required maxlength="15">
                 </div>
             </div>
         </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label is-required">商品库存:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsInventory" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label is-required">库存成本:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="inventoryCost" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">商品状态(正常/禁用):</label>
+                <label class="col-sm-3 control-label">商品状态:</label>
                 <div class="col-sm-8">
                     <select name="goodsState" class="form-control" th:with="type=${@dict.getType('sys_normal_disable')}">
                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
@@ -108,7 +108,7 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">商品说明:</label>
                 <div class="col-sm-8">
-                    <textarea name="goodsDescribe" class="form-control" type="text"></textarea>
+                    <textarea name="goodsDescribe" class="form-control" type="text" maxlength="200"></textarea>
                 </div>
             </div>
         </div>

+ 39 - 39
qmjszx-admin/src/main/resources/templates/system/mall/edit.html

@@ -12,18 +12,18 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label is-required">商品名称:</label>
                 <div class="col-sm-8">
-                    <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" required>
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">商品条码:</label>
-                <div class="col-sm-8">
-                    <input name="goodsCode" th:field="*{goodsCode}" class="form-control" type="text">
+                    <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" maxlength="15" required>
                 </div>
             </div>
         </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label">商品条码:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsCode" th:field="*{goodsCode}" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
                 <label class="col-sm-3 control-label">商品种类:</label>
@@ -34,14 +34,14 @@
                 </div>
             </div>
         </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">计量单位:</label>
-                <div class="col-sm-8">
-                    <input name="goodsUnit" th:field="*{goodsUnit}" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label">计量单位:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsUnit" th:field="*{goodsUnit}" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
                 <label class="col-sm-3 control-label">时价商品:</label>
@@ -54,39 +54,39 @@
         </div>
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">销售单价:</label>
-                <div class="col-sm-8">
-                    <input name="salePrice" th:field="*{salePrice}" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">建议售价:</label>
-                <div class="col-sm-8">
-                    <input name="suggestionPrice" th:field="*{suggestionPrice}" class="form-control" type="text">
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12">
-            <div class="form-group">
-                <label class="col-sm-3 control-label">商品库存:</label>
+                <label class="col-sm-3 control-label is-required">销售单价:</label>
                 <div class="col-sm-8">
-                    <input name="goodsInventory" th:field="*{goodsInventory}" class="form-control" type="text">
+                    <input name="salePrice" th:field="*{salePrice}" class="form-control" type="text" maxlength="15" required>
                 </div>
             </div>
         </div>
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">库存成本:</label>
+                <label class="col-sm-3 control-label is-required">建议售价:</label>
                 <div class="col-sm-8">
-                    <input name="inventoryCost" th:field="*{inventoryCost}" class="form-control" type="text">
+                    <input name="suggestionPrice" th:field="*{suggestionPrice}" class="form-control" type="text" maxlength="15" required>
                 </div>
             </div>
         </div>
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label">商品库存:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="goodsInventory" th:field="*{goodsInventory}" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--        <div class="col-xs-12">-->
+<!--            <div class="form-group">-->
+<!--                <label class="col-sm-3 control-label">库存成本:</label>-->
+<!--                <div class="col-sm-8">-->
+<!--                    <input name="inventoryCost" th:field="*{inventoryCost}" class="form-control" type="text" required>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">商品状态(正常/禁用):</label>
+                <label class="col-sm-3 control-label">商品状态:</label>
                 <div class="col-sm-8">
                     <select name="goodsState" class="form-control" th:with="type=${@dict.getType('sys_normal_disable')}">
                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsState}"></option>
@@ -109,7 +109,7 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">商品说明:</label>
                 <div class="col-sm-8">
-                    <textarea name="goodsDescribe"  class="form-control" type="text">[[*{goodsDescribe}]]</textarea>
+                    <textarea name="goodsDescribe"  class="form-control" type="text" maxlength="200">[[*{goodsDescribe}]]</textarea>
                 </div>
             </div>
         </div>

+ 25 - 25
qmjszx-admin/src/main/resources/templates/system/mall/mall.html

@@ -27,12 +27,12 @@
                 <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:mall:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:mall:edit">
-                    <i class="fa fa-edit"></i> 修改
-                </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:mall:remove">
-                    <i class="fa fa-remove"></i> 删除
-                </a>
+<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:mall:edit">-->
+<!--                    <i class="fa fa-edit"></i> 修改-->
+<!--                </a>-->
+<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:mall:remove">-->
+<!--                    <i class="fa fa-remove"></i> 删除-->
+<!--                </a>-->
 <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:mall:export">-->
 <!--                    <i class="fa fa-download"></i> 导出-->
 <!--                </a>-->
@@ -58,7 +58,7 @@
                 updateUrl: prefix + "/edit/{id}",
                 removeUrl: prefix + "/remove",
                 exportUrl: prefix + "/export",
-                modalName: "商",
+                modalName: "商",
                 columns: [{
                     checkbox: true
                 },
@@ -71,10 +71,10 @@
                     field: 'goodsName',
                     title: '商品名称'
                 },
-                {
-                    field: 'goodsCode',
-                    title: '商品条码'
-                },
+                // {
+                //     field: 'goodsCode',
+                //     title: '商品条码'
+                // },
                 {
                     field: 'goodsType',
                     title: '商品种类',
@@ -92,11 +92,11 @@
                     title: '商品说明',
                     visible: false
                 },
-                {
-                    field: 'goodsUnit',
-                    title: '计量单位',
-                    visible: false
-                },
+                // {
+                //     field: 'goodsUnit',
+                //     title: '计量单位',
+                //     visible: false
+                // },
                 {
                     field: 'goodsCurrentPrice',
                     title: '时价商品',
@@ -113,15 +113,15 @@
                     title: '建议售价',
                     visible: false
                 },
-                {
-                    field: 'goodsInventory',
-                    title: '商品库存'
-                },
-                {
-                    field: 'inventoryCost',
-                    title: '库存成本',
-                    visible: false
-                },
+                // {
+                //     field: 'goodsInventory',
+                //     title: '商品库存'
+                // },
+                // {
+                //     field: 'inventoryCost',
+                //     title: '库存成本',
+                //     visible: false
+                // },
                 {
                     field: 'goodsState',
                     title: '商品状态',

+ 10 - 5
qmjszx-admin/src/main/resources/templates/system/member/exchange.html

@@ -11,17 +11,17 @@
         <input name="id" th:field="*{id}" type="hidden">
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">消耗积分:</label>
+                <label class="col-sm-3 control-label is-required">消耗积分:</label>
                 <div class="col-sm-8">
-                    <input name="integral" th:field="*{integral}" class="form-control" type="text">
+                    <input name="integral" th:field="*{integral}" class="form-control" type="text" required>
                 </div>
             </div>
         </div>
         <div class="col-xs-12">
             <div class="form-group">
-                <label class="col-sm-3 control-label">礼品名称:</label>
+                <label class="col-sm-3 control-label is-required">礼品名称:</label>
                 <div class="col-sm-8">
-                    <input name="giftName" th:field="*{giftName}" class="form-control" type="text">
+                    <input name="giftName" th:field="*{giftName}" class="form-control" type="text" required>
                 </div>
             </div>
         </div>
@@ -33,7 +33,12 @@
 <script th:inline="javascript">
     var prefix = ctx + "system/member"
     $("#form-member-exchange").validate({
-        focusCleanup: true
+        focusCleanup: true,
+        rules:{
+            sort:{
+                digits:true
+            },
+        },
     });
 
     function submitHandler() {

+ 1 - 1
qmjszx-admin/src/main/resources/templates/system/member/member.html

@@ -60,7 +60,7 @@
                 removeUrl: prefix + "/remove",
                 exportUrl: prefix + "/export",
                 exchangeUrl: prefix + "/exchange/{id}",
-                modalName: "会员用户信息",
+                modalName: "礼品",
                 columns: [{
                     checkbox: true
                 },

+ 20 - 1
qmjszx-admin/src/main/resources/templates/system/notice/add.html

@@ -14,6 +14,12 @@
 				</div>
 			</div>
 			<div class="form-group">
+				<label class="col-sm-2 control-label is-required">排序:</label>
+				<div class="col-sm-10">
+					<input id="sort" name="sort" class="form-control" type="text" required>
+				</div>
+			</div>
+			<div class="form-group">
 				<label class="col-sm-2 control-label">公告类型:</label>
 				<div class="col-sm-10">
 					<select name="noticeType" class="form-control m-b" th:with="type=${@dict.getType('sys_notice_type')}">
@@ -21,6 +27,14 @@
 	                </select>
 				</div>
 			</div>
+			<div class="form-group">
+				<label class="col-sm-2 control-label">置顶:</label>
+				<div class="col-sm-10">
+					<select name="topped" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
+						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+					</select>
+				</div>
+			</div>
 			<div class="form-group">	
 				<label class="col-sm-2 control-label">公告内容:</label>
 				<div class="col-sm-10">
@@ -83,7 +97,12 @@
 	    }
 		
 		$("#form-notice-add").validate({
-			focusCleanup: true
+			focusCleanup: true,
+			rules:{
+				sort:{
+					digits:true
+				},
+			},
 		});
 		
 		function submitHandler() {

+ 20 - 1
qmjszx-admin/src/main/resources/templates/system/notice/edit.html

@@ -15,6 +15,12 @@
                 </div>
             </div>
             <div class="form-group">
+                <label class="col-sm-2 control-label is-required">排序:</label>
+                <div class="col-sm-10">
+                    <input id="sort" name="sort" th:field="*{sort}" class="form-control" type="text" required>
+                </div>
+            </div>
+            <div class="form-group">
 				<label class="col-sm-2 control-label">公告类型:</label>
 				<div class="col-sm-10">
 					<select name="noticeType" class="form-control m-b" th:with="type=${@dict.getType('sys_notice_type')}">
@@ -22,6 +28,14 @@
 	                </select>
 				</div>
 			</div>
+            <div class="form-group">
+                <label class="col-sm-2 control-label">置顶:</label>
+                <div class="col-sm-10">
+                    <select name="topped" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
+                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{topped}"></option>
+                    </select>
+                </div>
+            </div>
             <div class="form-group">	
                 <label class="col-sm-2 control-label">公告内容:</label>
                 <div class="col-sm-10">
@@ -88,7 +102,12 @@
 	    }
 	    
 		$("#form-notice-edit").validate({
-			focusCleanup: true
+			focusCleanup: true,
+            rules:{
+                sort:{
+                    digits:true
+                },
+            },
 		});
 		
 		function submitHandler() {

+ 136 - 111
qmjszx-admin/src/main/resources/templates/system/notice/notice.html

@@ -1,121 +1,146 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
-	<th:block th:include="include :: header('通知公告列表')" />
+    <th:block th:include="include :: header('通知公告列表')"/>
 </head>
 <body class="gray-bg">
-    <div class="container-div">
-		<div class="row">
-			<div class="col-sm-12 search-collapse">
-				<form id="notice-form">
-					<div class="select-list">
-						<ul>
-							<li>
-								公告标题:<input type="text" name="noticeTitle"/>
-							</li>
-							<li>
-								操作人员:<input type="text" name="createBy"/>
-							</li>
-							<li>
-								公告类型:<select name="noticeType" th:with="type=${@dict.getType('sys_notice_type')}">
-									<option value="">所有</option>
-									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
-								</select>
-							</li>
-							<li>
-								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
-								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
-							</li>
-						</ul>
-					</div>
-				</form>
-			</div>
-			
-	        <div class="btn-group-sm" id="toolbar" role="group">
-		        <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="system:notice:add">
-		            <i class="fa fa-plus"></i> 新增
-		        </a>
-		        <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" shiro:hasPermission="system:notice:edit">
-		            <i class="fa fa-edit"></i> 修改
-		        </a>
-		        <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:notice:remove">
-		            <i class="fa fa-remove"></i> 删除
-		        </a>
-	        </div>
-	        
-	        <div class="col-sm-12 select-table table-striped">
-	            <table id="bootstrap-table"></table>
-	        </div>
-    	</div>
+<div class="container-div">
+    <div class="row">
+        <div class="col-sm-12 search-collapse">
+            <form id="notice-form">
+                <div class="select-list">
+                    <ul>
+                        <li>
+                            公告标题:<input type="text" name="noticeTitle"/>
+                        </li>
+<!--                        <li>-->
+<!--                            操作人员:<input type="text" name="createBy"/>-->
+<!--                        </li>-->
+                        <li>
+                            公告类型:<select name="noticeType" th:with="type=${@dict.getType('sys_notice_type')}">
+                            <option value="">所有</option>
+                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
+                                    th:value="${dict.dictValue}"></option>
+                        </select>
+                        </li>
+                        <li>
+                            置顶:<select name="topped" th:with="type=${@dict.getType('sys_yes_no')}">
+                            <option value="">所有</option>
+                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
+                                    th:value="${dict.dictValue}"></option>
+                        </select>
+                        </li>
+                        <li>
+                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
+                                    class="fa fa-search"></i>&nbsp;搜索</a>
+                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
+                                    class="fa fa-refresh"></i>&nbsp;重置</a>
+                        </li>
+                    </ul>
+                </div>
+            </form>
+        </div>
+
+        <div class="btn-group-sm" id="toolbar" role="group">
+            <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="system:notice:add">
+                <i class="fa fa-plus"></i> 新增
+            </a>
+            <a class="btn btn-primary single disabled" onclick="$.operate.editFull()"
+               shiro:hasPermission="system:notice:edit">
+                <i class="fa fa-edit"></i> 修改
+            </a>
+            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
+               shiro:hasPermission="system:notice:remove">
+                <i class="fa fa-remove"></i> 删除
+            </a>
+        </div>
+
+        <div class="col-sm-12 select-table table-striped">
+            <table id="bootstrap-table"></table>
+        </div>
     </div>
-    <th:block th:include="include :: footer" />
-    <script th:inline="javascript">
-        var editFlag = [[${@permission.hasPermi('system:notice:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('system:notice:remove')}]];
-        var types = [[${@dict.getType('sys_notice_type')}]];
-        var datas = [[${@dict.getType('sys_notice_status')}]];
-        var prefix = ctx + "system/notice";
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var editFlag = [[${@permission.hasPermi('system:notice:edit')}]];
+    var removeFlag = [[${@permission.hasPermi('system:notice:remove')}]];
+    var types = [[${@dict.getType('sys_notice_type')}]];
+    var datas = [[${@dict.getType('sys_notice_status')}]];
+    var topDatas = [[${@dict.getType('sys_yes_no')}]];
+    var prefix = ctx + "system/notice";
 
-        $(function() {
-            var options = {
-                url: prefix + "/list",
-                viewUrl: prefix + "/view/{id}",
-                createUrl: prefix + "/add",
-                updateUrl: prefix + "/edit/{id}",
-                removeUrl: prefix + "/remove",
-                modalName: "公告",
-                columns: [{
-		            checkbox: true
-		        },
-				{
-					field : 'noticeId', 
-					title : '序号' 
-				},
-				{
-		            field: 'noticeTitle',
-		            title: '公告标题',
-		            formatter: function (value, row, index) {
-		                return '<a href="javascript:void(0)" onclick="$.operate.view(\'' + row.noticeId + '\')">' + value + '</a>';
-		            }
-		        },
-				{
-		            field: 'noticeType',
-		            title: '公告类型',
-		            align: 'center',
-		            formatter: function(value, row, index) {
-		            	return $.table.selectDictLabel(types, value);
-		            }
-		        },
-				{
-		            field: 'status',
-		            title: '状态',
-		            align: 'center',
-		            formatter: function(value, row, index) {
-		            	return $.table.selectDictLabel(datas, value);
-		            }
-		        },
-				{
-					field : 'createBy', 
-					title : '创建者' 
-				},
-				{
-		            field: 'createTime',
-		            title: '创建时间',
-		            sortable: true
-		        },
-		        {
-		            title: '操作',
-		            align: 'center',
-		            formatter: function(value, row, index) {
-		            	var actions = [];
-		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.noticeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+    $(function () {
+        var options = {
+            url: prefix + "/list",
+            viewUrl: prefix + "/view/{id}",
+            createUrl: prefix + "/add",
+            updateUrl: prefix + "/edit/{id}",
+            removeUrl: prefix + "/remove",
+            modalName: "公告",
+            columns: [{
+                checkbox: true
+            },
+                {
+                    field: 'noticeId',
+                    title: '序号'
+                },
+                {
+                    field: 'noticeTitle',
+                    title: '公告标题',
+                    formatter: function (value, row, index) {
+                        return '<a href="javascript:void(0)" onclick="$.operate.view(\'' + row.noticeId + '\')">' + value + '</a>';
+                    }
+                },
+                {
+                    field: 'sort',
+                    title: '排序'
+                },
+                {
+                    field: 'noticeType',
+                    title: '公告类型',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        return $.table.selectDictLabel(types, value);
+                    }
+                },
+                {
+                    field: 'topped',
+                    title: '置顶',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        return $.table.selectDictLabel(topDatas, value);
+                    }
+                },
+                {
+                    field: 'status',
+                    title: '状态',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        return $.table.selectDictLabel(datas, value);
+                    }
+                },
+                {
+                    field: 'createBy',
+                    title: '创建者'
+                },
+                {
+                    field: 'createTime',
+                    title: '创建时间',
+                    sortable: true
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.noticeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.noticeId + '\')"><i class="fa fa-remove"></i>删除</a>');
-						return actions.join('');
-		            }
-		        }]
-            };
-            $.table.init(options);
-        });
-    </script>
+                        return actions.join('');
+                    }
+                }]
+        };
+        $.table.init(options);
+    });
+</script>
 </body>
 </html>

+ 14 - 0
qmjszx-system/src/main/java/beilv/system/domain/SysNotice.java

@@ -2,16 +2,21 @@ package beilv.system.domain;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import beilv.common.core.domain.BaseEntity;
 import beilv.common.xss.Xss;
 
+import java.util.Date;
+
 /**
  * 通知公告表 sys_notice
  * 
  * @author ruoyi
  */
+@Data
 public class SysNotice extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -31,6 +36,15 @@ public class SysNotice extends BaseEntity
     /** 公告状态(0正常 1关闭) */
     private String status;
 
+    /** 是否置顶 */
+    private String topped;
+
+    /** 排序 */
+    private String sort;
+
+    /** 发布时间 */
+    private Date releaseTime;
+
     public Long getNoticeId()
     {
         return noticeId;

+ 4 - 0
qmjszx-system/src/main/java/beilv/system/mapper/SysNoticeMapper.java

@@ -49,4 +49,8 @@ public interface SysNoticeMapper
      * @return 结果
      */
     public int deleteNoticeByIds(String[] noticeIds);
+
+    List<SysNotice> selectNoticeListApp(SysNotice notice);
+
+    List<SysNotice> getTopNotice(SysNotice notice);
 }

+ 2 - 0
qmjszx-system/src/main/java/beilv/system/service/ISysNoticeService.java

@@ -49,4 +49,6 @@ public interface ISysNoticeService
      * @return 结果
      */
     public int deleteNoticeByIds(String ids);
+
+    List<SysNotice> selectNoticeListApp(SysNotice notice);
 }

+ 20 - 0
qmjszx-system/src/main/java/beilv/system/service/impl/SysNoticeServiceImpl.java

@@ -1,7 +1,10 @@
 package beilv.system.service.impl;
 
 import java.util.List;
+
+import beilv.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.stereotype.Service;
 import beilv.common.core.text.Convert;
 import beilv.system.domain.SysNotice;
@@ -53,6 +56,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
     @Override
     public int insertNotice(SysNotice notice)
     {
+        notice.setReleaseTime(DateUtils.getNowDate());
         return noticeMapper.insertNotice(notice);
     }
 
@@ -65,6 +69,16 @@ public class SysNoticeServiceImpl implements ISysNoticeService
     @Override
     public int updateNotice(SysNotice notice)
     {
+        notice.setReleaseTime(DateUtils.getNowDate());
+//        List<SysNotice> top = noticeMapper.getTopNotice(notice);
+//        if (top != null && !top.isEmpty() && notice.getTopped().equals("Y")) {
+//            // 已有置顶记录,且新的置顶状态为 "Y" 但不是同一个记录
+//            boolean isSameNotice = top.stream()
+//                    .anyMatch(existingNotice -> existingNotice.getNoticeId().equals(notice.getNoticeId()));
+//            if (!isSameNotice) {
+//                throw new DataIntegrityViolationException("已有置顶公告,请修改状态再进行设置");
+//            }
+//        }
         return noticeMapper.updateNotice(notice);
     }
 
@@ -79,4 +93,10 @@ public class SysNoticeServiceImpl implements ISysNoticeService
     {
         return noticeMapper.deleteNoticeByIds(Convert.toStrArray(ids));
     }
+
+    @Override
+    public List<SysNotice> selectNoticeListApp(SysNotice notice)
+    {
+        return noticeMapper.selectNoticeListApp(notice);
+    }
 }

+ 119 - 55
qmjszx-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -1,85 +1,149 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="beilv.system.mapper.SysNoticeMapper">
-    
+
     <resultMap type="SysNotice" id="SysNoticeResult">
-        <result property="noticeId"       column="notice_id"       />
-        <result property="noticeTitle"    column="notice_title"    />
-        <result property="noticeType"     column="notice_type"     />
-        <result property="noticeContent"  column="notice_content"  />
-        <result property="status"         column="status"          />
-        <result property="createBy"       column="create_by"       />
-        <result property="createTime"     column="create_time"     />
-        <result property="updateBy"       column="update_by"       />
-        <result property="updateTime"     column="update_time"     />
-        <result property="remark"         column="remark"          />
+        <result property="noticeId" column="notice_id"/>
+        <result property="noticeTitle" column="notice_title"/>
+        <result property="noticeType" column="notice_type"/>
+        <result property="noticeContent" column="notice_content"/>
+        <result property="status" column="status"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+        <result property="topped" column="topped"/>
+        <result property="sort" column="sort"/>
+        <result property="releaseTime" column="release_time"/>
     </resultMap>
-    
+
     <sql id="selectNoticeVo">
-        select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark 
-		from sys_notice
+        select notice_id,
+               notice_title,
+               notice_type,
+               cast(notice_content as char) as notice_content,
+               status,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark,
+               topped,
+               sort,
+               release_time
+        from sys_notice
     </sql>
-    
+
     <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
         <include refid="selectNoticeVo"/>
         where notice_id = #{noticeId}
     </select>
-    
+
     <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
         <include refid="selectNoticeVo"/>
         <where>
-			<if test="noticeTitle != null and noticeTitle != ''">
-				AND notice_title like concat('%', #{noticeTitle}, '%')
-			</if>
-			<if test="noticeType != null and noticeType != ''">
-				AND notice_type = #{noticeType}
-			</if>
-			<if test="createBy != null and createBy != ''">
-				AND create_by like concat('%', #{createBy}, '%')
-			</if>
-		</where>
+            <if test="noticeTitle != null and noticeTitle != ''">
+                AND notice_title like concat('%', #{noticeTitle}, '%')
+            </if>
+            <if test="noticeType != null and noticeType != ''">
+                AND notice_type = #{noticeType}
+            </if>
+            <if test="createBy != null and createBy != ''">
+                AND create_by like concat('%', #{createBy}, '%')
+            </if>
+            <if test="topped != null and topped != ''">
+                AND topped = #{topped}
+            </if>
+        </where>
+        ORDER BY
+        topped DESC,
+        sort ASC,
+        release_time DESC
     </select>
-    
+
     <insert id="insertNotice" parameterType="SysNotice">
         insert into sys_notice (
-			<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
-			<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="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
-			<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
-			<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="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
-		)
+        <if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
+        <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="remark != null and remark != ''">remark,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="topped != null and topped != ''">topped,</if>
+        <if test="sort != null and sort != ''">sort,</if>
+        <if test="releaseTime != null">release_time,</if>
+        create_time
+        )values(
+        <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
+        <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="remark != null and remark != ''">#{remark},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="topped != null and topped != ''">#{topped},</if>
+        <if test="sort != null and sort != ''">#{sort},</if>
+        <if test="releaseTime != null">#{releaseTime},</if>
+        sysdate()
+        )
     </insert>
-	 
+
     <update id="updateNotice" parameterType="SysNotice">
-        update sys_notice 
+        update sys_notice
         <set>
-            <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
-            <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="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
+            <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="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+            <if test="topped != null and topped != ''">topped = #{topped},</if>
+            <if test="sort != null and sort != ''">sort = #{sort},</if>
+            <if test="releaseTime != null">release_time = #{releaseTime},</if>
+            update_time = sysdate()
         </set>
         where notice_id = #{noticeId}
     </update>
-	
+
     <delete id="deleteNoticeByIds" parameterType="String">
-        delete from sys_notice where notice_id in 
+        delete from sys_notice where notice_id in
         <foreach item="noticeId" collection="array" open="(" separator="," close=")">
             #{noticeId}
         </foreach>
     </delete>
-    
+
+    <select id="selectNoticeListApp" parameterType="SysNotice" resultMap="SysNoticeResult">
+        SELECT
+            notice_id,
+            notice_title,
+            notice_type,
+            cast( notice_content AS CHAR ) AS notice_content,
+            STATUS,
+            create_by,
+            create_time,
+            update_by,
+            update_time,
+            remark,
+            topped,
+            sort,
+            release_time
+        FROM
+            sys_notice
+        WHERE
+            1 = 1
+        ORDER BY
+            topped DESC,
+            sort ASC,
+            release_time DESC
+    </select>
+
+    <select id="getTopNotice" parameterType="SysNotice" resultMap="SysNoticeResult">
+        SELECT
+      *
+        FROM
+            sys_notice
+        WHERE topped = 'Y'
+    </select>
+
 </mapper>