Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
4e629763
Commit
4e629763
authored
May 18, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增实体类
parent
b4a9f8cb
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
944 additions
and
0 deletions
+944
-0
RB_Emp_Config.cs
Mall.Model/Entity/User/RB_Emp_Config.cs
+73
-0
RB_Employee.cs
Mall.Model/Entity/User/RB_Employee.cs
+87
-0
RB_Role.cs
Mall.Model/Entity/User/RB_Role.cs
+80
-0
RB_Emp_Config_Extend.cs
Mall.Model/Extend/User/RB_Emp_Config_Extend.cs
+18
-0
RB_Employee_Extend.cs
Mall.Model/Extend/User/RB_Employee_Extend.cs
+18
-0
RB_Role_Extend.cs
Mall.Model/Extend/User/RB_Role_Extend.cs
+17
-0
EmployeeModule.cs
Mall.Module.User/EmployeeModule.cs
+233
-0
RB_Emp_ConfigRepository.cs
Mall.Repository/User/RB_Emp_ConfigRepository.cs
+66
-0
RB_EmployeeRepository.cs
Mall.Repository/User/RB_EmployeeRepository.cs
+75
-0
RB_RoleRepository.cs
Mall.Repository/User/RB_RoleRepository.cs
+75
-0
EmployeeController.cs
Mall.WebApi/Controllers/User/EmployeeController.cs
+202
-0
No files found.
Mall.Model/Entity/User/RB_Emp_Config.cs
0 → 100644
View file @
4e629763
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 员工基础设置表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Emp_Config
{
/// <summary>
/// 配置编号
/// </summary>
public
int
ConfigId
{
get
;
set
;
}
/// <summary>
/// 修改密码状态(0-不能修改,1-可以修改)
/// </summary>
public
int
?
IsUpdatePwd
{
get
;
set
;
}
/// <summary>
/// 员工页面LOGO
/// </summary>
public
string
Logo
{
get
;
set
;
}
/// <summary>
/// 员工页面版权信息
/// </summary>
public
string
Copyright
{
get
;
set
;
}
/// <summary>
/// 员工页面版权链接
/// </summary>
public
string
CopyrightLink
{
get
;
set
;
}
/// <summary>
/// 商户号Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序Id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Employee.cs
0 → 100644
View file @
4e629763
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 员工基础设置表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Employee
{
/// <summary>
/// 员工编号
/// </summary>
public
int
EmpId
{
get
;
set
;
}
/// <summary>
/// 员工账号
/// </summary>
public
string
EmpAccount
{
get
;
set
;
}
/// <summary>
/// 员工密码
/// </summary>
public
string
EmpPwd
{
get
;
set
;
}
/// <summary>
/// 员工姓名
/// </summary>
public
string
EmpName
{
get
;
set
;
}
/// <summary>
/// 角色Id
/// </summary>
public
string
RoleAuth
{
get
;
set
;
}
/// <summary>
/// 商户号Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序Id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 状态(0-正常,1-删除)
/// </summary>
public
int
?
Status
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Role.cs
0 → 100644
View file @
4e629763
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 角色表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Role
{
/// <summary>
/// 角色编号
/// </summary>
public
int
RoleId
{
get
;
set
;
}
/// <summary>
/// 角色名称
/// </summary>
public
string
RoleName
{
get
;
set
;
}
/// <summary>
/// 备注/描述
/// </summary>
public
string
RoleIntro
{
get
;
set
;
}
/// <summary>
/// 角色权限
/// </summary>
public
string
RoleAuth
{
get
;
set
;
}
/// <summary>
/// 商户号Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序Id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 状态(0-正常,1-删除)
/// </summary>
public
int
?
Status
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Emp_Config_Extend.cs
0 → 100644
View file @
4e629763
using
System
;
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 员工基础设置表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Emp_Config_Extend
:
Model
.
Entity
.
User
.
RB_Emp_Config
{
}
}
Mall.Model/Extend/User/RB_Employee_Extend.cs
0 → 100644
View file @
4e629763
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 员工基础设置表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Employee_Extend
:
Model
.
Entity
.
User
.
RB_Employee
{
}
}
\ No newline at end of file
Mall.Model/Extend/User/RB_Role_Extend.cs
0 → 100644
View file @
4e629763
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 角色表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Role_Extend
:
Model
.
Entity
.
User
.
RB_Role
{
}
}
\ No newline at end of file
Mall.Module.User/EmployeeModule.cs
0 → 100644
View file @
4e629763
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
Mall.Repository
;
using
Mall.Repository.User
;
using
System.Linq
;
namespace
Mall.Module.User
{
/// <summary>
/// 员工相关处理类
/// </summary>
public
class
EmployeeModule
{
/// <summary>
/// 角色管理仓储层对象
/// </summary>
private
readonly
RB_RoleRepository
roleRepository
=
new
RB_RoleRepository
();
/// <summary>
/// 员工管理仓储层对象
/// </summary>
private
readonly
RB_EmployeeRepository
employeeRepository
=
new
RB_EmployeeRepository
();
/// <summary>
/// 员工配置仓储层对象
/// </summary>
private
readonly
RB_Emp_ConfigRepository
emp_ConfigRepository
=
new
RB_Emp_ConfigRepository
();
#
region
角色管理
/// <summary>
/// 角色分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Role_Extend
>
GetRolePageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Role_Extend
query
)
{
return
roleRepository
.
GetRolePageListRepository
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
}
/// <summary>
/// 获取角色列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Role_Extend
>
GetRoleListModule
(
RB_Role_Extend
query
)
{
return
roleRepository
.
GetRoleListRepository
(
query
);
}
/// <summary>
/// 新增修改角色
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetRoleModule
(
RB_Role_Extend
extModel
)
{
bool
flag
=
false
;
if
(
extModel
.
RoleId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Role_Extend
.
RoleName
),
extModel
.
RoleName
.
Trim
()},
{
nameof
(
RB_Role_Extend
.
RoleIntro
),
extModel
.
RoleIntro
},
{
nameof
(
RB_Role_Extend
.
RoleAuth
),
extModel
.
RoleAuth
},
};
flag
=
roleRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Role_Extend
.
RoleId
),
extModel
.
RoleId
));
}
else
{
var
newId
=
roleRepository
.
Insert
(
extModel
);
extModel
.
RoleId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 获取角色实体
/// </summary>
/// <param name="RoleId"></param>
/// <returns></returns>
public
RB_Role_Extend
GetRoleModule
(
object
RoleId
)
{
return
roleRepository
.
GetEntity
<
RB_Role_Extend
>(
RoleId
);
}
/// <summary>
/// 删除角色
/// </summary>
/// <param name="RoleId"></param>
/// <returns></returns>
public
bool
RemoveRoleModule
(
object
RoleId
)
{
bool
flag
=
false
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Role_Extend
.
Status
),
1
},
};
flag
=
roleRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Role_Extend
.
RoleId
),
RoleId
));
return
flag
;
}
#
endregion
#
region
员工管理
/// <summary>
/// 员工分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Employee_Extend
>
GetEmployeePageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Employee_Extend
query
)
{
return
employeeRepository
.
GetEmployeePageListRepository
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
}
/// <summary>
/// 获取员工列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Employee_Extend
>
GetEmployeeListModule
(
RB_Employee_Extend
query
)
{
return
employeeRepository
.
GetEmployeeListRepository
(
query
);
}
/// <summary>
/// 新增修改员工
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetEmployeeModule
(
RB_Employee_Extend
extModel
)
{
bool
flag
=
false
;
if
(
extModel
.
EmpId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Employee_Extend
.
EmpAccount
),
extModel
.
EmpAccount
.
Trim
()},
{
nameof
(
RB_Employee_Extend
.
EmpPwd
),
extModel
.
EmpPwd
},
{
nameof
(
RB_Employee_Extend
.
EmpName
),
extModel
.
EmpName
},
{
nameof
(
RB_Employee_Extend
.
RoleAuth
),
extModel
.
RoleAuth
},
};
flag
=
employeeRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Employee_Extend
.
EmpId
),
extModel
.
EmpId
));
}
else
{
var
newId
=
employeeRepository
.
Insert
(
extModel
);
extModel
.
EmpId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 获取员工实体
/// </summary>
/// <param name="EmpId"></param>
/// <returns></returns>
public
RB_Employee_Extend
GetEmployeeModule
(
object
EmpId
)
{
return
employeeRepository
.
GetEntity
<
RB_Employee_Extend
>(
EmpId
);
}
/// <summary>
/// 删除员工
/// </summary>
/// <param name="EmpId"></param>
/// <returns></returns>
public
bool
RemoveEmployeeModule
(
object
EmpId
)
{
bool
flag
=
false
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Employee_Extend
.
Status
),
1
},
};
flag
=
roleRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Employee_Extend
.
EmpId
),
EmpId
));
return
flag
;
}
#
endregion
#
region
员工配置
/// <summary>
/// 获取员工配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
RB_Emp_Config_Extend
GetEmpConfigListModule
(
RB_Emp_Config_Extend
query
)
{
return
emp_ConfigRepository
.
GetEmpConfigListRepository
(
query
)?.
FirstOrDefault
();
}
/// <summary>
/// 新增修改员工配置
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetEmpConfigModule
(
RB_Emp_Config_Extend
extModel
)
{
bool
flag
=
false
;
if
(
extModel
.
ConfigId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Emp_Config_Extend
.
IsUpdatePwd
),
extModel
.
IsUpdatePwd
},
{
nameof
(
RB_Emp_Config_Extend
.
Logo
),
extModel
.
Logo
},
{
nameof
(
RB_Emp_Config_Extend
.
Copyright
),
extModel
.
Copyright
},
{
nameof
(
RB_Emp_Config_Extend
.
CopyrightLink
),
extModel
.
CopyrightLink
},
};
flag
=
emp_ConfigRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Emp_Config_Extend
.
ConfigId
),
extModel
.
ConfigId
));
}
else
{
var
newId
=
emp_ConfigRepository
.
Insert
(
extModel
);
extModel
.
ConfigId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
#
endregion
}
}
\ No newline at end of file
Mall.Repository/User/RB_Emp_ConfigRepository.cs
0 → 100644
View file @
4e629763
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System.Linq
;
namespace
Mall.Repository.User
{
/// <summary>
/// 员工基础配置仓储层
/// </summary>
public
class
RB_Emp_ConfigRepository
:
RepositoryBase
<
RB_Emp_Config
>
{
/// <summary>
/// 员工配置分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Emp_Config_Extend
>
GetEmpConfigPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Emp_Config_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Emp_Config WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
ConfigId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
ConfigId
),
query
.
ConfigId
);
}
return
GetPage
<
RB_Emp_Config_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取员工配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Emp_Config_Extend
>
GetEmpConfigListRepository
(
RB_Emp_Config_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Emp_Config WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
ConfigId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Emp_Config_Extend
.
ConfigId
),
query
.
ConfigId
);
}
return
Get
<
RB_Emp_Config_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
\ No newline at end of file
Mall.Repository/User/RB_EmployeeRepository.cs
0 → 100644
View file @
4e629763
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System.Linq
;
namespace
Mall.Repository.User
{
/// <summary>
/// 员工表仓储层
/// </summary>
public
class
RB_EmployeeRepository
:
RepositoryBase
<
RB_Employee
>
{
/// <summary>
/// 员工分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Employee_Extend
>
GetEmployeePageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Employee_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Employee WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
EmpId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
EmpId
),
query
.
EmpId
);
}
if
(
query
.
EmpName
!=
null
&&
!
string
.
IsNullOrEmpty
(
query
.
EmpName
.
Trim
()))
{
builder
.
AppendFormat
(
" AND {0} LIKE '%{1}%' "
,
nameof
(
RB_Employee_Extend
.
EmpName
),
query
.
EmpName
.
Trim
());
}
return
GetPage
<
RB_Employee_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取员工列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Employee_Extend
>
GetEmployeeListRepository
(
RB_Employee_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Employee WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
EmpId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Employee_Extend
.
EmpId
),
query
.
EmpId
);
}
if
(
query
.
EmpName
!=
null
&&
!
string
.
IsNullOrEmpty
(
query
.
EmpName
.
Trim
()))
{
builder
.
AppendFormat
(
" AND {0} LIKE '%{1}%' "
,
nameof
(
RB_Employee_Extend
.
EmpName
),
query
.
EmpName
.
Trim
());
}
return
Get
<
RB_Employee_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
\ No newline at end of file
Mall.Repository/User/RB_RoleRepository.cs
0 → 100644
View file @
4e629763
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System.Linq
;
namespace
Mall.Repository.User
{
/// <summary>
/// 角色表仓储层
/// </summary>
public
class
RB_RoleRepository
:
RepositoryBase
<
RB_Role
>
{
/// <summary>
/// 角色分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Role_Extend
>
GetRolePageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Role_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Role WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
RoleId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
RoleId
),
query
.
RoleId
);
}
if
(
query
.
RoleName
!=
null
&&
!
string
.
IsNullOrEmpty
(
query
.
RoleName
.
Trim
()))
{
builder
.
AppendFormat
(
" AND {0} LIKE '%{1}%' "
,
nameof
(
RB_Role_Extend
.
RoleName
),
query
.
RoleName
.
Trim
());
}
return
GetPage
<
RB_Role_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取角色列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Role_Extend
>
GetRoleListRepository
(
RB_Role_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Role WHERE 1=1 AND Status=0 "
);
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
RoleId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Role_Extend
.
RoleId
),
query
.
RoleId
);
}
if
(
query
.
RoleName
!=
null
&&
!
string
.
IsNullOrEmpty
(
query
.
RoleName
.
Trim
()))
{
builder
.
AppendFormat
(
" AND {0} LIKE '%{1}%' "
,
nameof
(
RB_Role_Extend
.
RoleName
),
query
.
RoleName
.
Trim
());
}
return
Get
<
RB_Role_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/EmployeeController.cs
0 → 100644
View file @
4e629763
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.Model.Extend.User
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Mall.Common.Plugin
;
using
Mall.Common.Enum.User
;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.Model.Entity.User
;
namespace
Mall.WebApi.Controllers.User
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
EmployeeController
:
BaseController
{
/// <summary>
/// 员工相关处理类对象
/// </summary>
private
readonly
EmployeeModule
module
=
new
EmployeeModule
();
#
region
角色管理
/// <summary>
/// 角色分页列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetRolePageList
()
{
ResultPageModel
pageModel
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Role_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
module
.
GetRolePageListModule
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
rowsCount
,
query
);
pageModel
.
count
=
Convert
.
ToInt32
(
rowsCount
);
pageModel
.
pageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取角色列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetRoleList
()
{
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Role_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
module
.
GetRoleListModule
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// 新增修改角色
/// </summary>
/// <returns></returns>
public
ApiResult
SetRole
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Role_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
Status
=
0
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
var
flag
=
module
.
SetRoleModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取角色实体
/// </summary>
/// <returns></returns>
public
ApiResult
GetRole
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
RoleId
=
parms
.
GetInt
(
"RoleId"
,
0
);
var
extModel
=
module
.
GetRoleModule
(
RoleId
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 删除角色
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveRole
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
RoleId
=
parms
.
GetInt
(
"RoleId"
,
0
);
var
flag
=
module
.
RemoveRoleModule
(
RoleId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
员工管理
/// <summary>
/// 员工分页列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetEmployeePageList
()
{
ResultPageModel
pageModel
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Employee_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
module
.
GetEmployeePageListModule
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
rowsCount
,
query
);
pageModel
.
count
=
Convert
.
ToInt32
(
rowsCount
);
pageModel
.
pageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取员工列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetEmployeeList
()
{
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Employee_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
module
.
GetEmployeeListModule
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// 新增修改员工
/// </summary>
/// <returns></returns>
public
ApiResult
SetEmployee
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Employee_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
Status
=
0
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
var
flag
=
module
.
SetEmployeeModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取员工实体
/// </summary>
/// <returns></returns>
public
ApiResult
GetEmployee
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
EmpId
=
parms
.
GetInt
(
"EmpId"
,
0
);
var
extModel
=
module
.
GetEmployeeModule
(
EmpId
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 删除员工
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveEmployee
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
EmpId
=
parms
.
GetInt
(
"EmpId"
,
0
);
var
flag
=
module
.
RemoveEmployeeModule
(
EmpId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
员工管理
/// <summary>
/// 获取员工配置列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetEmpConfigList
()
{
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Emp_Config_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
module
.
GetEmpConfigListModule
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// 新增修改员工配置
/// </summary>
/// <returns></returns>
public
ApiResult
SetEmpConfig
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Emp_Config_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
var
flag
=
module
.
SetEmpConfigModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment