├── file
├── 277e41bceb435b833a6f.txt
├── 50c3cd7ced46abbe4093.jpg
├── 646cec1d674c5fa595a5.png
├── 64a85e1a3c4dfb83d267.jpg
├── 693c2156904974a5734f.jpg
├── 6e2a56b137425e87f0b9.jpg
├── 7318a077ab4e8499e8b9.jpg
├── 826f7fffbd435284d3c7.jpg
├── 83fcdbcb4b450da4390e.png
├── b2f66ce7ec4b54a0fea7.png
├── cf27a645464dafa957ff.png
├── fdc2f2fd3e42779c4ca1.jpg
├── 11daf7f3aa4fbfaf876c.xlsx
├── 5dcc0999734b09b08aee.xlsx
├── 75bf86e97c43c88f2fa5.xlsx
└── 90b02643334e5aa802c3.xlsx
├── vue-elementui-hrm
├── src
│ ├── assets
│ │ ├── less
│ │ │ ├── _variable.scss
│ │ │ ├── index.less
│ │ │ ├── table.less
│ │ │ ├── common.less
│ │ │ ├── home.less
│ │ │ └── reset.less
│ │ ├── logo.png
│ │ └── images
│ │ │ ├── 404.png
│ │ │ ├── avatar.png
│ │ │ └── favicon.ico
│ ├── views
│ │ ├── system
│ │ │ └── index.vue
│ │ ├── money
│ │ │ └── index.vue
│ │ ├── performance
│ │ │ └── index.vue
│ │ ├── permission
│ │ │ └── index.vue
│ │ ├── error
│ │ │ └── index.vue
│ │ └── Main.vue
│ ├── store
│ │ ├── modules
│ │ │ ├── token.js
│ │ │ ├── permission.js
│ │ │ ├── menu.js
│ │ │ ├── staff.js
│ │ │ └── tag.js
│ │ ├── getters.js
│ │ └── index.js
│ ├── directive
│ │ ├── index.js
│ │ └── permission
│ │ │ └── permission.js
│ ├── utils
│ │ ├── validateCode.js
│ │ ├── avatar.js
│ │ ├── docs.js
│ │ └── request.js
│ ├── App.vue
│ ├── api
│ │ ├── login.js
│ │ ├── overtime.js
│ │ ├── salaryDeduct.js
│ │ ├── leave.js
│ │ ├── home.js
│ │ ├── salary.js
│ │ ├── city.js
│ │ ├── dept.js
│ │ ├── menu.js
│ │ ├── role.js
│ │ ├── attendance.js
│ │ ├── docs.js
│ │ ├── insurance.js
│ │ ├── staffOvertime.js
│ │ ├── staff.js
│ │ └── staffLeave.js
│ ├── main.js
│ ├── components
│ │ ├── Tag.vue
│ │ └── Aside.vue
│ └── router
│ │ └── index.js
├── .browserslistrc
├── public
│ ├── favicon.ico
│ └── index.html
├── .env
├── .editorconfig
├── babel.config.js
├── vue.config.js
├── .eslintrc.js
└── package.json
├── 加班数据导入样例.xlsx
├── 考勤数据导入样例.xlsx
├── hrm
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── qiujie
│ │ ├── mapper
│ │ ├── CityMapper.java
│ │ ├── RoleMenuMapper.java
│ │ ├── OvertimeMapper.java
│ │ ├── StaffRoleMapper.java
│ │ ├── SalaryDeductMapper.java
│ │ ├── RoleMapper.java
│ │ ├── LeaveMapper.java
│ │ ├── DocsMapper.java
│ │ ├── DeptMapper.java
│ │ ├── MenuMapper.java
│ │ ├── StaffOvertimeMapper.java
│ │ ├── AttendanceMapper.java
│ │ ├── SalaryMapper.java
│ │ ├── StaffLeaveMapper.java
│ │ └── InsuranceMapper.java
│ │ ├── config
│ │ ├── HolidayConfig.java
│ │ ├── MybatisPlusConfig.java
│ │ ├── RedisConfig.java
│ │ └── SwaggerConfig.java
│ │ ├── enums
│ │ ├── BaseEnum.java
│ │ ├── GenderEnum.java
│ │ ├── OvertimeEnum.java
│ │ ├── DeductEnum.java
│ │ ├── OvertimeStatusEnum.java
│ │ ├── LeaveEnum.java
│ │ ├── AuditStatusEnum.java
│ │ ├── AttendanceStatusEnum.java
│ │ └── BusinessStatusEnum.java
│ │ ├── HrmApplication.java
│ │ ├── exception
│ │ ├── ServiceException.java
│ │ └── BaseExceptionHandler.java
│ │ ├── annotation
│ │ └── ExcelColumn.java
│ │ ├── util
│ │ ├── WebUtil.java
│ │ ├── DatetimeUtil.java
│ │ ├── ValidateCodeUtil.java
│ │ ├── JwtUtil.java
│ │ └── CodeGenerateUtil.java
│ │ ├── entity
│ │ ├── StaffDetails.java
│ │ ├── RoleMenu.java
│ │ ├── StaffRole.java
│ │ ├── Role.java
│ │ ├── ValidateCode.java
│ │ ├── SalaryDeduct.java
│ │ ├── Leave.java
│ │ ├── Docs.java
│ │ ├── StaffLeave.java
│ │ ├── Overtime.java
│ │ ├── Menu.java
│ │ ├── Staff.java
│ │ ├── Insurance.java
│ │ ├── Attendance.java
│ │ ├── Salary.java
│ │ └── Dept.java
│ │ ├── handler
│ │ ├── AccessDeniedExceptionHandler.java
│ │ └── AuthenticationEntryPointHandler.java
│ │ ├── controller
│ │ ├── LoginController.java
│ │ ├── HomeController.java
│ │ ├── OvertimeController.java
│ │ ├── SalaryDeductController.java
│ │ ├── LeaveController.java
│ │ ├── SalaryController.java
│ │ ├── CityController.java
│ │ ├── DeptController.java
│ │ └── InsuranceController.java
│ │ ├── vo
│ │ ├── OvertimeMonthVO.java
│ │ ├── StaffOvertimeVO.java
│ │ ├── StaffAttendanceVO.java
│ │ ├── StaffDocsVO.java
│ │ ├── AttendanceMonthVO.java
│ │ ├── StaffLeaveVO.java
│ │ ├── StaffDeptVO.java
│ │ ├── StaffInsuranceVO.java
│ │ └── StaffSalaryVO.java
│ │ ├── service
│ │ ├── StaffRoleService.java
│ │ ├── RoleMenuService.java
│ │ ├── StaffDetailsService.java
│ │ ├── SalaryDeductService.java
│ │ ├── LoginService.java
│ │ ├── LeaveService.java
│ │ └── OvertimeService.java
│ │ ├── dto
│ │ ├── Response.java
│ │ └── ResponseDTO.java
│ │ ├── listener
│ │ ├── HrApproveListener.java
│ │ └── ManagerApproveListener.java
│ │ └── filter
│ │ └── JwtAuthenticationFilter.java
│ └── resources
│ ├── application.yml
│ └── templates
│ ├── controller.java.vm
│ └── service.java.vm
└── .gitignore
/file/277e41bceb435b833a6f.txt:
--------------------------------------------------------------------------------
1 | 你好✌
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/less/_variable.scss:
--------------------------------------------------------------------------------
1 | $theme-color: #33aef0;
--------------------------------------------------------------------------------
/vue-elementui-hrm/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/加班数据导入样例.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/加班数据导入样例.xlsx
--------------------------------------------------------------------------------
/考勤数据导入样例.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/考勤数据导入样例.xlsx
--------------------------------------------------------------------------------
/file/50c3cd7ced46abbe4093.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/50c3cd7ced46abbe4093.jpg
--------------------------------------------------------------------------------
/file/646cec1d674c5fa595a5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/646cec1d674c5fa595a5.png
--------------------------------------------------------------------------------
/file/64a85e1a3c4dfb83d267.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/64a85e1a3c4dfb83d267.jpg
--------------------------------------------------------------------------------
/file/693c2156904974a5734f.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/693c2156904974a5734f.jpg
--------------------------------------------------------------------------------
/file/6e2a56b137425e87f0b9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/6e2a56b137425e87f0b9.jpg
--------------------------------------------------------------------------------
/file/7318a077ab4e8499e8b9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/7318a077ab4e8499e8b9.jpg
--------------------------------------------------------------------------------
/file/826f7fffbd435284d3c7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/826f7fffbd435284d3c7.jpg
--------------------------------------------------------------------------------
/file/83fcdbcb4b450da4390e.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/83fcdbcb4b450da4390e.png
--------------------------------------------------------------------------------
/file/b2f66ce7ec4b54a0fea7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/b2f66ce7ec4b54a0fea7.png
--------------------------------------------------------------------------------
/file/cf27a645464dafa957ff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/cf27a645464dafa957ff.png
--------------------------------------------------------------------------------
/file/fdc2f2fd3e42779c4ca1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/fdc2f2fd3e42779c4ca1.jpg
--------------------------------------------------------------------------------
/file/11daf7f3aa4fbfaf876c.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/11daf7f3aa4fbfaf876c.xlsx
--------------------------------------------------------------------------------
/file/5dcc0999734b09b08aee.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/5dcc0999734b09b08aee.xlsx
--------------------------------------------------------------------------------
/file/75bf86e97c43c88f2fa5.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/75bf86e97c43c88f2fa5.xlsx
--------------------------------------------------------------------------------
/file/90b02643334e5aa802c3.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/file/90b02643334e5aa802c3.xlsx
--------------------------------------------------------------------------------
/vue-elementui-hrm/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/vue-elementui-hrm/public/favicon.ico
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/vue-elementui-hrm/src/assets/logo.png
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/images/404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/vue-elementui-hrm/src/assets/images/404.png
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/images/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/vue-elementui-hrm/src/assets/images/avatar.png
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fo11ow-me/hrm/HEAD/vue-elementui-hrm/src/assets/images/favicon.ico
--------------------------------------------------------------------------------
/vue-elementui-hrm/.env:
--------------------------------------------------------------------------------
1 | # 主机地址
2 | VUE_APP_HOST = 'http://localhost'
3 |
4 | # 后端项目端口
5 | VUE_APP_PORT = 8888
6 |
7 | VUE_APP_BASE_API = '/dev'
8 |
9 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/less/index.less:
--------------------------------------------------------------------------------
1 | @import "./common.less";
2 | @import "./home.less";
3 | @import "./reset.less";
4 | @import "./table.less";
5 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{js,jsx,ts,tsx,vue}]
2 | indent_style = space
3 | indent_size = 2
4 | trim_trailing_whitespace = true
5 | insert_final_newline = true
6 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/system/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/money/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/performance/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/permission/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/less/table.less:
--------------------------------------------------------------------------------
1 | .common-table {
2 | height: calc(100% - 62px);
3 | background-color: white;
4 | position: relative;
5 | .pager {
6 | position: absolute;
7 | bottom: 20px;
8 | right: 20px;
9 | }
10 | }
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/assets/less/common.less:
--------------------------------------------------------------------------------
1 | .manage {
2 | height: 90%;
3 | padding-bottom: 20px;
4 | overflow: hidden;
5 | &-header {
6 | display: flex;
7 | justify-content: space-between;
8 | align-items: flex-start;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/error/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ],
5 | plugins: [ // 按需引入
6 | [
7 | 'component',
8 | {
9 | libraryName: 'element-ui',
10 | styleLibraryName: 'theme-chalk'
11 | }
12 | ]
13 | ]
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/modules/token.js:
--------------------------------------------------------------------------------
1 | export default {
2 | namespaced: true,
3 | state: {
4 | token: localStorage.getItem('token') || ''
5 | },
6 | mutations: {
7 | SET_TOKEN (state, token) {
8 | state.token = token
9 | localStorage.setItem('token', token)
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/directive/index.js:
--------------------------------------------------------------------------------
1 | import permission from './permission/permission'
2 | import Vue from 'vue'
3 |
4 | const install = function (Vue) {
5 | Vue.directive('permission', permission)
6 | }
7 |
8 | if (window.Vue) {
9 | window.permission = permission
10 | Vue.use(install)
11 | }
12 | export default install
13 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/getters.js:
--------------------------------------------------------------------------------
1 | export const getters = {
2 | menuList: state => state.menu.menuList,
3 | isCollapsed: state => state.menu.isCollapsed,
4 | permissionList: state => state.permission.permissionList,
5 | staff: state => state.staff.staff,
6 | tagList: state => state.tag.tagList,
7 | token: state => state.token.token
8 | }
9 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/modules/permission.js:
--------------------------------------------------------------------------------
1 | export default {
2 | namespaced: true,
3 | state: {
4 | permissionList: []
5 | },
6 | mutations: {
7 | SET_PERMISSION (state, list) {
8 | state.permissionList = list.map(item => item.permission)
9 | console.log('我有的权限:', state.permissionList)
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/utils/validateCode.js:
--------------------------------------------------------------------------------
1 | import { getValidateCode } from '@/api/login'
2 |
3 | export const setValidateCode = (img) => {
4 | getValidateCode().then(response => {
5 | img.src = window.URL.createObjectURL(new Blob([response.data]))
6 | img.onload = () => {
7 | URL.revokeObjectURL(img.src)
8 | }
9 | })
10 | }
11 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/CityMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.City;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author qiujie
12 | * @since 2022-03-23
13 | */
14 | public interface CityMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | lintOnSave: false, // 关闭语法检查
3 | devServer: {
4 | proxy: {
5 | '/dev': {
6 | // 请求前缀
7 | target: process.env.VUE_APP_HOST + ':' + process.env.VUE_APP_PORT,
8 | pathRewrite: { '^/dev': '' },
9 | changeOrigin: true // 用于控制请求头中的host值
10 | }
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
25 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/RoleMenuMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.RoleMenu;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author qiujie
12 | * @since 2022-02-28
13 | */
14 | public interface RoleMenuMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/OvertimeMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.Overtime;
5 |
6 | /**
7 | *
8 | * 加班表 Mapper 接口
9 | *
10 | *
11 | * @author qiujie
12 | * @since 2022-03-28
13 | */
14 |
15 | public interface OvertimeMapper extends BaseMapper {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/StaffRoleMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.qiujie.entity.StaffRole;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author qiujie
12 | * @since 2022-02-28
13 | */
14 |
15 |
16 | public interface StaffRoleMapper extends BaseMapper {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/SalaryDeductMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.SalaryDeduct;
5 |
6 | /**
7 | *
8 | * 工资扣除表 Mapper 接口
9 | *
10 | *
11 | * @author qiujie
12 | * @since 2022-03-27
13 | */
14 |
15 |
16 | public interface SalaryDeductMapper extends BaseMapper {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/login.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | // 登录
4 | export const login = (data) => {
5 | return request({
6 | url: '/login/' + data.validateCode,
7 | method: 'post',
8 | data
9 | })
10 | }
11 |
12 | export const getValidateCode = () => {
13 | return request({
14 | url: '/validate/code',
15 | method: 'get',
16 | responseType: 'blob'
17 | })
18 | }
19 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/RoleMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.metadata.IPage;
4 | import com.qiujie.entity.Role;
5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 |
7 | /**
8 | *
9 | * Mapper 接口
10 | *
11 | *
12 | * @author qiujie
13 | * @since 2022-01-27
14 | */
15 | public interface RoleMapper extends BaseMapper {
16 |
17 |
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | extends: [
7 | 'plugin:vue/essential',
8 | '@vue/standard'
9 | ],
10 | parserOptions: {
11 | parser: 'babel-eslint'
12 | },
13 | rules: {
14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/config/HolidayConfig.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.config;
2 |
3 |
4 | import lombok.Data;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Data
11 | @Component
12 | @ConfigurationProperties // 指明前缀,因为没有前缀,所以不用指明,默认为”“即可
13 | public class HolidayConfig {
14 | private List holidays;
15 | }
16 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | import tag from './modules/tag'
4 | import menu from './modules/menu'
5 | import staff from './modules/staff'
6 | import token from './modules/token'
7 | import permission from './modules/permission'
8 | import { getters } from '@/store/getters'
9 |
10 | Vue.use(Vuex)
11 |
12 | export default new Vuex.Store({
13 | modules: {
14 | tag, menu, staff, token, permission
15 | },
16 | getters
17 | })
18 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/BaseEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 通用枚举接口
7 | *
8 | * @Author qiujie
9 | * @Date 2022/3/21
10 | * @Version 1.0
11 | */
12 |
13 | public interface BaseEnum extends Serializable {
14 | /**
15 | * 获取编码
16 | *
17 | * @return
18 | */
19 |
20 | Integer getCode();
21 |
22 | /**
23 | * 消息内容
24 | *
25 | * @return
26 | */
27 | String getMessage();
28 | }
29 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/LeaveMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.Leave;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.apache.ibatis.annotations.Select;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | *
12 | * 请假表 Mapper 接口
13 | *
14 | *
15 | * @author qiujie
16 | * @since 2022-03-27
17 | */
18 |
19 | public interface LeaveMapper extends BaseMapper {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/overtime.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | const url = '/overtime'
4 |
5 | // 得到
6 | export const queryByDeptIdAndTypeNum = (deptId, typeNum) => {
7 | return request({
8 | url: url + '/' + deptId + '/' + typeNum
9 | })
10 | }
11 |
12 | export const setOvertime = (data) => {
13 | return request({
14 | url: url + '/set', method: 'post', data
15 | })
16 | }
17 |
18 | // 查询所有加班类型
19 | export const queryAll = () => {
20 | return request({
21 | url: url + '/all'
22 | })
23 | }
24 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/salaryDeduct.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | const url = '/salary-deduct'
4 |
5 | // 得到
6 | export const queryByDeptIdAndTypeNum = (deptId, typeNum) => {
7 | return request({
8 | url: url + '/' + deptId + '/' + typeNum
9 | })
10 | }
11 |
12 | export const setSalaryDeduct = (data) => {
13 | return request({
14 | url: url + '/set',
15 | method: 'post',
16 | data
17 | })
18 | }
19 |
20 | // 获得所有
21 | export const queryAll = () => {
22 | return request({
23 | url: url + '/all'
24 | })
25 | }
26 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/GenderEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 | import org.apache.poi.ss.formula.functions.T;
8 |
9 | @Getter
10 | @AllArgsConstructor
11 | public enum GenderEnum implements BaseEnum{
12 |
13 | MALE(0,"男"),
14 | FEMALE(1,"女");
15 |
16 | @EnumValue
17 | private final Integer code;
18 | @JsonValue
19 | private final String message;
20 | }
21 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/HrmApplication.java:
--------------------------------------------------------------------------------
1 | package com.qiujie;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.transaction.annotation.EnableTransactionManagement;
7 |
8 |
9 | @MapperScan("com.qiujie.mapper")
10 | @SpringBootApplication
11 | @EnableTransactionManagement // 事务
12 | public class HrmApplication {
13 | public static void main(String[] args) {
14 | SpringApplication.run(HrmApplication.class, args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import ElementUI from 'element-ui' // 按需引入element-ui
4 | import 'element-ui/lib/theme-chalk/index.css' // 全局引入element-ui的css文件
5 | import './assets/less/index.less'
6 | import store from './store'
7 | import router from './router' // 引入vue路由
8 | import directive from '@/directive'
9 |
10 | Vue.config.productionTip = false
11 |
12 | // 全局注入element-ui,会引入全部的组件,增大了项目的体积
13 | Vue.use(ElementUI, { size: 'mini' })
14 | Vue.use(directive)
15 |
16 | new Vue({
17 | store,
18 | router,
19 | render: (h) => h(App)
20 | }).$mount('#app')
21 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/exception/ServiceException.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.exception;
2 |
3 | import com.qiujie.enums.BaseEnum;
4 | import lombok.Getter;
5 | import org.apache.poi.ss.formula.functions.T;
6 |
7 | /**
8 | * 自定义异常
9 | * @author
10 | * @date
11 | */
12 | @Getter
13 | public class ServiceException extends RuntimeException {
14 | private final int code;
15 |
16 | public ServiceException(int code,String message){
17 | super(message);
18 | this.code = code;
19 | }
20 |
21 | public ServiceException(BaseEnum e){
22 | super(e.getMessage());
23 | this.code = e.getCode();
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/leave.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | const url = '/leave'
4 |
5 | // 得到
6 | export const queryByDeptIdAndTypeNum = (deptId, typeNum) => {
7 | return request({
8 | url: url + '/' + deptId + '/' + typeNum
9 | })
10 | }
11 |
12 | export const setLeave = (data) => {
13 | return request({
14 | url: url + '/set',
15 | method: 'post',
16 | data
17 | })
18 | }
19 |
20 | // 得到
21 | export const queryByDeptId = (deptId) => {
22 | return request({
23 | url: url + '/dept/' + deptId
24 | })
25 | }
26 |
27 | // 查询所有请假类型
28 | export const queryAll = () => {
29 | return request({
30 | url: url + '/all'
31 | })
32 | }
33 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/annotation/ExcelColumn.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @Author qiujie
10 | * @Date 2022/3/29
11 | * @Version 1.0
12 | */
13 |
14 | /**
15 | * 声明该注解类的生命周期
16 | * RUNTIME表示注解保留在程序运行期间,此时可以通过反射获得定义在某个类上的所有注解。
17 | */
18 | @Retention(RetentionPolicy.RUNTIME)
19 | // 定义注解作用的元素类型
20 | @Target(ElementType.FIELD)
21 | public @interface ExcelColumn {
22 |
23 | /**
24 | * 列的名称
25 | *
26 | * @return
27 | */
28 | String value() default "";
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/util/WebUtil.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.util;
2 |
3 | import javax.servlet.http.HttpServletResponse;
4 | import java.io.IOException;
5 |
6 | public class WebUtil {
7 |
8 | /**
9 | * 渲染字符串到前端
10 | *
11 | * @param response
12 | * @param str
13 | */
14 | public static void renderString(HttpServletResponse response, String str){
15 | try{
16 | response.setStatus(200);
17 | response.setContentType("application/json");
18 | response.setCharacterEncoding("utf-8");
19 | response.getWriter().print(str);
20 | } catch (IOException e) {
21 | throw new RuntimeException(e);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/utils/avatar.js:
--------------------------------------------------------------------------------
1 | import { getAvatar } from '@/api/docs'
2 | import store from '../store'
3 | import defaultAvatar from '../assets/images/avatar.png'
4 |
5 | export const setAvatar = (img) => {
6 | const avatar = store.getters.staff.avatar
7 | if (avatar != null && avatar !== '') { // 当没有头像时,使用默认头像
8 | getAvatar(avatar).then(response => {
9 | // 如果头像不存在使用默认头像
10 | if (response.data.size > 0) {
11 | img.src = window.URL.createObjectURL(new Blob([response.data]))
12 | } else {
13 | img.src = defaultAvatar
14 | }
15 | })
16 | } else {
17 | img.src = defaultAvatar
18 | }
19 | img.onload = () => {
20 | URL.revokeObjectURL(img.src)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/OvertimeEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 |
4 | import com.baomidou.mybatisplus.annotation.EnumValue;
5 | import com.fasterxml.jackson.annotation.JsonValue;
6 | import lombok.AllArgsConstructor;
7 | import lombok.Getter;
8 | import org.apache.poi.ss.formula.functions.T;
9 |
10 |
11 | @Getter
12 | @AllArgsConstructor
13 | public enum OvertimeEnum implements BaseEnum {
14 |
15 | WORKDAY_OVERTIME(0, "工作日加班",1.5),
16 | HOLIDAY_OVERTIME(1, "节假日加班",3.0),
17 | DAY_OFF_OVERTIME(2, "休息日加班",2.0);
18 |
19 | @EnumValue
20 | private final Integer code;
21 |
22 | @JsonValue
23 | private final String message;
24 |
25 | // 基本工资倍数下限
26 | private final Double lowerLimit;
27 | }
28 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/utils/docs.js:
--------------------------------------------------------------------------------
1 | import ElementUI from 'element-ui'
2 |
3 | // 将后端传来的文件流写入文件
4 | export const write = (response, filename) => {
5 | if (response.data.size > 0) {
6 | const url = window.URL.createObjectURL(new Blob([response.data]))
7 | const link = document.createElement('a')
8 | link.href = url
9 | link.setAttribute('download', filename)
10 | document.body.appendChild(link)
11 | link.click()
12 | setTimeout(function () {
13 | // 移除内存中的临时文件路径和为下载而创建的a标签
14 | window.URL.revokeObjectURL(url)
15 | link.remove()
16 | }, 10000)
17 | } else {
18 | ElementUI.Message({
19 | message: '文件不存在!',
20 | type: 'error',
21 | duration: 5 * 1000
22 | })
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/DeductEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 | import org.apache.poi.ss.formula.functions.T;
8 |
9 | @Getter
10 | @AllArgsConstructor
11 | public enum DeductEnum implements BaseEnum{
12 | LATE_DEDUCT(0, "迟到扣款",50),
13 | LEAVE_EARLY_DEDUCT(1, "早退扣款",50),
14 | ABSENTEEISM_DEDUCT(2, "旷工扣款",100),
15 | LEAVE_DEDUCT(3, "休假扣款",80);
16 |
17 |
18 | @EnumValue
19 | private final Integer code;
20 | @JsonValue
21 | private final String message;
22 |
23 | // 默认的扣款金额
24 | private final Integer defaultValue;
25 | }
26 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/home.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | const url = '/home'
4 |
5 | export const queryStaff = () => {
6 | return request({
7 | url: url + '/staff'
8 | })
9 | }
10 |
11 | // 获取统计数据
12 | export const queryCount = () => {
13 | return request({
14 | url: url + '/count'
15 | })
16 | }
17 |
18 | // 获取城市社保数据
19 | export const queryCity = () => {
20 | return request({
21 | url: url + '/city'
22 | })
23 | }
24 |
25 | // 统计各部门员工人数
26 | export const queryDepartment = () => {
27 | return request({
28 | url: url + '/department'
29 | })
30 | }
31 |
32 | // 获取员工考勤数据
33 | export const queryAttendance = (params) => {
34 | return request({
35 | url: url + '/attendance',
36 | params
37 | })
38 | }
39 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/OvertimeStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 |
4 | import com.baomidou.mybatisplus.annotation.EnumValue;
5 | import com.fasterxml.jackson.annotation.JsonValue;
6 | import lombok.AllArgsConstructor;
7 | import lombok.Getter;
8 | import org.apache.poi.ss.formula.functions.T;
9 |
10 | /**
11 | * @Author qiujie
12 | * @Date 2022/3/31
13 | * @Version 1.0
14 | */
15 |
16 | @Getter
17 | @AllArgsConstructor
18 | public enum OvertimeStatusEnum implements BaseEnum {
19 |
20 | NORMAL(0, "正常","success"),
21 | OVERTIME(1, "加班",""),
22 | TIME_OFF(2, "调休","info");
23 |
24 | @EnumValue
25 | private final Integer code;
26 | @JsonValue
27 | private final String message;
28 |
29 | private final String tagType;
30 | }
31 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/LeaveEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 | import org.apache.poi.ss.formula.functions.T;
8 |
9 | /**
10 | * 休假枚举类
11 | */
12 |
13 | @Getter
14 | @AllArgsConstructor
15 | public enum LeaveEnum implements BaseEnum {
16 | PERSONAL_LEAVE(0, "事假"),
17 | MATERNITY_LEAVE(1, "产假"),
18 | SICK_LEAVE(2, "病假"),
19 | MARRIAGE_LEAVE(3, "婚假"),
20 | HOME_LEAVE(4, "探亲假"),
21 | PATERNITY_LEAVE(5, "陪产假"),
22 | TIME_OFF(6, "调休");
23 |
24 | @EnumValue
25 | private final Integer code;
26 | @JsonValue
27 | private final String message;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/AuditStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 | import org.apache.poi.ss.formula.functions.T;
8 |
9 | /**
10 | * @Author qiujie
11 | * @Date 2022/4/7
12 | * @Version 1.0
13 | */
14 |
15 | @Getter
16 | @AllArgsConstructor
17 | public enum AuditStatusEnum implements BaseEnum {
18 |
19 | UNAUDITED(0, "待审核","info"),
20 | APPROVE(1, "审核通过","success"),
21 | REJECT(2, "驳回","danger"),
22 | CANCEL(3, "撤销",""),
23 | AUDITING(4,"审核中","warning");
24 |
25 | @EnumValue
26 | private final Integer code;
27 | @JsonValue
28 | private final String message;
29 |
30 | private final String tagType;
31 | }
32 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
25 | test/
26 | target/
27 | !.mvn/wrapper/maven-wrapper.jar
28 | !**/src/main/**/target/
29 | !**/src/test/**/target/
30 |
31 | ### STS ###
32 | .apt_generated
33 | .classpath
34 | .factorypath
35 | .project
36 | .settings
37 | .springBeans
38 | .sts4-cache
39 |
40 | ### IntelliJ IDEA ###
41 | *.iws
42 | *.iml
43 | *.ipr
44 | *.rdb
45 |
46 | ### NetBeans ###
47 | /nbproject/private/
48 | /nbbuild/
49 | /dist/
50 | /nbdist/
51 | /.nb-gradle/
52 | build/
53 | !**/src/main/**/build/
54 | !**/src/test/**/build/
55 |
56 | ### VS Code ###
57 | .vscode/
58 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/exception/BaseExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.exception;
2 |
3 | import com.qiujie.dto.Response;
4 | import com.qiujie.dto.ResponseDTO;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.web.bind.annotation.ControllerAdvice;
8 | import org.springframework.web.bind.annotation.ExceptionHandler;
9 | import org.springframework.web.bind.annotation.ResponseBody;
10 |
11 | @ControllerAdvice
12 | public class BaseExceptionHandler {
13 |
14 | private static final Logger logger = LoggerFactory.getLogger(BaseExceptionHandler.class);
15 |
16 | @ExceptionHandler(ServiceException.class)
17 | @ResponseBody
18 | public ResponseDTO handle(ServiceException exception){
19 | logger.info(exception.getMessage());
20 | return Response.error(exception.getCode(),exception.getMessage());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/modules/menu.js:
--------------------------------------------------------------------------------
1 | export default {
2 | namespaced: true,
3 | state: {
4 | // 首页是所有员工都可访问的
5 | menuList: [
6 | {
7 | id: 0,
8 | code: 'home',
9 | name: '首页',
10 | icon: 's-home',
11 | path: '/home',
12 | children: []
13 | }
14 | ],
15 | isCollapsed: false // 是否水平折叠收起菜单
16 | },
17 | mutations: {
18 | SET_MENU (state, menuList) {
19 | state.menuList = menuList
20 | },
21 | CLEAR_MENU (state) {
22 | state.menuList = [
23 | {
24 | id: 0,
25 | code: 'home',
26 | name: '首页',
27 | icon: 's-home',
28 | path: '/home',
29 | children: []
30 | }
31 | ]
32 | },
33 | COLLAPSE_MENU (state) {
34 | state.isCollapsed = !state.isCollapsed
35 | }
36 | },
37 | actions: {
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/AttendanceStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 |
4 | import com.baomidou.mybatisplus.annotation.EnumValue;
5 | import com.fasterxml.jackson.annotation.JsonValue;
6 | import lombok.AllArgsConstructor;
7 | import lombok.Getter;
8 | import org.apache.poi.ss.formula.functions.T;
9 |
10 | /**
11 | * @Author qiujie
12 | * @Date 2022/3/31
13 | * @Version 1.0
14 | */
15 |
16 | @Getter
17 | @AllArgsConstructor
18 | public enum AttendanceStatusEnum implements BaseEnum {
19 |
20 | NORMAL(0, "正常","success"),
21 | LATE(1, "迟到",""),
22 | LEAVE_EARLY(2, "早退","warning"),
23 | ABSENTEEISM(3, "旷工","danger"),
24 | LEAVE(4, "休假","info"),
25 | TIME_OFF(5,"调休","info");
26 |
27 |
28 | @EnumValue
29 | private final Integer code;
30 | @JsonValue
31 | private final String message;
32 |
33 | private final String tagType;
34 | }
35 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/enums/BusinessStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import org.apache.poi.ss.formula.functions.T;
6 | import org.springframework.http.HttpStatus;
7 |
8 | @Getter
9 | @AllArgsConstructor
10 | public enum BusinessStatusEnum implements BaseEnum {
11 |
12 | SUCCESS(200, "成功"),
13 | ERROR(300, "失败"),
14 | STAFF_NOT_EXIST(400,"没有此员工,请重新登录"),
15 | STAFF_STATUS_ERROR(500, "状态异常,请联系管理员"),
16 | FILE_NOT_EXIST(600, "文件不存在"),
17 | FILE_READ_ERROR(700, "文件读取失败"),
18 | FILE_WRITE_ERROR(800, "文件写入失败"),
19 | FILE_UPLOAD_ERROR(900, "文件上传失败"),
20 | DATA_IMPORT_ERROR(1000, "数据导入失败"),
21 | BATCH_DELETE_ERROR(1100, "批量删除失败"),
22 | UNAUTHORIZED(1200,"认证失败,请重新登录"),
23 | FORBIDDEN(1300,"不好意思,你没有此权限");
24 |
25 | private final Integer code;
26 | private final String message;
27 | }
28 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/config/MybatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.config;
2 |
3 | import com.baomidou.mybatisplus.annotation.DbType;
4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
6 | import org.mybatis.spring.annotation.MapperScan;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.context.annotation.Configuration;
9 |
10 | /**
11 | * 分页插件
12 | */
13 | @Configuration
14 | @MapperScan("com.qiujie.mapper")
15 | public class MybatisPlusConfig {
16 |
17 | // 最新版
18 | @Bean
19 | public MybatisPlusInterceptor mybatisPlusInterceptor() {
20 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
21 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
22 | return interceptor;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/DocsMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.baomidou.mybatisplus.core.metadata.IPage;
5 | import com.qiujie.entity.Docs;
6 | import com.qiujie.vo.StaffDocsVO;
7 | import org.apache.ibatis.annotations.Param;
8 | import org.apache.ibatis.annotations.Select;
9 |
10 | /**
11 | *
12 | * Mapper 接口
13 | *
14 | *
15 | * @author qiujie
16 | * @since 2022-02-24
17 | */
18 | public interface DocsMapper extends BaseMapper {
19 |
20 | @Select("select sd.*,ss.name staff_name from sys_staff ss left join sys_docs sd on ss.id = sd.staff_id " +
21 | "where sd.is_deleted = 0 and sd.old_name like concat('%',#{oldName},'%') and ss.name like concat('%',#{staffName},'%')")
22 | IPage listStaffDocsVO(IPage config, @Param("oldName") String oldName, @Param("staffName") String staffName);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/entity/StaffDetails.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.entity;
2 |
3 | import com.qiujie.vo.StaffDeptVO;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 | import org.springframework.security.core.GrantedAuthority;
8 | import org.springframework.security.core.userdetails.UserDetails;
9 |
10 | import java.io.Serial;
11 | import java.io.Serializable;
12 | import java.util.Collection;
13 |
14 | @Data
15 | @NoArgsConstructor
16 | @AllArgsConstructor
17 | public class StaffDetails implements UserDetails, Serializable {
18 |
19 |
20 | @Serial
21 | private static final long serialVersionUID = 1L;
22 |
23 | private String username;
24 | private String password;
25 | private Collection extends GrantedAuthority> authorities;
26 | private boolean accountNonExpired;
27 | private boolean accountNonLocked;
28 | private boolean credentialsNonExpired;
29 | private boolean enabled;
30 | }
31 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/directive/permission/permission.js:
--------------------------------------------------------------------------------
1 | import store from '@/store'
2 |
3 | function checkPermission (el, binding) {
4 | const { value } = binding
5 | // 已拥有的权限
6 | const hasPermission = store.getters && store.getters.permissionList
7 | if (value && value instanceof Array) {
8 | if (value.length > 0) {
9 | // 需要的权限
10 | const requiredPermission = value
11 | // 如果已有权限中存在至少一条需要的权限,就授权
12 | const flag = hasPermission.some(item => {
13 | return requiredPermission.includes(item)
14 | })
15 | if (!flag) {
16 | // el.parentNode && el.parentNode.removeChild(el)
17 | el.disabled = true
18 | el.style.opacity = 0.6
19 | // el.style.cursor = 'not-allowed'
20 | el.style['pointer-events'] = 'none'
21 | }
22 | }
23 | } else {
24 | throw new Error('请指定权限字符串!')
25 | }
26 | }
27 |
28 | export default {
29 | inserted (el, binding) {
30 | checkPermission(el, binding)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/modules/staff.js:
--------------------------------------------------------------------------------
1 | import router, { resetRouter } from '../../router'
2 |
3 | export default {
4 | namespaced: true,
5 | state: {
6 | staff: JSON.parse(localStorage.getItem('staff'))
7 | },
8 | mutations: {
9 | SET_STAFF (state, staff) {
10 | state.staff = staff
11 | localStorage.setItem('staff', JSON.stringify(staff)) // 存储用户信息到浏览器
12 | },
13 | SET_AVATAR (state, avatar) {
14 | state.staff.avatar = avatar
15 | localStorage.setItem('staff', JSON.stringify(state.staff)) // 存储用户信息到浏览器
16 | }
17 | },
18 | actions: {
19 | // 退出登录
20 | logout ({ commit }) {
21 | // 清除本地缓存
22 | localStorage.clear()
23 | // 清除vuex中的菜单数据
24 | commit('menu/CLEAR_MENU', null, { root: true })
25 | // 清除vuex中的标签数据
26 | commit('tag/CLEAR_TAG', null, { root: true })
27 | // 重置路由
28 | resetRouter()
29 | router.push({ name: 'login' }).then(() => {
30 | })
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/views/Main.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
37 |
38 |
47 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/handler/AccessDeniedExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.handler;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.qiujie.dto.ResponseDTO;
5 | import com.qiujie.enums.BusinessStatusEnum;
6 | import com.qiujie.util.WebUtil;
7 | import org.springframework.security.access.AccessDeniedException;
8 | import org.springframework.security.web.access.AccessDeniedHandler;
9 | import org.springframework.stereotype.Component;
10 |
11 | import javax.servlet.ServletException;
12 | import javax.servlet.http.HttpServletRequest;
13 | import javax.servlet.http.HttpServletResponse;
14 | import java.io.IOException;
15 |
16 |
17 | @Component
18 | public class AccessDeniedExceptionHandler implements AccessDeniedHandler {
19 | @Override
20 | public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) {
21 | String str = JSON.toJSONString(new ResponseDTO(BusinessStatusEnum.FORBIDDEN));
22 | // 给出异常提示信息
23 | WebUtil.renderString(response, str);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/handler/AuthenticationEntryPointHandler.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.handler;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.qiujie.dto.ResponseDTO;
5 | import com.qiujie.enums.BusinessStatusEnum;
6 | import com.qiujie.util.WebUtil;
7 | import org.springframework.security.core.AuthenticationException;
8 | import org.springframework.security.web.AuthenticationEntryPoint;
9 | import org.springframework.stereotype.Component;
10 |
11 | import javax.servlet.ServletException;
12 | import javax.servlet.http.HttpServletRequest;
13 | import javax.servlet.http.HttpServletResponse;
14 | import java.io.IOException;
15 |
16 |
17 | @Component
18 | public class AuthenticationEntryPointHandler implements AuthenticationEntryPoint {
19 | @Override
20 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {
21 | String str = JSON.toJSONString(new ResponseDTO(BusinessStatusEnum.UNAUTHORIZED));
22 | // 给出异常提示信息
23 | WebUtil.renderString(response, str);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/store/modules/tag.js:
--------------------------------------------------------------------------------
1 | export default {
2 | namespaced: true,
3 | state: {
4 | tagList: JSON.parse(localStorage.getItem('tagList')) || [{
5 | id: 0,
6 | name: '首页',
7 | path: '/home',
8 | code: 'home'
9 | }]
10 | },
11 | mutations: {
12 | // 添加标签
13 | ADD_TAG (state, menu) {
14 | // 判断当前点击的是否是首页
15 | if (menu.code !== 'home') {
16 | // 判断tag是否存在,若存在就不添加
17 | const result = state.tagList.findIndex(
18 | item => item.code === menu.code
19 | )
20 | if (result === -1) {
21 | state.tagList.push(menu)
22 | }
23 | }
24 | localStorage.setItem('tagList', JSON.stringify(state.tagList))
25 | },
26 | // 关闭标签
27 | CLOSE_TAG (state, menu) {
28 | state.tagList = state.tagList.filter(item => item.code !== menu.code)
29 | localStorage.setItem('tagList', JSON.stringify(state.tagList))
30 | },
31 | // 清空标签
32 | CLEAR_TAG (state) {
33 | state.tagList = [{
34 | id: 0,
35 | name: '首页',
36 | path: '/home',
37 | code: 'home'
38 | }]
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/DeptMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.baomidou.mybatisplus.core.metadata.IPage;
5 | import com.qiujie.entity.Dept;
6 | import org.apache.ibatis.annotations.Param;
7 | import org.apache.ibatis.annotations.Select;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | *
13 | * Mapper 接口
14 | *
15 | *
16 | * @author qiujie
17 | * @since 2022-03-07
18 | */
19 | public interface DeptMapper extends BaseMapper {
20 |
21 | @Select("select * from sys_dept where is_deleted = 0 and parent_id = 0 and name like concat('%',#{name},'%')")
22 | IPage listParentDept(IPage config, @Param("name") String name);
23 |
24 | /**
25 | * 查找所有子部门
26 | *
27 | */
28 | @Select("select * from sys_dept where is_deleted = 0 and parent_id != 0")
29 | List queryAllSub();
30 |
31 | /**
32 | * 查找员工所在的部门
33 | */
34 | @Select("select sd.* from sys_dept sd right join sys_staff ss on sd.id = ss.dept_id where ss.is_deleted = 0 and ss.id = #{id} ")
35 | Dept queryByStaffId(@Param("id") Integer id);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/controller/LoginController.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.controller;
2 |
3 | import com.qiujie.dto.Response;
4 | import com.qiujie.entity.Staff;
5 | import com.qiujie.dto.ResponseDTO;
6 | import com.qiujie.service.LoginService;
7 | import io.swagger.annotations.ApiOperation;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | import javax.annotation.Resource;
12 | import javax.servlet.http.HttpServletResponse;
13 | import java.io.IOException;
14 |
15 | /**
16 | * 登录注册接口
17 | *
18 | * @Author : qiujie
19 | * @Date : 2022/1/30
20 | */
21 | @RestController
22 | public class LoginController {
23 |
24 | @Autowired
25 | private LoginService loginService;
26 |
27 | @PostMapping("/login/{validateCode}")
28 | public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) {
29 | return this.loginService.login(staff, validateCode);
30 | }
31 |
32 | @GetMapping("/validate/code")
33 | public void getValidateCode(HttpServletResponse response) throws IOException {
34 | this.loginService.getValidateCode(response);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/vo/OvertimeMonthVO.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.vo;
2 |
3 | import com.qiujie.annotation.ExcelColumn;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @Author qiujie
11 | * @Date 2022/4/7
12 | * @Version 1.0
13 | */
14 |
15 | @Data
16 | public class OvertimeMonthVO implements Serializable {
17 |
18 |
19 | private static final long serialVersionUID = 1L;
20 |
21 | @ApiModelProperty("员工id")
22 | private Integer staffId;
23 |
24 | @ApiModelProperty("部门id")
25 | private Integer deptId;
26 |
27 | @ExcelColumn("员工工号")
28 | @ApiModelProperty("员工工号")
29 | private String code;
30 |
31 | @ExcelColumn("员工姓名")
32 | @ApiModelProperty("员工姓名")
33 | private String name;
34 |
35 | @ExcelColumn("电话")
36 | @ApiModelProperty("电话")
37 | private String phone;
38 |
39 | @ExcelColumn("地址")
40 | @ApiModelProperty("地址")
41 | private String address;
42 |
43 | @ExcelColumn("部门")
44 | @ApiModelProperty("部门")
45 | private String deptName;
46 |
47 | @ExcelColumn("加班次数")
48 | private Integer overtimeTimes;
49 |
50 | @ExcelColumn("调休天数")
51 | private Integer timeOffDays;
52 | }
53 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/vo/StaffOvertimeVO.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.vo;
2 |
3 | import com.qiujie.annotation.ExcelColumn;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.HashMap;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author qiujie
13 | * @Date 2022/3/31
14 | * @Version 1.0
15 | */
16 |
17 | @Data
18 | public class StaffOvertimeVO implements Serializable {
19 |
20 | private static final long serialVersionUID = 1L;
21 |
22 | @ApiModelProperty("员工id")
23 | private Integer staffId;
24 |
25 | @ApiModelProperty("部门id")
26 | private Integer deptId;
27 |
28 | @ExcelColumn("员工工号")
29 | @ApiModelProperty("员工工号")
30 | private String code;
31 |
32 | @ExcelColumn("员工姓名")
33 | @ApiModelProperty("员工姓名")
34 | private String name;
35 |
36 | @ExcelColumn("电话")
37 | @ApiModelProperty("电话")
38 | private String phone;
39 |
40 | @ExcelColumn("地址")
41 | @ApiModelProperty("地址")
42 | private String address;
43 |
44 | @ExcelColumn("部门")
45 | @ApiModelProperty("部门")
46 | private String deptName;
47 |
48 | @ApiModelProperty("员工加班数据")
49 | private List> overtimeList;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/vo/StaffAttendanceVO.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.vo;
2 |
3 | import com.qiujie.annotation.ExcelColumn;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.HashMap;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author qiujie
13 | * @Date 2022/3/31
14 | * @Version 1.0
15 | */
16 |
17 | @Data
18 | public class StaffAttendanceVO implements Serializable {
19 |
20 | private static final long serialVersionUID = 1L;
21 |
22 | @ApiModelProperty("员工id")
23 | private Integer staffId;
24 |
25 | @ApiModelProperty("部门id")
26 | private Integer deptId;
27 |
28 | @ExcelColumn("员工工号")
29 | @ApiModelProperty("员工工号")
30 | private String code;
31 |
32 | @ExcelColumn("员工姓名")
33 | @ApiModelProperty("员工姓名")
34 | private String name;
35 |
36 | @ExcelColumn("电话")
37 | @ApiModelProperty("电话")
38 | private String phone;
39 |
40 | @ExcelColumn("地址")
41 | @ApiModelProperty("地址")
42 | private String address;
43 |
44 | @ExcelColumn("部门")
45 | @ApiModelProperty("部门")
46 | private String deptName;
47 |
48 | @ApiModelProperty("员工考勤数据")
49 | private List> attendanceList;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/vo/StaffDocsVO.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.vo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.sql.Timestamp;
9 | @Data
10 | public class StaffDocsVO implements Serializable {
11 |
12 | private static final long serialVersionUID = 1L;
13 |
14 | private Integer id;
15 |
16 | @ApiModelProperty("文件名称")
17 | private String name;
18 |
19 | @ApiModelProperty("员工姓名")
20 | private String staffName;
21 |
22 | @ApiModelProperty("文件类型")
23 | private String type;
24 |
25 | @ApiModelProperty("文件原名称")
26 | private String oldName;
27 |
28 | @ApiModelProperty("文件md5信息")
29 | private String md5;
30 |
31 | @ApiModelProperty("文件大小kB")
32 | private Long size;
33 |
34 | @ApiModelProperty("文件上传者id")
35 | private Integer staffId;
36 |
37 | @ApiModelProperty("备注")
38 | private String remark;
39 |
40 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
41 | @ApiModelProperty("创建时间")
42 | private Timestamp createTime;
43 |
44 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
45 | @ApiModelProperty("修改时间")
46 | private Timestamp updateTime;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-elementui-hrm",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "axios": "^0.25.0",
12 | "cache-loader": "^4.1.0",
13 | "core-js": "^3.6.5",
14 | "echarts": "^5.3.0",
15 | "element-ui": "^2.15.7",
16 | "less": "^4.1.2",
17 | "less-loader": "^6.0.0",
18 | "mockjs": "^1.1.0",
19 | "moment": "^2.30.1",
20 | "qs": "^6.10.3",
21 | "vue": "^2.6.11",
22 | "vue-router": "^3.2.0",
23 | "vuex": "^3.6.2"
24 | },
25 | "devDependencies": {
26 | "@vue/cli-plugin-babel": "~4.5.0",
27 | "@vue/cli-plugin-eslint": "~4.5.0",
28 | "@vue/cli-plugin-router": "~4.5.0",
29 | "@vue/cli-service": "~4.5.0",
30 | "@vue/eslint-config-standard": "^5.1.2",
31 | "babel-eslint": "^10.1.0",
32 | "babel-plugin-component": "^1.1.1",
33 | "eslint": "^6.7.2",
34 | "eslint-plugin-import": "^2.20.2",
35 | "eslint-plugin-node": "^11.1.0",
36 | "eslint-plugin-promise": "^4.2.1",
37 | "eslint-plugin-standard": "^4.0.0",
38 | "eslint-plugin-vue": "^6.2.2",
39 | "sass": "^1.49.9",
40 | "vue-template-compiler": "^2.6.11"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/vue-elementui-hrm/src/api/salary.js:
--------------------------------------------------------------------------------
1 | import request from '../utils/request'
2 |
3 | const url = '/salary'
4 |
5 | /**
6 | * 添加
7 | * @param data
8 | * @returns {AxiosPromise}
9 | */
10 | export const add = (data) => {
11 | return request({
12 | url: url, method: 'post', data
13 | })
14 | }
15 |
16 | /**
17 | * 逻辑删除
18 | * @param id
19 | * @returns {AxiosPromise}
20 | */
21 | export const del = (id) => {
22 | return request({
23 | url: url + '/' + id, method: 'delete'
24 | })
25 | }
26 |
27 | export const deleteBatch = (ids) => {
28 | return request({
29 | url: url + '/batch/' + ids, method: 'delete'
30 | })
31 | }
32 |
33 | export const edit = (data) => {
34 | return request({
35 | url: url, method: 'put', data
36 | })
37 | }
38 |
39 | export const list = (params) => {
40 | return request({
41 | url: url, method: 'get', params
42 | })
43 | }
44 |
45 | export const setSalary = (data) => {
46 | return request({
47 | url: url + '/set', method: 'post', data
48 | })
49 | }
50 |
51 | export const exp = (month, filename) => {
52 | return request({
53 | url: url + '/export/' + month + '/' + filename,
54 | method: 'get',
55 | responseType: 'blob'
56 | })
57 | }
58 |
59 | // 数据导入
60 | export const getImportApi = () => {
61 | return process.env.VUE_APP_HOST + ':' + process.env.VUE_APP_PORT + url + '/import'
62 | }
63 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/entity/RoleMenu.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableLogic;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 |
9 | import java.io.Serial;
10 | import java.io.Serializable;
11 | import java.sql.Timestamp;
12 |
13 | import com.fasterxml.jackson.annotation.JsonFormat;
14 | import io.swagger.annotations.ApiModel;
15 | import io.swagger.annotations.ApiModelProperty;
16 | import lombok.Getter;
17 | import lombok.Setter;
18 | import lombok.experimental.Accessors;
19 |
20 | /**
21 | *
22 | *
23 | *
24 | *
25 | * @author qiujie
26 | * @since 2022-02-28
27 | */
28 | @Getter
29 | @Setter
30 | @Accessors(chain = true)
31 | @TableName("per_role_menu")
32 | @ApiModel(value = "RoleMenu对象", description = "")
33 | public class RoleMenu implements Serializable {
34 |
35 | @Serial
36 | private static final long serialVersionUID = 1L;
37 |
38 | @TableId(value = "id", type = IdType.AUTO)
39 | private Integer id;
40 |
41 | @ApiModelProperty("角色id")
42 | @TableField("role_id")
43 | private Integer roleId;
44 |
45 | @ApiModelProperty("菜单id")
46 | @TableField("menu_id")
47 | private Integer menuId;
48 | }
49 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/entity/StaffRole.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableLogic;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 |
9 | import java.io.Serial;
10 | import java.io.Serializable;
11 | import java.sql.Timestamp;
12 |
13 | import com.fasterxml.jackson.annotation.JsonFormat;
14 | import io.swagger.annotations.ApiModel;
15 | import io.swagger.annotations.ApiModelProperty;
16 | import lombok.Getter;
17 | import lombok.Setter;
18 | import lombok.experimental.Accessors;
19 |
20 | /**
21 | *
22 | *
23 | *
24 | *
25 | * @author qiujie
26 | * @since 2022-02-28
27 | */
28 | @Getter
29 | @Setter
30 | @Accessors(chain = true)
31 | @TableName("per_staff_role")
32 | @ApiModel(value = "StaffRole对象", description = "")
33 | public class StaffRole implements Serializable {
34 |
35 | @Serial
36 | private static final long serialVersionUID = 1L;
37 |
38 | @TableId(value = "id", type = IdType.AUTO)
39 | private Integer id;
40 |
41 | @ApiModelProperty("员工id")
42 | @TableField("staff_id")
43 | private Integer staffId;
44 |
45 | @ApiModelProperty("角色id")
46 | @TableField("role_id")
47 | private Integer roleId;
48 | }
49 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/service/StaffRoleService.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.service;
2 |
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 | import com.qiujie.enums.BusinessStatusEnum;
6 | import com.qiujie.dto.Response;
7 | import com.qiujie.dto.ResponseDTO;
8 | import com.qiujie.entity.StaffRole;
9 | import com.qiujie.exception.ServiceException;
10 | import com.qiujie.mapper.StaffRoleMapper;
11 | import org.springframework.stereotype.Service;
12 | import org.springframework.transaction.annotation.Transactional;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * @Author qiujie
18 | * @Date 2022/3/1
19 | * @Version 1.0
20 | */
21 |
22 | @Service
23 | public class StaffRoleService extends ServiceImpl {
24 |
25 | @Transactional
26 | public ResponseDTO setRole(Integer staffId, List roleIds) {
27 | remove(new QueryWrapper().eq("staff_id", staffId));
28 | for (Integer roleId : roleIds) {
29 | save(new StaffRole().setStaffId(staffId).setRoleId(roleId));
30 | }
31 | return Response.success();
32 | }
33 |
34 | public ResponseDTO queryByStaffId(Integer staffId) {
35 | List list = list(new QueryWrapper().eq("staff_id",staffId));
36 | return Response.success(list);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/hrm/src/main/java/com/qiujie/mapper/MenuMapper.java:
--------------------------------------------------------------------------------
1 | package com.qiujie.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.qiujie.entity.Menu;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.apache.ibatis.annotations.Select;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | *
12 | * Mapper 接口
13 | *
14 | *
15 | * @author qiujie
16 | * @since 2022-02-28
17 | */
18 | public interface MenuMapper extends BaseMapper