diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java index ff4f2f0..04288f8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java @@ -75,7 +75,7 @@ public class HomeController { @GetMapping("/home") public String home(ModelMap mmap) { //最新通知 - List urlList = noticeService.selectNoticeHomeUrl(new SysNotice()); + List urlList = workService.selectWorkHomeUrl(new SysWork()); mmap.put("urlList", urlList); List list = noticeService.selectNoticeHomeList(new SysNotice()); mmap.put("noticeList", list); @@ -132,7 +132,7 @@ public class HomeController { @GetMapping("/base.html") public String base(ModelMap mmap) { //最新通知 - List urlList = noticeService.selectNoticeHomeUrl(new SysNotice()); + List urlList = workService.selectWorkHomeUrl(new SysWork()); mmap.put("urlList", urlList); List list = noticeService.selectNoticeHomeList(new SysNotice()); mmap.put("noticeList", list); diff --git a/ruoyi-admin/src/main/resources/templates/home/base.html b/ruoyi-admin/src/main/resources/templates/home/base.html index 56f5272..c4621ed 100644 --- a/ruoyi-admin/src/main/resources/templates/home/base.html +++ b/ruoyi-admin/src/main/resources/templates/home/base.html @@ -396,7 +396,7 @@ diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/add.html b/ruoyi-admin/src/main/resources/templates/system/notice/add.html index ce0704a..f8809d0 100644 --- a/ruoyi-admin/src/main/resources/templates/system/notice/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/notice/add.html @@ -30,22 +30,7 @@
-
- -
-
-
-
- - 选择图片 - 更改 - - - - 清除 -
-
-
+

@@ -127,33 +112,7 @@ $.operate.save(prefix + "/add", $('#form-notice-add').serialize()); } } - //图片上传 - $('#noticeUrlId').on('change.bs.fileinput ', function (e) { - // 处理自己的业务 - var file = e.target.files[0]; - var data = new FormData(); - data.append("file", file); - $.ajax({ - type: "POST", - url: ctx + "common/upload", - data: data, - cache: false, - contentType: false, - processData: false, - dataType: 'json', - success: function(result) { - if (result.code == web_status.SUCCESS) { - $("#noticeUrl").val(result.url); - } else { - $.modal.alertError(result.msg); - } - }, - error: function(error) { - $.modal.alertWarning("图片上传失败。"); - } - }); - }); //文件上传 $('#fileUrlId').on('change.bs.fileinput ', function (e) { // 处理自己的业务 diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/edit.html b/ruoyi-admin/src/main/resources/templates/system/notice/edit.html index f8e6289..f1f49b5 100644 --- a/ruoyi-admin/src/main/resources/templates/system/notice/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/notice/edit.html @@ -31,25 +31,6 @@
-
- -
-
-
- -
-
-
- - 选择图片 - 更改 - - - - 清除 -
-
-
@@ -137,33 +118,7 @@ $.operate.save(prefix + "/edit", $('#form-notice-edit').serialize()); } } - //图片上传 - $('#noticeUrlId').on('change.bs.fileinput ', function (e) { - // 处理自己的业务 - var file = e.target.files[0]; - var data = new FormData(); - data.append("file", file); - $.ajax({ - type: "POST", - url: ctx + "common/upload", - data: data, - cache: false, - contentType: false, - processData: false, - dataType: 'json', - success: function(result) { - if (result.code == web_status.SUCCESS) { - $("#noticeUrl").val(result.url); - } else { - $.modal.alertError(result.msg); - } - }, - error: function(error) { - $.modal.alertWarning("图片上传失败。"); - } - }); - }); //文件上传 $('#fileUrlId').on('change.bs.fileinput ', function (e) { // 处理自己的业务 diff --git a/ruoyi-admin/src/main/resources/templates/system/work/add.html b/ruoyi-admin/src/main/resources/templates/system/work/add.html index 4f992b5..20f96c9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/work/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/work/add.html @@ -21,6 +21,23 @@
+ +
+ +
+
+
+
+ + 选择图片 + 更改 + + + + 清除 +
+
+

