diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java deleted file mode 100644 index 67d76ee0b..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -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.PutMapping; -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.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.system.domain.SysPost; -import com.ruoyi.system.service.ISysPostService; - -/** - * 岗位信息操作处理 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/system/post") -public class SysPostController extends BaseController -{ - @Autowired - private ISysPostService postService; - - /** - * 获取岗位列表 - */ - @PreAuthorize("@ss.hasPermi('system:post:list')") - @GetMapping("/list") - public TableDataInfo list(SysPost post) - { - startPage(); - List list = postService.selectPostList(post); - return getDataTable(list); - } - - @Log(title = "岗位管理", businessType = BusinessType.EXPORT) - @PreAuthorize("@ss.hasPermi('system:post:export')") - @GetMapping("/export") - public AjaxResult export(SysPost post) - { - List list = postService.selectPostList(post); - ExcelUtil util = new ExcelUtil(SysPost.class); - return util.exportExcel(list, "岗位数据"); - } - - /** - * 根据岗位编号获取详细信息 - */ - @PreAuthorize("@ss.hasPermi('system:post:query')") - @GetMapping(value = "/{postId}") - public AjaxResult getInfo(@PathVariable Long postId) - { - return AjaxResult.success(postService.selectPostById(postId)); - } - - /** - * 新增岗位 - */ - @PreAuthorize("@ss.hasPermi('system:post:add')") - @Log(title = "岗位管理", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@Validated @RequestBody SysPost post) - { - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { - return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); - } - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { - return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); - } - post.setCreateBy(SecurityUtils.getUsername()); - return toAjax(postService.insertPost(post)); - } - - /** - * 修改岗位 - */ - @PreAuthorize("@ss.hasPermi('system:post:edit')") - @Log(title = "岗位管理", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@Validated @RequestBody SysPost post) - { - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { - return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); - } - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { - return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); - } - post.setUpdateBy(SecurityUtils.getUsername()); - return toAjax(postService.updatePost(post)); - } - - /** - * 删除岗位 - */ - @PreAuthorize("@ss.hasPermi('system:post:remove')") - @Log(title = "岗位管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{postIds}") - public AjaxResult remove(@PathVariable Long[] postIds) - { - return toAjax(postService.deletePostByIds(postIds)); - } - - /** - * 获取岗位选择框列表 - */ - @GetMapping("/optionselect") - public AjaxResult optionselect() - { - List posts = postService.selectPostAll(); - return AjaxResult.success(posts); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java deleted file mode 100644 index 5bbfe588c..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 用户常量信息 - * - * @author ruoyi - */ -public class UserConstants -{ - /** - * 平台内系统用户的唯一标志 - */ - public static final String SYS_USER = "SYS_USER"; - - /** 正常状态 */ - public static final String NORMAL = "0"; - - /** 异常状态 */ - public static final String EXCEPTION = "1"; - - /** 用户封禁状态 */ - public static final String USER_DISABLE = "1"; - - /** 角色封禁状态 */ - public static final String ROLE_DISABLE = "1"; - - /** 部门正常状态 */ - public static final String DEPT_NORMAL = "0"; - - /** 部门停用状态 */ - public static final String DEPT_DISABLE = "1"; - - /** 字典正常状态 */ - public static final String DICT_NORMAL = "0"; - - /** 是否为系统默认(是) */ - public static final String YES = "Y"; - - /** 是否菜单外链(是) */ - public static final String YES_FRAME = "0"; - - /** 是否菜单外链(否) */ - public static final String NO_FRAME = "1"; - - /** Layout组件标识 */ - public final static String LAYOUT = "Layout"; - - /** ParentView组件标识 */ - public final static String PARENT_VIEW = "ParentView"; - - /** 校验返回结果码 */ - public final static String UNIQUE = "0"; - public final static String NOT_UNIQUE = "1"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java deleted file mode 100644 index e316627f4..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ruoyi.common.core.controller; - -import java.beans.PropertyEditorSupport; -import java.util.Date; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.sql.SqlUtil; - -/** - * web层通用数据处理 - * - * @author ruoyi - */ -public class BaseController { - protected final Logger logger = LoggerFactory.getLogger(BaseController.class); - - /** - * 将前台传递过来的日期格式的字符串,自动转化为Date类型 - */ - @InitBinder - public void initBinder(WebDataBinder binder) { - // Date 类型转换 - binder.registerCustomEditor(Date.class, new PropertyEditorSupport() { - @Override - public void setAsText(String text) { - setValue(DateUtils.parseDate(text)); - } - }); - } - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java deleted file mode 100644 index 2fa9f867c..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ruoyi.common.enums; - -import java.util.HashMap; -import java.util.Map; -import org.springframework.lang.Nullable; - -/** - * 请求方式 - * - * @author ruoyi - */ -public enum HttpMethod -{ - GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; - - private static final Map mappings = new HashMap<>(16); - - static - { - for (HttpMethod httpMethod : values()) - { - mappings.put(httpMethod.name(), httpMethod); - } - } - - @Nullable - public static HttpMethod resolve(@Nullable String method) - { - return (method != null ? mappings.get(method) : null); - } - - public boolean matches(String method) - { - return (this == resolve(method)); - } -} diff --git a/ruoyi-ui/src/api/system/post.js b/ruoyi-ui/src/api/system/post.js index 7a4faa1cf..df10d7917 100644 --- a/ruoyi-ui/src/api/system/post.js +++ b/ruoyi-ui/src/api/system/post.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询岗位列表 export function listPost(query) { return request({ - url: '/system/post/list', + url: '/system/post/page', method: 'get', params: query }) @@ -20,7 +20,7 @@ export function listSimplePosts() { // 查询岗位详细 export function getPost(postId) { return request({ - url: '/system/post/' + postId, + url: '/system/post/get?id=' + postId, method: 'get' }) } @@ -28,7 +28,7 @@ export function getPost(postId) { // 新增岗位 export function addPost(data) { return request({ - url: '/system/post', + url: '/system/post/create', method: 'post', data: data }) @@ -37,8 +37,8 @@ export function addPost(data) { // 修改岗位 export function updatePost(data) { return request({ - url: '/system/post', - method: 'put', + url: '/system/post/update', + method: 'post', data: data }) } @@ -46,8 +46,8 @@ export function updatePost(data) { // 删除岗位 export function delPost(postId) { return request({ - url: '/system/post/' + postId, - method: 'delete' + url: '/system/post/delete?id=' + postId, + method: 'post' }) } diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index f0bb4e74e..5485703ac 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -142,7 +142,7 @@ import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/de import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -import {SysCommonStatusEnum, SysMenuTypeEnum} from '@/utils/constants' +import {SysCommonStatusEnum} from '@/utils/constants' import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict' export default { @@ -249,7 +249,7 @@ export default { leader: undefined, phone: undefined, email: undefined, - status: "0" + status: SysCommonStatusEnum.ENABLE, }; this.resetForm("form"); }, diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 93dc8c2f3..dd9d5d32a 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -1,18 +1,18 @@