parent
d50ddb974e
commit
7f9a91cffc
BIN
image/system.png
BIN
image/system.png
Binary file not shown.
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 69 KiB |
Binary file not shown.
|
@ -3,29 +3,93 @@ drop table if exists tb_employee;
|
|||
create table tb_employee(
|
||||
emp_id int(11) comment '员工Id' primary key auto_increment,
|
||||
emp_name varchar(55) comment '员工姓名',
|
||||
emp_pw varchar(55) comment '员工密码',
|
||||
username varchar(55) comment '员工用户名',
|
||||
password varchar(55) comment '员工密码',
|
||||
emp_tel varchar(20) comment '员工手机号',
|
||||
emp_id_card varchar(20) comment '员工身份证号',
|
||||
emp_age int(11) comment '员工年龄',
|
||||
emp_gender int(11) comment '员工性别:1-男 2-女',
|
||||
emp_address varchar(20) comment '员工住址',
|
||||
emp_position varchar(10) comment '员工职位',
|
||||
emp_sal decimal(10,2) comment '员工薪资'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='员工表';
|
||||
insert into tb_employee (emp_name, emp_pw, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_position, emp_sal) values ('李四','lisi','13320560246','320145199702059783',26,1,'北京市大兴区XXX路XX号','普通员工',5000);
|
||||
select emp_id, emp_name, emp_pw, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_position, emp_sal from tb_employee;
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('李四','lisi','lisi','13320560246','320145199702059783',26,1,'北京市大兴区XXX路XX号', 50000);
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('王五','wangwu','wangwu','13320456237','32014519970204563X',26,2,'北京市大兴区XXX路XX号',10000);
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('赵六','zhaoliu','zhaoliu','13320456282','32014519971204563X',26,2,'北京市大兴区XXX路XX号',10000);
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('田七','tianqi','tianqi','13320456291','32014519970224563X',26,1,'北京市大兴区XXX路XX号',10000);
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('候八','houba','houba','13320456200','32014519970604563X',26,2,'北京市大兴区XXX路XX号',5000);
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) values ('罗九','luojiu','luojiu','13320456263','32014519950604563X',28,1,'北京市大兴区XXX路XX号',5000);
|
||||
select emp_id, emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal from tb_employee;
|
||||
|
||||
-- 领导表
|
||||
drop table if exists tb_manager;
|
||||
create table tb_manager(
|
||||
manager_id int(11) comment '领导Id' primary key auto_increment,
|
||||
manager_pw varchar(20) comment '领导密码',
|
||||
-- 角色表
|
||||
drop table if exists tb_role;
|
||||
create table tb_role(
|
||||
role_id int(11) comment '角色Id' primary key auto_increment,
|
||||
role_name varchar(55) comment '角色名称'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='角色表';
|
||||
insert into tb_role (role_name) values ('超级管理员');
|
||||
insert into tb_role (role_name) values ('仓库管理员');
|
||||
insert into tb_role (role_name) values ('普通管理员');
|
||||
insert into tb_role (role_name) values ('销售员');
|
||||
select role_id, role_name from tb_role;
|
||||
|
||||
-- 用户角色中间表
|
||||
drop table if exists tb_emp_role;
|
||||
create table tb_emp_role(
|
||||
emp_role_id int(11) primary key auto_increment,
|
||||
emp_id int(11) comment '员工',
|
||||
role_level varchar(10) comment '权限'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='领导表';
|
||||
insert into tb_manager (manager_id, manager_pw, emp_id, role_level) values ();
|
||||
select manager_id, manager_pw, emp_id, role_level from tb_manager;
|
||||
role_id int(11) comment '角色'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='用户角色表';
|
||||
insert into tb_emp_role (emp_id, role_id) values (1,1);
|
||||
insert into tb_emp_role (emp_id, role_id) values (2,2);
|
||||
insert into tb_emp_role (emp_id, role_id) values (3,3);
|
||||
insert into tb_emp_role (emp_id, role_id) values (4,3);
|
||||
insert into tb_emp_role (emp_id, role_id) values (5,4);
|
||||
insert into tb_emp_role (emp_id, role_id) values (6,4);
|
||||
|
||||
select emp_role_id, emp_id, role_id from tb_emp_role;
|
||||
|
||||
-- 岗位表
|
||||
drop table if exists tb_post;
|
||||
create table tb_post(
|
||||
post_id int(11) comment '岗位' primary key auto_increment,
|
||||
post_name varchar(55) comment '岗位名称'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='岗位表';
|
||||
insert into tb_post (post_name) values ('董事长');
|
||||
insert into tb_post (post_name) values ('人事');
|
||||
insert into tb_post (post_name) values ('客户主管');
|
||||
insert into tb_post (post_name) values ('后勤');
|
||||
insert into tb_post (post_name) values ('销售');
|
||||
select post_id, post_name from tb_post;
|
||||
|
||||
-- 员工岗位中间表
|
||||
drop table if exists tb_emp_post;
|
||||
create table tb_emp_post(
|
||||
emp_post_id int(11) primary key auto_increment,
|
||||
emp_id int(11) comment '员工',
|
||||
post_id int(11) comment '岗位'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='员工岗位中间表';
|
||||
insert into tb_emp_post (emp_id, post_id) values (1,1);
|
||||
insert into tb_emp_post (emp_id, post_id) values (2,4);
|
||||
insert into tb_emp_post (emp_id, post_id) values (3,2);
|
||||
insert into tb_emp_post (emp_id, post_id) values (4,3);
|
||||
insert into tb_emp_post (emp_id, post_id) values (5,5);
|
||||
insert into tb_emp_post (emp_id, post_id) values (6,5);
|
||||
select emp_post_id, emp_id, post_id from tb_emp_post;
|
||||
|
||||
-- 人员分布
|
||||
select
|
||||
e.emp_id,
|
||||
e.emp_name,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
p.post_id,
|
||||
p.post_name
|
||||
from
|
||||
tb_employee e
|
||||
left join tb_emp_role er on e.emp_id = er.emp_id
|
||||
left join tb_role r on er.role_id = r.role_id
|
||||
left join tb_emp_post ep on e.emp_id = ep.emp_id
|
||||
left join tb_post p on ep.post_id = p.post_id;
|
||||
|
||||
|
||||
-- 会员表
|
||||
|
@ -87,3 +151,33 @@ create table tb_import(
|
|||
import_date date comment '进货日期',
|
||||
provide_id varchar(10) comment '供货商编号'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='进货表';
|
||||
|
||||
-- 销售表
|
||||
drop table if exists tb_sale_list;
|
||||
create table tb_sale_list(
|
||||
list_id int(11) comment '表单编号' primary key auto_increment,
|
||||
merch_id int(11) comment '商品Id',
|
||||
merch_name varchar(55) comment '商品名称',
|
||||
sales_price decimal(10,2) comment '',
|
||||
bar_code varchar(20) comment '条形码',
|
||||
merch_type int(11) comment '商品类型'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='销售表';
|
||||
|
||||
-- 退货表
|
||||
drop table if exists tb_withdraw_list;
|
||||
create table tb_withdraw_list(
|
||||
list_id int(11) comment '表单编号' primary key auto_increment,
|
||||
merch_id int(11) comment '商品Id',
|
||||
merch_name varchar(55) comment '商品名称',
|
||||
bar_code varchar(20) comment '条形码',
|
||||
withdraw_num int(11) comment '退货数量'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='退货表';
|
||||
|
||||
-- 上报进货表
|
||||
drop table if exists tb_report_impl_list;
|
||||
create table tb_report_impl_list(
|
||||
list_id int(11) comment '表单编号' primary key auto_increment,
|
||||
merch_id int(11) comment '商品Id',
|
||||
merch_name varchar(55) comment '商品名称'
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='退货表';
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function fetchEmp(data) {
|
||||
return request({
|
||||
url: '/manage/emp/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: '/manage/emp/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function findById(empId) {
|
||||
return request({
|
||||
url: '/manage/emp/findById/' + empId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function update(data) {
|
||||
return request({
|
||||
url: '/manage/emp/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(empId){
|
||||
return request({
|
||||
url: '/manage/emp/del/' + empId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function batchDel(empIds){
|
||||
return request({
|
||||
url: '/manage/emp/batchDel/' + empIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function fetchManager(data) {
|
||||
return request({
|
||||
url: '/manage/manager/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: '/manage/manager/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function findById(empId) {
|
||||
return request({
|
||||
url: '/manage/manager/findById/' + empId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function update(data) {
|
||||
return request({
|
||||
url: '/manage/manager/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(empId){
|
||||
return request({
|
||||
url: '/manage/manager/del/' + empId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function batchDel(empIds){
|
||||
return request({
|
||||
url: '/manage/manager/batchDel/' + empIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -78,14 +78,27 @@ export const constantRoutes = [
|
|||
},
|
||||
|
||||
{
|
||||
path: '/form',
|
||||
path: '/managers',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'Form',
|
||||
component: () => import('@/views/form/index'),
|
||||
meta: { title: 'Form', icon: 'form' }
|
||||
name: '管理员管理',
|
||||
component: () => import('@/views/managers/index'),
|
||||
meta: { title: '管理员管理', icon: 'el-icon-user' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/employees',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: '员工管理',
|
||||
component: () => import('@/views/employees/index'),
|
||||
meta: { title: '员工管理', icon: 'el-icon-user-solid' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="empRequest" class="demo-form-inline">
|
||||
<el-form-item label="员工编号">
|
||||
<el-input v-model="empRequest.empId" placeholder="员工编号" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchEmp" icon="el-icon-search">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="dialogFormVisible1 = true">新增员工</el-button>
|
||||
|
||||
<el-table :data="empResponse.list" border stripe @selection-change="handleSelectionChange" tooltip-effect="dark" style="width: 100%">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="员工Id" prop="empId"/>
|
||||
<el-table-column label="员工姓名" prop="empName"/>
|
||||
<el-table-column label="员工用户名" prop="username"/>
|
||||
<el-table-column label="员工手机号" prop="empTel"/>
|
||||
<el-table-column label="员工身份证号" prop="empIdCard"/>
|
||||
<el-table-column label="员工年龄" prop="empAge"/>
|
||||
<el-table-column label="员工性别" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.empGender == 1">男</span>
|
||||
<span v-if="scope.row.empGender == 2">女</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="员工住址" prop="empAddress"/>
|
||||
<el-table-column label="员工薪资" prop="empSal"/>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="warning" @click="open(scope.row.empId)">编辑</el-button>
|
||||
<el-button type="danger" @click="del(scope.row.empId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="empRequest.pageNum"
|
||||
:page-sizes="[1, 5, 10, 20]"
|
||||
:page-size="empRequest.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="empResponse.total">
|
||||
</el-pagination>
|
||||
|
||||
<el-button type="danger" @click="batchDel">删除员工</el-button>
|
||||
|
||||
<el-dialog title="新增员工" :visible.sync="dialogFormVisible1">
|
||||
<el-form :model="emp">
|
||||
<el-form-item label="员工姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工用户名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.username" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.password" autocomplete="off" :key="passwordType" :type="passwordType" tabindex="2" auto-complete="on"></el-input>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empTel" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工身份证号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empIdCard" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAge" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工性别" :label-width="formLabelWidth">
|
||||
<el-radio-group v-model="emp.empGender">
|
||||
<el-radio :label="1">男</el-radio>
|
||||
<el-radio :label="2">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAddress" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="add">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="编辑员工" :visible.sync="dialogFormVisible2">
|
||||
<el-form :model="emp">
|
||||
<el-form-item label="员工姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工用户名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.username" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.password" autocomplete="off" :key="passwordType" :type="passwordType" tabindex="2" auto-complete="on"></el-input>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empTel" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工身份证号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empIdCard" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAge" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工性别" :label-width="formLabelWidth">
|
||||
<el-radio-group v-model="emp.empGender">
|
||||
<el-radio :label="1">男</el-radio>
|
||||
<el-radio :label="2">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAddress" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible2 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="update">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||
//例如:import { 组件名称 } from '组件路径',
|
||||
import { fetchEmp, add, findById, update, del, batchDel } from '@/api/emp'
|
||||
export default {
|
||||
//import引入的组件需要注入到对象中才能使用
|
||||
data() {
|
||||
//这里存放数据
|
||||
return {
|
||||
emp: {
|
||||
empId: null,
|
||||
empName: '',
|
||||
username: '',
|
||||
password: '',
|
||||
empTel: '',
|
||||
empIdCard: '',
|
||||
empAge: null,
|
||||
empGender: null,
|
||||
empAddress: '',
|
||||
empSal: null,
|
||||
},
|
||||
empRequest: {
|
||||
empId: null,
|
||||
empName: '',
|
||||
pageNum: 1,
|
||||
pageSize: 5
|
||||
},
|
||||
empResponse: {
|
||||
total: 0,
|
||||
list: []
|
||||
},
|
||||
dialogFormVisible1: false,
|
||||
dialogFormVisible2: false,
|
||||
formLabelWidth: '120px',
|
||||
passwordType: 'password',
|
||||
redirect: undefined,
|
||||
multipleSelection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchEmp(){
|
||||
fetchEmp(this.empRequest).then(res =>{
|
||||
this.empResponse = res.data
|
||||
})
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.empRequest.pageSize = val
|
||||
this.fetchEmp()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.empRequest.pageNum = val
|
||||
this.fetchEmp()
|
||||
},
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
add() {
|
||||
add(this.emp).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.dialogFormVisible1 = false
|
||||
this.emp = {}
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
open(empId){
|
||||
this.dialogFormVisible2 = true
|
||||
findById(empId).then(res =>{
|
||||
this.emp = res.data
|
||||
})
|
||||
},
|
||||
update() {
|
||||
update(this.emp).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.dialogFormVisible2 = false
|
||||
this.emp = {}
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
del(empId){
|
||||
del(empId).then(res =>{
|
||||
this.$message.success(res.msg)
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
batchDel() {
|
||||
batchDel(this.multipleSelection.map(item => item.empId)).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.fetchManager()
|
||||
})
|
||||
}
|
||||
},
|
||||
//声明周期 - 创建完成(可以访问当前this实例),
|
||||
created() {
|
||||
this.fetchEmp()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,245 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="empRequest" class="demo-form-inline">
|
||||
<el-form-item label="管理员姓名">
|
||||
<el-input v-model="empRequest.empName" placeholder="管理员姓名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchManager" icon="el-icon-search">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button type="primary" @click="dialogFormVisible1 = true">新增管理员</el-button>
|
||||
|
||||
<el-table :data="empResponse.list" border stripe @selection-change="handleSelectionChange" tooltip-effect="dark" style="width: 100%">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="员工Id" prop="empId"/>
|
||||
<el-table-column label="员工姓名" prop="empName"/>
|
||||
<el-table-column label="员工用户名" prop="username"/>
|
||||
<el-table-column label="员工手机号" prop="empTel"/>
|
||||
<el-table-column label="员工身份证号" prop="empIdCard"/>
|
||||
<el-table-column label="员工年龄" prop="empAge"/>
|
||||
<el-table-column label="员工性别" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.empGender == 1">男</span>
|
||||
<span v-if="scope.row.empGender == 2">女</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="员工住址" prop="empAddress"/>
|
||||
<el-table-column label="员工薪资" prop="empSal"/>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="warning" @click="open(scope.row.empId)">编辑</el-button>
|
||||
<el-button type="danger" @click="del(scope.row.empId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="empRequest.pageNum"
|
||||
:page-sizes="[1, 5, 10, 20]"
|
||||
:page-size="empRequest.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="empResponse.total">
|
||||
</el-pagination>
|
||||
|
||||
<el-button type="danger" @click="batchDel">删除管理员</el-button>
|
||||
|
||||
<el-dialog title="新增管理员" :visible.sync="dialogFormVisible1">
|
||||
<el-form :model="emp">
|
||||
<el-form-item label="员工姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工用户名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.username" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.password" autocomplete="off" :key="passwordType" :type="passwordType" tabindex="2" auto-complete="on"></el-input>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empTel" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工身份证号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empIdCard" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAge" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工性别" :label-width="formLabelWidth">
|
||||
<el-radio-group v-model="emp.empGender">
|
||||
<el-radio :label="1">男</el-radio>
|
||||
<el-radio :label="2">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAddress" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="add">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="编辑管理员" :visible.sync="dialogFormVisible2">
|
||||
<el-form :model="emp">
|
||||
<el-form-item label="员工姓名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工用户名" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.username" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工密码" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.password" autocomplete="off" :key="passwordType" :type="passwordType" tabindex="2" auto-complete="on"></el-input>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empTel" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工身份证号" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empIdCard" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工年龄" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAge" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工性别" :label-width="formLabelWidth">
|
||||
<el-radio-group v-model="emp.empGender">
|
||||
<el-radio :label="1">男</el-radio>
|
||||
<el-radio :label="2">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工住址" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empAddress" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工薪资" :label-width="formLabelWidth">
|
||||
<el-input v-model="emp.empSal" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible2 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="update">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||
//例如:import { 组件名称 } from '组件路径',
|
||||
import { fetchManager, add, findById, update, del, batchDel } from '@/api/manager'
|
||||
export default {
|
||||
//import引入的组件需要注入到对象中才能使用
|
||||
data() {
|
||||
//这里存放数据
|
||||
return {
|
||||
emp: {
|
||||
empId: null,
|
||||
empName: '',
|
||||
username: '',
|
||||
password: '',
|
||||
empTel: '',
|
||||
empIdCard: '',
|
||||
empAge: null,
|
||||
empGender: null,
|
||||
empAddress: '',
|
||||
empSal: null,
|
||||
},
|
||||
empRequest: {
|
||||
empId: null,
|
||||
empName: '',
|
||||
pageNum: 1,
|
||||
pageSize: 5
|
||||
},
|
||||
empResponse: {
|
||||
total: 0,
|
||||
list: []
|
||||
},
|
||||
dialogFormVisible1: false,
|
||||
dialogFormVisible2: false,
|
||||
formLabelWidth: '120px',
|
||||
passwordType: 'password',
|
||||
redirect: undefined,
|
||||
multipleSelection: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchManager(){
|
||||
fetchManager(this.empRequest).then(res =>{
|
||||
this.empResponse = res.data
|
||||
})
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.empRequest.pageSize = val
|
||||
this.fetchManager()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.empRequest.pageNum = val
|
||||
this.fetchManager()
|
||||
},
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
add() {
|
||||
add(this.emp).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.dialogFormVisible1 = false
|
||||
this.emp = {}
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
open(empId){
|
||||
this.dialogFormVisible2 = true
|
||||
findById(empId).then(res =>{
|
||||
this.emp = res.data
|
||||
})
|
||||
},
|
||||
update() {
|
||||
update(this.emp).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.dialogFormVisible2 = false
|
||||
this.emp = {}
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
del(empId){
|
||||
del(empId).then(res =>{
|
||||
this.$message.success(res.msg)
|
||||
this.fetchManager()
|
||||
})
|
||||
},
|
||||
batchDel() {
|
||||
batchDel(this.multipleSelection.map(item => item.empId)).then(res => {
|
||||
this.$message.success(res.msg)
|
||||
this.fetchManager()
|
||||
})
|
||||
}
|
||||
},
|
||||
//声明周期 - 创建完成(可以访问当前this实例),
|
||||
created() {
|
||||
this.fetchManager()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>work-modules</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>work-manage</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 系统公共 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>work-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- SpringBoot Web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- Mybatis 依赖配置 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<!-- PageHelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
package com.bwie.manage;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class ManageApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ManageApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.bwie.manage.controller;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.manage.service.EmpService;
|
||||
import com.bwie.manage.service.ManagerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.controller
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/emp")
|
||||
public class EmpController {
|
||||
|
||||
@Autowired
|
||||
private EmpService empService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public Result<PageResult<EmpResponse>> list(@RequestBody EmpRequest empRequest){
|
||||
return empService.list(empRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Emp emp){
|
||||
empService.add(emp);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/findById/{empId}")
|
||||
public Result<Emp> findById(@PathVariable("empId") Integer empId){
|
||||
Emp emp = empService.findById(empId);
|
||||
return Result.success(emp);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Emp emp){
|
||||
empService.update(emp);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/del/{empId}")
|
||||
public Result del(@PathVariable("empId") Integer empId){
|
||||
empService.del(empId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDel/{empIds}")
|
||||
public Result batchDel(@PathVariable("empIds") Integer[] empIds){
|
||||
empService.batchDel(empIds);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.bwie.manage.controller;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.manage.service.ManagerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.controller
|
||||
* @Description TODO 管理员
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager")
|
||||
public class ManageController {
|
||||
|
||||
@Autowired
|
||||
private ManagerService managerService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public Result<PageResult<EmpResponse>> list(@RequestBody EmpRequest empRequest){
|
||||
return managerService.list(empRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public Result add(@RequestBody Emp emp){
|
||||
managerService.add(emp);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/findById/{empId}")
|
||||
public Result<Emp> findById(@PathVariable("empId") Integer empId){
|
||||
Emp emp = managerService.findById(empId);
|
||||
return Result.success(emp);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public Result update(@RequestBody Emp emp){
|
||||
managerService.update(emp);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/del/{empId}")
|
||||
public Result del(@PathVariable("empId") Integer empId){
|
||||
managerService.del(empId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDel/{empIds}")
|
||||
public Result batchDel(@PathVariable("empIds") Integer[] empIds){
|
||||
managerService.batchDel(empIds);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.bwie.manage.mapper;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.mapper
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmpMapper {
|
||||
|
||||
/**
|
||||
* 员工列表
|
||||
* @param empRequest
|
||||
* @return
|
||||
*/
|
||||
List<EmpResponse> list(EmpRequest empRequest);
|
||||
|
||||
/**
|
||||
* 添加员工
|
||||
* @param emp
|
||||
*/
|
||||
void add(Emp emp);
|
||||
|
||||
/**
|
||||
* 员工回显
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
Emp findById(@Param("empId") Integer empId);
|
||||
|
||||
/**
|
||||
* 编辑员工
|
||||
* @param emp
|
||||
*/
|
||||
void update(Emp emp);
|
||||
|
||||
/**
|
||||
* 删除员工
|
||||
* @param empId
|
||||
*/
|
||||
void del(@Param("empId") Integer empId);
|
||||
|
||||
/**
|
||||
* 批量删除员工
|
||||
* @param empIds
|
||||
*/
|
||||
void batchDel(@Param("empIds") Integer[] empIds);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.bwie.manage.mapper;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.mapper
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ManagerMapper {
|
||||
/**
|
||||
* 管理员列表
|
||||
* @param empRequest
|
||||
* @return
|
||||
*/
|
||||
List<EmpResponse> list(EmpRequest empRequest);
|
||||
|
||||
/**
|
||||
* 添加管理员
|
||||
* @param emp
|
||||
*/
|
||||
void add(Emp emp);
|
||||
|
||||
/**
|
||||
* 管理员回显
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
Emp findById(@Param("empId") Integer empId);
|
||||
|
||||
/**
|
||||
* 编辑管理员
|
||||
* @param emp
|
||||
*/
|
||||
void update(Emp emp);
|
||||
|
||||
/**
|
||||
* 删除管理员
|
||||
* @param empId
|
||||
*/
|
||||
void del(@Param("empId") Integer empId);
|
||||
|
||||
/**
|
||||
* 批量删除管理员
|
||||
* @param empIds
|
||||
*/
|
||||
void batchDel(@Param("empIds") Integer[] empIds);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.bwie.manage.service;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.service
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface EmpService {
|
||||
/**
|
||||
* 员工分页列表
|
||||
* @param empRequest
|
||||
* @return
|
||||
*/
|
||||
Result<PageResult<EmpResponse>> list(EmpRequest empRequest);
|
||||
|
||||
/**
|
||||
* 添加员工
|
||||
* @param emp
|
||||
*/
|
||||
void add(Emp emp);
|
||||
|
||||
/**
|
||||
* 回显员工信息
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
Emp findById(Integer empId);
|
||||
|
||||
/**
|
||||
* 编辑员工
|
||||
* @param emp
|
||||
*/
|
||||
void update(Emp emp);
|
||||
|
||||
/**
|
||||
* 删除员工
|
||||
* @param empId
|
||||
*/
|
||||
void del(Integer empId);
|
||||
|
||||
/**
|
||||
* 批量删除员工
|
||||
* @param empIds
|
||||
*/
|
||||
void batchDel(Integer[] empIds);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.bwie.manage.service;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.service
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface ManagerService {
|
||||
/**
|
||||
* 管理员列表
|
||||
* @param empRequest
|
||||
* @return
|
||||
*/
|
||||
Result<PageResult<EmpResponse>> list(EmpRequest empRequest);
|
||||
|
||||
/**
|
||||
* 添加管理员
|
||||
* @param emp
|
||||
*/
|
||||
void add(Emp emp);
|
||||
|
||||
/**
|
||||
* 管理员信息回显
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
Emp findById(Integer empId);
|
||||
|
||||
/**
|
||||
* 编辑管理员
|
||||
* @param emp
|
||||
*/
|
||||
void update(Emp emp);
|
||||
|
||||
/**
|
||||
* 删除管理员
|
||||
* @param empId
|
||||
*/
|
||||
void del(Integer empId);
|
||||
|
||||
/**
|
||||
* 批量删除管理员
|
||||
* @param empIds
|
||||
*/
|
||||
void batchDel(Integer[] empIds);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.bwie.manage.service.impl;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.manage.mapper.EmpMapper;
|
||||
import com.bwie.manage.service.EmpService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.service.impl
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class EmpServiceImpl implements EmpService {
|
||||
|
||||
@Autowired
|
||||
private EmpMapper empMapper;
|
||||
|
||||
@Override
|
||||
public Result<PageResult<EmpResponse>> list(EmpRequest empRequest) {
|
||||
PageHelper.startPage(empRequest.getPageNum(),empRequest.getPageSize());
|
||||
List<EmpResponse> list = empMapper.list(empRequest);
|
||||
PageInfo<EmpResponse> info = new PageInfo<>(list);
|
||||
return PageResult.toResult(info.getTotal(), list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Emp emp) {
|
||||
empMapper.add(emp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Emp findById(Integer empId) {
|
||||
return empMapper.findById(empId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Emp emp) {
|
||||
empMapper.update(emp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(Integer empId) {
|
||||
empMapper.del(empId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDel(Integer[] empIds) {
|
||||
empMapper.batchDel(empIds);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.bwie.manage.service.impl;
|
||||
|
||||
import com.bwie.common.domain.Emp;
|
||||
import com.bwie.common.domain.request.EmpRequest;
|
||||
import com.bwie.common.domain.response.EmpResponse;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.manage.mapper.ManagerMapper;
|
||||
import com.bwie.manage.service.ManagerService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: GG-market
|
||||
* @PackageName: com.bwie.manage.service.impl
|
||||
* @Description TODO
|
||||
* @Author LiYonJie
|
||||
* @Date 2023/11/17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class ManagerServiceImpl implements ManagerService {
|
||||
|
||||
@Autowired
|
||||
private ManagerMapper managerMapper;
|
||||
|
||||
@Override
|
||||
public Result<PageResult<EmpResponse>> list(EmpRequest empRequest) {
|
||||
PageHelper.startPage(empRequest.getPageNum(),empRequest.getPageSize());
|
||||
List<EmpResponse> list = managerMapper.list(empRequest);
|
||||
PageInfo<EmpResponse> info = new PageInfo<>(list);
|
||||
return PageResult.toResult(info.getTotal(), list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Emp emp) {
|
||||
managerMapper.add(emp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Emp findById(Integer empId) {
|
||||
return managerMapper.findById(empId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Emp emp) {
|
||||
managerMapper.update(emp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(Integer empId) {
|
||||
managerMapper.del(empId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDel(Integer[] empIds) {
|
||||
managerMapper.batchDel(empIds);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 10003
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: work-manage
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.73.129:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: market
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 192.168.73.129:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: market
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
fdfs:
|
||||
# socket 连接时长
|
||||
so-timeout: 1500
|
||||
# 连接 tracker 服务器超时时长
|
||||
connect-timeout: 600
|
||||
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||
tracker-list: 121.36.202.181:22122
|
||||
web-server-url: 121.36.202.181:8888
|
||||
pool:
|
||||
jmx-enabled: false
|
||||
# 生成缩略图
|
||||
thumb-image:
|
||||
height: 500
|
||||
width: 500
|
||||
|
||||
aliyun:
|
||||
oss:
|
||||
file:
|
||||
bucketName: arklorse
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
AccessKeyId: LTAI5tKXvCvwq7hKpZgsY2hk
|
||||
AccessKeySecret: HaOTCePEpeLNukQL3jhR6DZu9CAnmA
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<!-- mybatis数据层 namespace命名空间-->
|
||||
<mapper namespace="com.bwie.manage.mapper.EmpMapper">
|
||||
|
||||
<select id="list" resultType="com.bwie.common.domain.response.EmpResponse">
|
||||
<include refid="com.bwie.manage.mapper.ManagerMapper.selectEmpVo"/>
|
||||
<where>
|
||||
er.role_id = 4
|
||||
<if test="null != empId">
|
||||
and e.emp_id = #{empId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal)
|
||||
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
|
||||
</insert>
|
||||
|
||||
<select id="findById" resultType="com.bwie.common.domain.Emp">
|
||||
<include refid="com.bwie.manage.mapper.ManagerMapper.selectEmpVo"/> where e.emp_id = #{empId}
|
||||
</select>
|
||||
|
||||
<update id="update">
|
||||
update tb_employee set
|
||||
emp_name = #{empName},
|
||||
username = #{username},
|
||||
password = #{password},
|
||||
emp_tel = #{empTel},
|
||||
emp_id_card = #{empIdCard},
|
||||
emp_age = #{empAge},
|
||||
emp_gender = #{empGender},
|
||||
emp_address = #{empAddress},
|
||||
emp_sal = #{empSal}
|
||||
where emp_id = #{empId}
|
||||
</update>
|
||||
|
||||
<delete id="del">
|
||||
delete from tb_employee where emp_id = #{empId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDel">
|
||||
delete from tb_employee where emp_id in
|
||||
<foreach collection="empIds" item="empId" open="(" close=")" separator=",">
|
||||
#{empId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<!-- mybatis数据层 namespace命名空间-->
|
||||
<mapper namespace="com.bwie.manage.mapper.ManagerMapper">
|
||||
|
||||
<sql id="selectEmpVo">
|
||||
select e.emp_id,
|
||||
e.emp_name,
|
||||
e.username,
|
||||
e.password,
|
||||
e.emp_tel,
|
||||
e.emp_id_card,
|
||||
e.emp_age,
|
||||
e.emp_gender,
|
||||
e.emp_address,
|
||||
e.emp_sal,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
p.post_id,
|
||||
p.post_name
|
||||
from tb_employee e
|
||||
left join tb_emp_role er on e.emp_id = er.emp_id
|
||||
left join tb_role r on er.role_id = r.role_id
|
||||
left join tb_emp_post ep on e.emp_id = ep.emp_id
|
||||
left join tb_post p on ep.post_id = p.post_id
|
||||
</sql>
|
||||
|
||||
<select id="list" resultType="com.bwie.common.domain.response.EmpResponse">
|
||||
<include refid="selectEmpVo"/>
|
||||
<where>
|
||||
er.role_id = 2 or er.role_id = 3
|
||||
<if test="null != empName and '' != empName">
|
||||
and e.emp_name like concat('%',#{empName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal)
|
||||
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
|
||||
</insert>
|
||||
|
||||
<select id="findById" resultType="com.bwie.common.domain.Emp">
|
||||
<include refid="selectEmpVo"/> where e.emp_id = #{empId}
|
||||
</select>
|
||||
|
||||
<update id="update">
|
||||
update tb_employee set
|
||||
emp_name = #{empName},
|
||||
username = #{username},
|
||||
password = #{password},
|
||||
emp_tel = #{empTel},
|
||||
emp_id_card = #{empIdCard},
|
||||
emp_age = #{empAge},
|
||||
emp_gender = #{empGender},
|
||||
emp_address = #{empAddress},
|
||||
emp_sal = #{empSal}
|
||||
where emp_id = #{empId}
|
||||
</update>
|
||||
|
||||
<delete id="del">
|
||||
delete from tb_employee where emp_id = #{empId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDel">
|
||||
delete from tb_employee where emp_id in
|
||||
<foreach collection="empIds" item="empId" open="(" close=")" separator=",">
|
||||
#{empId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue