diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 7e2a33fe7..cb273afba 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -19,7 +19,7 @@ server: port: 80 servlet: # 应用的访问路径 - context-path: / + context-path: /manager tomcat: # tomcat的URI编码 uri-encoding: UTF-8 diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index f9f89b908..48c711f06 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -458,7 +458,7 @@ $.ajaxSetup({ //上传文件 -function uploadFile(async, fullPathId, fileNameId, absolutePAthId) { +function uploadFile(async, filePathId, fileNameId, absolutePAthId) { let res = -1; var formData = new FormData(); if ($('#filePath')[0].files[0] == null) { @@ -468,7 +468,7 @@ function uploadFile(async, fullPathId, fileNameId, absolutePAthId) { formData.append('fileName', $("#fileName").val()); formData.append('file', $('#filePath')[0].files[0]); $.ajax({ - url: "/common/upload", + url: ctx + "/common/upload", type: 'post', cache: false, data: formData, @@ -478,8 +478,8 @@ function uploadFile(async, fullPathId, fileNameId, absolutePAthId) { async: async, success: function(result) { if (result.code == web_status.SUCCESS) { - if (fullPathId) { - $('#' + fullPathId).val(result.url); + if (filePathId) { + $('#' + filePathId).val(result.url); } if (fileNameId) { $('#' + fileNameId).val(result.originalFilename); @@ -502,7 +502,7 @@ function uploadFile(async, fullPathId, fileNameId, absolutePAthId) { return res; } //上传文件 -function uploadMoreFile(async, fullPathId,formNameId, fileNameId, absolutePAthId) { +function uploadMoreFile(async, filePathId,formNameId, fileNameId, absolutePAthId) { let res = -1; var formData = new FormData(); if ($('#'+formNameId)[0].files[0] == null) { @@ -512,7 +512,7 @@ function uploadMoreFile(async, fullPathId,formNameId, fileNameId, absolutePAthId formData.append('fileName', $("#fileName").val()); formData.append('file', $('#'+formNameId)[0].files[0]); $.ajax({ - url: "/common/upload", + url: ctx + "/common/upload", type: 'post', cache: false, data: formData, @@ -522,8 +522,8 @@ function uploadMoreFile(async, fullPathId,formNameId, fileNameId, absolutePAthId async: async, success: function(result) { if (result.code == web_status.SUCCESS) { - if (fullPathId) { - $('#' + fullPathId).val(result.url); + if (filePathId) { + $('#' + filePathId).val(result.url); } if (fileNameId) { $('#' + fileNameId).val(result.originalFilename); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java index 47d966788..6fb9c8bd4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java @@ -6,6 +6,7 @@ import java.io.InputStream; import java.util.LinkedHashMap; import java.util.Map; import javax.servlet.Filter; +import com.ruoyi.common.constant.Constants; import org.apache.commons.io.IOUtils; import org.apache.shiro.cache.ehcache.EhCacheManager; import org.apache.shiro.codec.Base64; @@ -34,6 +35,7 @@ import com.ruoyi.framework.shiro.web.filter.sync.SyncOnlineSessionFilter; import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager; import com.ruoyi.framework.shiro.web.session.SpringSessionValidationScheduler; import at.pollux.thymeleaf.shiro.dialect.ShiroDialect; +import org.springframework.core.annotation.Order; /** * 权限配置加载 @@ -279,6 +281,9 @@ public class ShiroConfig filterChainDefinitionMap.put("/js/**", "anon"); filterChainDefinitionMap.put("/ruoyi/**", "anon"); + //上传到本地的图片允许匿名访问 + filterChainDefinitionMap.put(Constants.RESOURCE_PREFIX + "/**", "anon"); + //网站允许匿名访问 filterChainDefinitionMap.put("/home/**", "anon"); filterChainDefinitionMap.put("/images/**", "anon"); diff --git a/ruoyi-web/src/main/java/ruoyi/RuoYiServletInitializer.java b/ruoyi-web/src/main/java/com/ruoyi/RuoYiServletInitializer.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/RuoYiServletInitializer.java rename to ruoyi-web/src/main/java/com/ruoyi/RuoYiServletInitializer.java diff --git a/ruoyi-web/src/main/java/ruoyi/RuoYiWeblication.java b/ruoyi-web/src/main/java/com/ruoyi/RuoYiWeblication.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/RuoYiWeblication.java rename to ruoyi-web/src/main/java/com/ruoyi/RuoYiWeblication.java diff --git a/ruoyi-web/src/main/java/ruoyi/web/controller/common/CommonController.java b/ruoyi-web/src/main/java/com/ruoyi/web/controller/common/CommonController.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/web/controller/common/CommonController.java rename to ruoyi-web/src/main/java/com/ruoyi/web/controller/common/CommonController.java diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/controller/front/HomeController.java b/ruoyi-web/src/main/java/com/ruoyi/web/controller/front/HomeController.java new file mode 100644 index 000000000..ed2c198ca --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/controller/front/HomeController.java @@ -0,0 +1,31 @@ +package com.ruoyi.web.controller.front; + +import com.ruoyi.common.config.Global; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.web.domain.ClasssicCases; +import com.ruoyi.web.service.IClasssicCasesService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpRequest; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; + +@Controller +@RequestMapping("/home") +public class HomeController { + @Autowired + private IClasssicCasesService classsicCasesService; + /** + * 进入网站首页 + */ + @GetMapping("/index") + public String index(ModelMap mmap) { + List classsicCasesList = classsicCasesService.selectClasssicCasesList(null); + mmap.put("classsicCasesList", classsicCasesList); + return "index"; + } +} diff --git a/ruoyi-web/src/main/java/ruoyi/web/controller/tool/BuildController.java b/ruoyi-web/src/main/java/com/ruoyi/web/controller/tool/BuildController.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/web/controller/tool/BuildController.java rename to ruoyi-web/src/main/java/com/ruoyi/web/controller/tool/BuildController.java diff --git a/ruoyi-web/src/main/java/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-web/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/web/controller/tool/SwaggerController.java rename to ruoyi-web/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java diff --git a/ruoyi-web/src/main/java/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-web/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java similarity index 100% rename from ruoyi-web/src/main/java/ruoyi/web/core/config/SwaggerConfig.java rename to ruoyi-web/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/domain/ClasssicCases.java b/ruoyi-web/src/main/java/com/ruoyi/web/domain/ClasssicCases.java new file mode 100644 index 000000000..71a09555f --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/domain/ClasssicCases.java @@ -0,0 +1,145 @@ +package com.ruoyi.web.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 典型案例对象 classsic_cases + * + * @author ruoyi + * @date 2020-10-21 + */ +public class ClasssicCases extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** 标题 */ + private String title; + + /** 简介 */ + private String introduction; + + /** 详情内容 */ + private String content; + + /** 案例类型(来至于字典表) */ + private String type; + + /** 点击量 */ + private Integer hits; + + /** 图片地址(多个地址用,分隔) */ + private String pictureUrl; + + /** 状态(0正常 1停用) */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + public void setIntroduction(String introduction) + { + this.introduction = introduction; + } + + public String getIntroduction() + { + return introduction; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setHits(Integer hits) + { + this.hits = hits; + } + + public Integer getHits() + { + return hits; + } + public void setPictureUrl(String pictureUrl) + { + this.pictureUrl = pictureUrl; + } + + public String getPictureUrl() + { + return pictureUrl; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("title", getTitle()) + .append("introduction", getIntroduction()) + .append("content", getContent()) + .append("type", getType()) + .append("hits", getHits()) + .append("pictureUrl", getPictureUrl()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/mapper/ClasssicCasesMapper.java b/ruoyi-web/src/main/java/com/ruoyi/web/mapper/ClasssicCasesMapper.java new file mode 100644 index 000000000..48c9436f5 --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/mapper/ClasssicCasesMapper.java @@ -0,0 +1,33 @@ +package com.ruoyi.web.mapper; + + + +import com.ruoyi.web.domain.ClasssicCases; + +import java.util.List; + +/** + * 典型案例Mapper接口 + * + * @author ruoyi + * @date 2020-10-21 + */ +public interface ClasssicCasesMapper +{ + /** + * 查询典型案例 + * + * @param id 典型案例ID + * @return 典型案例 + */ + public ClasssicCases selectClasssicCasesById(Long id); + + /** + * 查询典型案例列表 + * + * @param classsicCases 典型案例 + * @return 典型案例集合 + */ + public List selectClasssicCasesList(ClasssicCases classsicCases); + +} diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/service/IClasssicCasesService.java b/ruoyi-web/src/main/java/com/ruoyi/web/service/IClasssicCasesService.java new file mode 100644 index 000000000..9c0793f35 --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/service/IClasssicCasesService.java @@ -0,0 +1,30 @@ +package com.ruoyi.web.service; + +import com.ruoyi.web.domain.ClasssicCases; + +import java.util.List; + +/** + * 典型案例Service接口 + * + * @author ruoyi + * @date 2020-10-21 + */ +public interface IClasssicCasesService +{ + /** + * 查询典型案例 + * + * @param id 典型案例ID + * @return 典型案例 + */ + public ClasssicCases selectClasssicCasesById(Long id); + + /** + * 查询典型案例列表 + * + * @param classsicCases 典型案例 + * @return 典型案例集合 + */ + public List selectClasssicCasesList(ClasssicCases classsicCases); +} diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/service/impl/ClasssicCasesServiceImpl.java b/ruoyi-web/src/main/java/com/ruoyi/web/service/impl/ClasssicCasesServiceImpl.java new file mode 100644 index 000000000..4875800e0 --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/service/impl/ClasssicCasesServiceImpl.java @@ -0,0 +1,46 @@ +package com.ruoyi.web.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.web.domain.ClasssicCases; +import com.ruoyi.web.mapper.ClasssicCasesMapper; +import com.ruoyi.web.service.IClasssicCasesService; + +import java.util.List; + +/** + * 典型案例Service业务层处理 + * + * @author ruoyi + * @date 2020-10-21 + */ +@Service +public class ClasssicCasesServiceImpl implements IClasssicCasesService +{ + @Autowired + private ClasssicCasesMapper classsicCasesMapper; + + /** + * 查询典型案例 + * + * @param id 典型案例ID + * @return 典型案例 + */ + @Override + public ClasssicCases selectClasssicCasesById(Long id) + { + return classsicCasesMapper.selectClasssicCasesById(id); + } + + /** + * 查询典型案例列表 + * + * @param classsicCases 典型案例 + * @return 典型案例 + */ + @Override + public List selectClasssicCasesList(ClasssicCases classsicCases) + { + return classsicCasesMapper.selectClasssicCasesList(classsicCases); + } +} diff --git a/ruoyi-web/src/main/java/ruoyi/web/controller/front/WebController.java b/ruoyi-web/src/main/java/ruoyi/web/controller/front/WebController.java deleted file mode 100644 index 409587277..000000000 --- a/ruoyi-web/src/main/java/ruoyi/web/controller/front/WebController.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.web.controller.front; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -@RequestMapping("/home") -public class WebController { - private String prefix = "home"; - /** - * 进入网站首页 - */ - @GetMapping("/index") - public String index() - { return "index"; - } -} diff --git a/ruoyi-web/src/main/resources/mapper/web/ClasssicCasesMapper.xml b/ruoyi-web/src/main/resources/mapper/web/ClasssicCasesMapper.xml new file mode 100644 index 000000000..f2547c1c0 --- /dev/null +++ b/ruoyi-web/src/main/resources/mapper/web/ClasssicCasesMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + select id, title, introduction, content, type, hits, picture_url, status, del_flag, create_by, create_time, update_by, update_time from classsic_cases + + + + + + \ No newline at end of file diff --git a/ruoyi-web/src/main/resources/templates/home/index.html b/ruoyi-web/src/main/resources/templates/home/index.html index 467d0b2a3..eed23c864 100644 --- a/ruoyi-web/src/main/resources/templates/home/index.html +++ b/ruoyi-web/src/main/resources/templates/home/index.html @@ -171,10 +171,10 @@
-