@@ -103,6 +120,35 @@ } } + + //图片上传 + $('#imgUrlId').on('change.bs.fileinput ', function (e) { + // 处理自己的业务 + var file = e.target.files[0]; + var data = new FormData(); + data.append("file", file); + $.ajax({ + type: "POST", + url: ctx + "common/upload", + data: data, + cache: false, + contentType: false, + processData: false, + dataType: 'json', + success: function(result) { + if (result.code == web_status.SUCCESS) { + $("#imgUrl").val(result.url); + } else { + $.modal.alertError(result.msg); + } + }, + error: function(error) { + $.modal.alertWarning("图片上传失败。"); + } + }); + + }); + //文件上传 $('#fileUrlId').on('change.bs.fileinput ', function (e) { // 处理自己的业务 diff --git a/ruoyi-admin/src/main/resources/templates/system/work/edit.html b/ruoyi-admin/src/main/resources/templates/system/work/edit.html index d0b8a48..363b166 100644 --- a/ruoyi-admin/src/main/resources/templates/system/work/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/work/edit.html @@ -22,6 +22,25 @@
+
+ +
+
+
+ +
+
+
+ + 选择图片 + 更改 + + + + 清除 +
+
+

@@ -107,6 +126,34 @@ $.operate.save(prefix + "/edit", $('#form-work-edit').serialize()); } } + + //图片上传 + $('#imgUrlId').on('change.bs.fileinput ', function (e) { + // 处理自己的业务 + var file = e.target.files[0]; + var data = new FormData(); + data.append("file", file); + $.ajax({ + type: "POST", + url: ctx + "common/upload", + data: data, + cache: false, + contentType: false, + processData: false, + dataType: 'json', + success: function(result) { + if (result.code == web_status.SUCCESS) { + $("#imgUrl").val(result.url); + } else { + $.modal.alertError(result.msg); + } + }, + error: function(error) { + $.modal.alertWarning("图片上传失败。"); + } + }); + }); + //文件上传 $('#fileUrlId').on('change.bs.fileinput ', function (e) { // 处理自己的业务 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysWork.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysWork.java index 7548deb..a271cef 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysWork.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysWork.java @@ -40,6 +40,9 @@ public class SysWork extends BaseEntity { /** 文件地址 */ private String fileName; + /** 首页图片*/ + private String imgUrl; + public String getWorkId() @@ -116,6 +119,14 @@ public class SysWork extends BaseEntity { return fileName; } + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -131,6 +142,7 @@ public class SysWork extends BaseEntity { .append("type", getType()) .append("fileUrl",getFileUrl()) .append("fileName",getFileName()) + .append("imgUrl",getImgUrl()) .toString(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysWorkMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysWorkMapper.java index 7c757a3..a07d9a8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysWorkMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysWorkMapper.java @@ -58,4 +58,12 @@ public interface SysWorkMapper { * @return 公告集合 */ public List selectSysWorkHomeList(SysWork work); + + /** + * 查询工作列表 + * + * @param work 工作信息 + * @return 公告集合 + */ + public List selectWorkHomeUrl(SysWork work); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysWorkService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysWorkService.java index 8d2cddd..078b8d5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysWorkService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysWorkService.java @@ -59,4 +59,12 @@ public interface ISysWorkService { */ public List selectSysWorkHomeList(SysWork work); + /** + * 查询工作列表 + * + * @param work 工作信息 + * @return 公告集合 + */ + public List selectWorkHomeUrl(SysWork work); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysWorkServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysWorkServiceImpl.java index 1373338..f476d69 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysWorkServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysWorkServiceImpl.java @@ -89,4 +89,17 @@ public class SysWorkServiceImpl implements ISysWorkService { { return workMapper.selectSysWorkHomeList(work); } + + + /** + * 查询工作列表 + * + * @param work 工作信息 + * @return 工作集合 + */ + @Override + public List selectWorkHomeUrl(SysWork work) + { + return workMapper.selectWorkHomeUrl(work); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysWorkMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysWorkMapper.xml index 1bbed53..e3140a7 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysWorkMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysWorkMapper.xml @@ -17,10 +17,11 @@ + - select work_id, work_title, work_content, status, create_by, create_time, update_by, update_time, remark,type,file_url,file_name + select work_id, work_title, work_content, status, create_by, create_time, update_by, update_time, remark,type,file_url,file_name,img_url from sys_work @@ -56,6 +57,7 @@ type, file_url, file_name, + img_url, create_time )values( #{workId}, @@ -67,6 +69,7 @@ #{type}, #{fileUrl}, #{fileName}, + #{imgUrl}, now() ) @@ -80,6 +83,7 @@ update_by = #{updateBy}, file_url = #{fileUrl}, file_name = #{fileName}, + img_url = #{imgUrl}, update_time = now() where work_id = #{workId} @@ -106,4 +110,15 @@ order by create_time desc limit 10 + + \ No newline at end of file