Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue
Conflicts:
ruoyi-ui/bin/package.bat
ruoyi-ui/package.json
ruoyi-ui/src/assets/styles/element-ui.scss
ruoyi-ui/src/layout/components/Navbar.vue
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
ruoyi-ui/src/layout/components/TagsView/index.vue
ruoyi-ui/src/router/index.js
ruoyi-ui/src/views/components/icons/element-icons.js
ruoyi-ui/src/views/dashboard/mixins/resize.js
ruoyi-ui/src/views/system/menu/index.vue
ruoyi/src/main/java/com/ruoyi/common/filter/XssFilter.java
ruoyi/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java
ruoyi/src/main/java/com/ruoyi/common/utils/text/CharsetKit.java
ruoyi/src/main/java/com/ruoyi/common/utils/text/Convert.java
ruoyi/src/main/java/com/ruoyi/common/utils/text/StrFormatter.java
ruoyi/src/main/java/com/ruoyi/framework/config/FilterConfig.java
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
ruoyi/src/main/java/com/ruoyi/project/system/mapper/SysNoticeMapper.java
ruoyi/src/main/java/com/ruoyi/project/system/service/ISysNoticeService.java
ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java
ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java
已添加4个文件
已修改19个文件
已重命名2个文件
已删除3个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ä¿¡æ¯] æå
Webå·¥ç¨ï¼çædistæä»¶ã |
| | | echo. |
| | | |
| | | %~d0 |
| | | cd %~dp0 |
| | | |
| | | cd .. |
| | | npm run build:prod |
| | | |
| | | pause |
| | |
| | | @echo off |
| | | echo. |
| | | echo [ä¿¡æ¯] æå
Webå·¥ç¨ï¼çænode_moduleså
æä»¶ã |
| | | echo [ä¿¡æ¯] å®è£
Webå·¥ç¨ï¼çænode_modulesæä»¶ã |
| | | echo. |
| | | |
| | | %~d0 |
| | |
| | | "axios": "0.18.1", |
| | | "clipboard": "2.0.4", |
| | | "echarts": "4.2.1", |
| | | "element-ui": "2.11.1", |
| | | "element-ui": "2.13.0", |
| | | "file-saver": "2.0.1", |
| | | "js-beautify": "^1.10.2", |
| | | "fuse.js": "3.4.4", |
| | |
| | | .el-range-editor.el-input__inner { |
| | | display: inline-flex !important; |
| | | } |
| | | |
| | | // to fix el-date-picker css style |
| | | .el-range-separator { |
| | | box-sizing: content-box; |
| | | } |
| | |
| | | <div class="right-menu"> |
| | | <template v-if="device!=='mobile'"> |
| | | <search id="header-search" class="right-menu-item" /> |
| | | |
| | | |
| | | <el-tooltip content="æºç å°å" effect="dark" placement="bottom"> |
| | | <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> |
| | | </el-tooltip> |
| | |
| | | <el-dropdown-item> |
| | | <span @click="setting = true">å¸å±è®¾ç½®</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided> |
| | | <span @click="logout">éåºç»å½</span> |
| | | <el-dropdown-item divided @click.native="logout"> |
| | | <span>éåºç»å½</span> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | |
| | | <template> |
| | | <div v-if="!item.hidden" class="menu-wrapper"> |
| | | <div v-if="!item.hidden"> |
| | | <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> |
| | | <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> |
| | | <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> |
| | |
| | | :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" |
| | | tag="span" |
| | | class="tags-view-item" |
| | | @click.middle.native="closeSelectedTag(tag)" |
| | | @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" |
| | | @contextmenu.prevent.native="openMenu(tag,$event)" |
| | | > |
| | | {{ tag.title }} |
| | | <span v-if="!tag.meta.affix" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" /> |
| | | <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" /> |
| | | </router-link> |
| | | </scroll-pane> |
| | | <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> |
| | | <li @click="refreshSelectedTag(selectedTag)">å·æ°é¡µé¢</li> |
| | | <li v-if="!(selectedTag.meta&&selectedTag.meta.affix)" @click="closeSelectedTag(selectedTag)">å
³éå½å</li> |
| | | <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">å
³éå½å</li> |
| | | <li @click="closeOthersTags">å
³éå
¶ä»</li> |
| | | <li @click="closeAllTags(selectedTag)">å
³éææ</li> |
| | | </ul> |
| | |
| | | isActive(route) { |
| | | return route.path === this.$route.path |
| | | }, |
| | | isAffix(tag) { |
| | | return tag.meta && tag.meta.affix |
| | | }, |
| | | filterAffixTags(routes, basePath = '/') { |
| | | let tags = [] |
| | | routes.forEach(route => { |
| | |
| | | hidden: true, |
| | | children: [ |
| | | { |
| | | path: '/redirect/:path*', |
| | | path: '/redirect/:path(.*)', |
| | | component: () => import('@/views/redirect') |
| | | } |
| | | ] |
| | |
| | | const elementIcons = [ |
| | | 'info', |
| | | 'error', |
| | | 'success', |
| | | 'warning', |
| | | 'question', |
| | | 'back', |
| | | 'arrow-left', |
| | | 'arrow-down', |
| | | 'arrow-right', |
| | | 'arrow-up', |
| | | 'caret-left', |
| | | 'caret-bottom', |
| | | 'caret-top', |
| | | 'caret-right', |
| | | 'd-arrow-left', |
| | | 'd-arrow-right', |
| | | 'minus', |
| | | 'plus', |
| | | 'remove', |
| | | 'circle-plus', |
| | | 'remove-outline', |
| | | 'circle-plus-outline', |
| | | 'close', |
| | | 'check', |
| | | 'circle-close', |
| | | 'circle-check', |
| | | 'circle-close-outline', |
| | | 'circle-check-outline', |
| | | 'zoom-out', |
| | | 'zoom-in', |
| | | 'd-caret', |
| | | 'sort', |
| | | 'sort-down', |
| | | 'sort-up', |
| | | 'tickets', |
| | | 'document', |
| | | 'goods', |
| | | 'sold-out', |
| | | 'news', |
| | | 'message', |
| | | 'date', |
| | | 'printer', |
| | | 'time', |
| | | 'bell', |
| | | 'mobile-phone', |
| | | 'service', |
| | | 'view', |
| | | 'menu', |
| | | 'more', |
| | | 'more-outline', |
| | | 'star-on', |
| | | 'star-off', |
| | | 'location', |
| | | 'location-outline', |
| | | 'phone', |
| | | 'phone-outline', |
| | | 'picture', |
| | | 'picture-outline', |
| | | 'delete', |
| | | 'search', |
| | | 'edit', |
| | | 'edit-outline', |
| | | 'rank', |
| | | 'refresh', |
| | | 'share', |
| | | 'setting', |
| | | 'upload', |
| | | 'upload2', |
| | | 'download', |
| | | 'loading' |
| | | ] |
| | | const elementIcons = ['platform-eleme', 'eleme', 'delete-solid', 'delete', 's-tools', 'setting', 'user-solid', 'user', 'phone', 'phone-outline', 'more', 'more-outline', 'star-on', 'star-off', 's-goods', 'goods', 'warning', 'warning-outline', 'question', 'info', 'remove', 'circle-plus', 'success', 'error', 'zoom-in', 'zoom-out', 'remove-outline', 'circle-plus-outline', 'circle-check', 'circle-close', 's-help', 'help', 'minus', 'plus', 'check', 'close', 'picture', 'picture-outline', 'picture-outline-round', 'upload', 'upload2', 'download', 'camera-solid', 'camera', 'video-camera-solid', 'video-camera', 'message-solid', 'bell', 's-cooperation', 's-order', 's-platform', 's-fold', 's-unfold', 's-operation', 's-promotion', 's-home', 's-release', 's-ticket', 's-management', 's-open', 's-shop', 's-marketing', 's-flag', 's-comment', 's-finance', 's-claim', 's-custom', 's-opportunity', 's-data', 's-check', 's-grid', 'menu', 'share', 'd-caret', 'caret-left', 'caret-right', 'caret-bottom', 'caret-top', 'bottom-left', 'bottom-right', 'back', 'right', 'bottom', 'top', 'top-left', 'top-right', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'd-arrow-left', 'd-arrow-right', 'video-pause', 'video-play', 'refresh', 'refresh-right', 'refresh-left', 'finished', 'sort', 'sort-up', 'sort-down', 'rank', 'loading', 'view', 'c-scale-to-original', 'date', 'edit', 'edit-outline', 'folder', 'folder-opened', 'folder-add', 'folder-remove', 'folder-delete', 'folder-checked', 'tickets', 'document-remove', 'document-delete', 'document-copy', 'document-checked', 'document', 'document-add', 'printer', 'paperclip', 'takeaway-box', 'search', 'monitor', 'attract', 'mobile', 'scissors', 'umbrella', 'headset', 'brush', 'mouse', 'coordinate', 'magic-stick', 'reading', 'data-line', 'data-board', 'pie-chart', 'data-analysis', 'collection-tag', 'film', 'suitcase', 'suitcase-1', 'receiving', 'collection', 'files', 'notebook-1', 'notebook-2', 'toilet-paper', 'office-building', 'school', 'table-lamp', 'house', 'no-smoking', 'smoking', 'shopping-cart-full', 'shopping-cart-1', 'shopping-cart-2', 'shopping-bag-1', 'shopping-bag-2', 'sold-out', 'sell', 'present', 'box', 'bank-card', 'money', 'coin', 'wallet', 'discount', 'price-tag', 'news', 'guide', 'male', 'female', 'thumb', 'cpu', 'link', 'connection', 'open', 'turn-off', 'set-up', 'chat-round', 'chat-line-round', 'chat-square', 'chat-dot-round', 'chat-dot-square', 'chat-line-square', 'message', 'postcard', 'position', 'turn-off-microphone', 'microphone', 'close-notification', 'bangzhu', 'time', 'odometer', 'crop', 'aim', 'switch-button', 'full-screen', 'copy-document', 'mic', 'stopwatch', 'medal-1', 'medal', 'trophy', 'trophy-1', 'first-aid-kit', 'discover', 'place', 'location', 'location-outline', 'location-information', 'add-location', 'delete-location', 'map-location', 'alarm-clock', 'timer', 'watch-1', 'watch', 'lock', 'unlock', 'key', 'service', 'mobile-phone', 'bicycle', 'truck', 'ship', 'basketball', 'football', 'soccer', 'baseball', 'wind-power', 'light-rain', 'lightning', 'heavy-rain', 'sunrise', 'sunrise-1', 'sunset', 'sunny', 'cloudy', 'partly-cloudy', 'cloudy-and-sunny', 'moon', 'moon-night', 'dish', 'dish-1', 'food', 'chicken', 'fork-spoon', 'knife-fork', 'burger', 'tableware', 'sugar', 'dessert', 'ice-cream', 'hot-water', 'water-cup', 'coffee-cup', 'cold-drink', 'goblet', 'goblet-full', 'goblet-square', 'goblet-square-full', 'refrigerator', 'grape', 'watermelon', 'cherry', 'apple', 'pear', 'orange', 'coffee', 'ice-tea', 'ice-drink', 'milk-tea', 'potato-strips', 'lollipop', 'ice-cream-square', 'ice-cream-round'] |
| | | |
| | | export default elementIcons |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | $_sidebarElm: null |
| | | $_sidebarElm: null, |
| | | $_resizeHandler: null |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$_initResizeEvent() |
| | | this.$_initSidebarResizeEvent() |
| | | }, |
| | | beforeDestroy() { |
| | | this.$_destroyResizeEvent() |
| | | this.$_destroySidebarResizeEvent() |
| | | this.initListener() |
| | | }, |
| | | activated() { |
| | | this.$_initResizeEvent() |
| | | this.$_initSidebarResizeEvent() |
| | | if (!this.$_resizeHandler) { |
| | | // avoid duplication init |
| | | this.initListener() |
| | | } |
| | | |
| | | // when keep-alive chart activated, auto resize |
| | | this.resize() |
| | | }, |
| | | beforeDestroy() { |
| | | this.destroyListener() |
| | | }, |
| | | deactivated() { |
| | | this.$_destroyResizeEvent() |
| | | this.$_destroySidebarResizeEvent() |
| | | this.destroyListener() |
| | | }, |
| | | methods: { |
| | | $_resizeHandler() { |
| | | return debounce(() => { |
| | | if (this.chart) { |
| | | this.chart.resize() |
| | | } |
| | | }, 100)() |
| | | }, |
| | | $_initResizeEvent() { |
| | | window.addEventListener('resize', this.$_resizeHandler) |
| | | }, |
| | | $_destroyResizeEvent() { |
| | | window.removeEventListener('resize', this.$_resizeHandler) |
| | | }, |
| | | // use $_ for mixins properties |
| | | // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential |
| | | $_sidebarResizeHandler(e) { |
| | | if (e.propertyName === 'width') { |
| | | this.$_resizeHandler() |
| | | } |
| | | }, |
| | | $_initSidebarResizeEvent() { |
| | | initListener() { |
| | | this.$_resizeHandler = debounce(() => { |
| | | this.resize() |
| | | }, 100) |
| | | window.addEventListener('resize', this.$_resizeHandler) |
| | | |
| | | this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] |
| | | this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) |
| | | }, |
| | | $_destroySidebarResizeEvent() { |
| | | destroyListener() { |
| | | window.removeEventListener('resize', this.$_resizeHandler) |
| | | this.$_resizeHandler = null |
| | | |
| | | this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) |
| | | }, |
| | | resize() { |
| | | const { chart } = this |
| | | chart && chart.resize() |
| | | } |
| | | } |
| | | } |
| | |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | <el-button size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:menu:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-plus" |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-plus" |
| | | @click="handleAdd(scope.row)" |
| | | v-hasPermi="['system:menu:add']" |
| | | >æ°å¢</el-button> |
| | |
| | | ], |
| | | orderNum: [ |
| | | { required: true, message: "èå顺åºä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | path: [ |
| | | { required: true, message: "è·¯ç±å°åä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ] |
| | | } |
| | | }; |
| | |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.Filter; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.FilterConfig; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * Repeatable è¿æ»¤å¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatableFilter implements Filter |
| | | { |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | ServletRequest requestWrapper = null; |
| | | if (request instanceof HttpServletRequest) |
| | | { |
| | | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); |
| | | } |
| | | if (null == requestWrapper) |
| | | { |
| | | chain.doFilter(request, response); |
| | | } |
| | | else |
| | | { |
| | | chain.doFilter(requestWrapper, response); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import javax.servlet.ReadListener; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import com.ruoyi.common.utils.http.HttpHelper; |
| | | |
| | | /** |
| | | * æå»ºå¯éå¤è¯»åinputStreamçrequest |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper |
| | | { |
| | | private final byte[] body; |
| | | |
| | | public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException |
| | | { |
| | | super(request); |
| | | request.setCharacterEncoding("UTF-8"); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | |
| | | body = HttpHelper.getBodyString(request).getBytes("UTF-8"); |
| | | } |
| | | |
| | | @Override |
| | | public BufferedReader getReader() throws IOException |
| | | { |
| | | return new BufferedReader(new InputStreamReader(getInputStream())); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() throws IOException |
| | | { |
| | | |
| | | final ByteArrayInputStream bais = new ByteArrayInputStream(body); |
| | | |
| | | return new ServletInputStream() |
| | | { |
| | | |
| | | @Override |
| | | public int read() throws IOException |
| | | { |
| | | return bais.read(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFinished() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener readListener) |
| | | { |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
ÎļþÃû´Ó ruoyi/src/main/java/com/ruoyi/common/xss/XssFilter.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.common.xss; |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
ÎļþÃû´Ó ruoyi/src/main/java/com/ruoyi/common/xss/XssHttpServletRequestWrapper.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.common.xss; |
| | | package com.ruoyi.common.filter; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.nio.charset.Charset; |
| | | import javax.servlet.ServletRequest; |
| | | import org.apache.commons.lang.exception.ExceptionUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * éç¨httpå·¥å
·å°è£
|
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpHelper |
| | | { |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); |
| | | |
| | | public static String getBodyString(ServletRequest request) |
| | | { |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | BufferedReader reader = null; |
| | | try (InputStream inputStream = request.getInputStream()) |
| | | { |
| | | reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); |
| | | String line = ""; |
| | | while ((line = reader.readLine()) != null) |
| | | { |
| | | sb.append(line); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.warn("getBodyStringåºç°é®é¢ï¼"); |
| | | } |
| | | finally |
| | | { |
| | | if (reader != null) |
| | | { |
| | | try |
| | | { |
| | | reader.close(); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.error(ExceptionUtils.getFullStackTrace(e)); |
| | | } |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import com.ruoyi.common.filter.RepeatableFilter; |
| | | import com.ruoyi.common.filter.XssFilter; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.xss.XssFilter; |
| | | |
| | | /** |
| | | * Filteré
ç½® |
| | |
| | | registration.setFilter(new XssFilter()); |
| | | registration.addUrlPatterns(StringUtils.split(urlPatterns, ",")); |
| | | registration.setName("xssFilter"); |
| | | registration.setOrder(Integer.MAX_VALUE); |
| | | registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); |
| | | Map<String, String> initParameters = new HashMap<String, String>(); |
| | | initParameters.put("excludes", excludes); |
| | | initParameters.put("enabled", enabled); |
| | | registration.setInitParameters(initParameters); |
| | | return registration; |
| | | } |
| | | |
| | | @SuppressWarnings({ "rawtypes", "unchecked" }) |
| | | @Bean |
| | | public FilterRegistrationBean someFilterRegistration() |
| | | { |
| | | FilterRegistrationBean registration = new FilterRegistrationBean(); |
| | | registration.setFilter(new RepeatableFilter()); |
| | | registration.addUrlPatterns("/*"); |
| | | registration.setName("repeatableFilter"); |
| | | registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE); |
| | | return registration; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.filter.RepeatedlyRequestWrapper; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpHelper; |
| | | import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | |
| | | /** |
| | | * å¤æè¯·æ±urlåæ°æ®æ¯å¦åä¸ä¸æ¬¡ç¸åï¼ |
| | | * å¤æè¯·æ±urlåæ°æ®æ¯å¦åä¸ä¸æ¬¡ç¸åï¼ |
| | | * 妿å䏿¬¡ç¸åï¼åæ¯éå¤æäº¤è¡¨åã æææ¶é´ä¸º10ç§å
ã |
| | | * |
| | | * @author ruoyi |
| | |
| | | |
| | | public final String REPEAT_TIME = "repeatTime"; |
| | | |
| | | public final String SESSION_REPEAT_KEY = "repeatData"; |
| | | public final String CACHE_REPEAT_KEY = "repeatData"; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * é´éæ¶é´ï¼åä½:ç§ é»è®¤10ç§ |
| | |
| | | @Override |
| | | public boolean isRepeatSubmit(HttpServletRequest request) |
| | | { |
| | | // æ¬æ¬¡åæ°åç³»ç»æ¶é´ |
| | | String nowParams = JSONObject.toJSONString(request.getParameterMap()); |
| | | RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; |
| | | String nowParams = HttpHelper.getBodyString(repeatedlyRequest); |
| | | |
| | | // bodyåæ°ä¸ºç©ºï¼è·åParameterçæ°æ® |
| | | if (StringUtils.isEmpty(nowParams)) |
| | | { |
| | | nowParams = JSONObject.toJSONString(request.getParameterMap()); |
| | | } |
| | | Map<String, Object> nowDataMap = new HashMap<String, Object>(); |
| | | nowDataMap.put(REPEAT_PARAMS, nowParams); |
| | | nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); |
| | |
| | | // 请æ±å°åï¼ä½ä¸ºåæ¾sessionçkeyå¼ï¼ |
| | | String url = request.getRequestURI(); |
| | | |
| | | HttpSession session = request.getSession(); |
| | | Object sessionObj = session.getAttribute(SESSION_REPEAT_KEY); |
| | | Object sessionObj = redisCache.getCacheObject(CACHE_REPEAT_KEY); |
| | | if (sessionObj != null) |
| | | { |
| | | Map<String, Object> sessionMap = (Map<String, Object>) sessionObj; |
| | |
| | | } |
| | | } |
| | | } |
| | | Map<String, Object> sessionMap = new HashMap<String, Object>(); |
| | | sessionMap.put(url, nowDataMap); |
| | | session.setAttribute(SESSION_REPEAT_KEY, sessionMap); |
| | | Map<String, Object> cacheMap = new HashMap<String, Object>(); |
| | | cacheMap.put(url, nowDataMap); |
| | | redisCache.setCacheObject(CACHE_REPEAT_KEY, cacheMap, intervalTime, TimeUnit.SECONDS); |
| | | return false; |
| | | } |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| | | @Log(title = "éç¥å
Œ", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeId}") |
| | | public AjaxResult remove(@PathVariable Long noticeId) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) |
| | | { |
| | | return toAjax(noticeService.deleteNoticeById(noticeId)); |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
| | |
| | | * @param noticeIds éè¦å é¤çå
ŒID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteNoticeByIds(Long noticeIds); |
| | | public int deleteNoticeByIds(Long[] noticeIds); |
| | | } |
| | |
| | | * @param noticeIds éè¦å é¤çå
ŒID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteNoticeByIds(Long noticeIds); |
| | | public int deleteNoticeByIds(Long[] noticeIds); |
| | | } |
| | |
| | | * @param noticeIds éè¦å é¤çå
ŒID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteNoticeByIds(Long noticeIds) |
| | | public int deleteNoticeByIds(Long[] noticeIds) |
| | | { |
| | | return noticeMapper.deleteNoticeByIds(noticeIds); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.text.Convert; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.common.utils.text.Convert; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.project.tool.gen.domain.GenTableColumn; |
| | | import com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper; |
| | | |
| | |
| | | if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) |
| | | { |
| | | String[] searchList = StringUtils.split(tablePrefix, ","); |
| | | String[] replacementList = emptyList(searchList.length); |
| | | tableName = StringUtils.replaceEach(tableName, searchList, replacementList); |
| | | tableName = replaceFirst(tableName, searchList); |
| | | } |
| | | return StringUtils.convertToCamelCase(tableName); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ¿æ¢åç¼ |
| | | * |
| | | * @param replacementm æ¿æ¢å¼ |
| | | * @param searchList æ¿æ¢å表 |
| | | * @return |
| | | */ |
| | | public static String replaceFirst(String replacementm, String[] searchList) |
| | | { |
| | | String text = replacementm; |
| | | for (String searchString : searchList) |
| | | { |
| | | if (replacementm.startsWith(searchString)) |
| | | { |
| | | text = replacementm.replaceFirst(searchString, ""); |
| | | break; |
| | | } |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å空æ°ç»å表 |
| | | * |
| | | * @param length é¿åº¦ |
| | | * @return æ°ç»ä¿¡æ¯ |
| | | */ |
| | | public static String[] emptyList(int length) |
| | | { |
| | | String[] values = new String[length]; |
| | | for (int i = 0; i < length; i++) |
| | | { |
| | | values[i] = StringUtils.EMPTY; |
| | | } |
| | | return values; |
| | | } |
| | | } |