Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
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
黄奎
Education
Commits
822ddba1
Commit
822ddba1
authored
Feb 26, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OKR评论调整
parent
01c759eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
593 additions
and
7 deletions
+593
-7
RB_OKR_Comment.cs
Edu.Model/Entity/OKR/RB_OKR_Comment.cs
+20
-0
RB_OKR_Comment_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
+20
-0
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+311
-5
RB_OKR_CommentRepository.cs
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
+119
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+123
-2
No files found.
Edu.Model/Entity/OKR/RB_OKR_Comment.cs
View file @
822ddba1
...
...
@@ -66,5 +66,25 @@ namespace Edu.Model.Entity.OKR
/// 修改时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 类型 1目标 2结果 3进度 4周期
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 目标/结果 id
/// </summary>
public
int
TargetId
{
get
;
set
;
}
/// <summary>
/// 上级评论id
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 标识
/// </summary>
public
string
Identify
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/OKR/RB_OKR_Comment_ViewModel.cs
View file @
822ddba1
...
...
@@ -28,5 +28,25 @@ namespace Edu.Model.ViewModel.OKR
/// 创建时间
/// </summary>
public
string
CreateTimeStr
{
get
;
set
;
}
/// <summary>
/// 选中字符
/// </summary>
public
string
CheckedName
{
get
;
set
;
}
/// <summary>
/// 查询类型 1只查询目标/结果的选中评论
/// </summary>
public
int
SelectType
{
get
;
set
;
}
/// <summary>
/// 父级ids
/// </summary>
public
string
ParentIds
{
get
;
set
;
}
/// <summary>
/// 子评论列表
/// </summary>
public
List
<
RB_OKR_Comment_ViewModel
>
ChildList
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.OKR/OKRPeriodModule.cs
View file @
822ddba1
This diff is collapsed.
Click to expand it.
Edu.Repository/OKR/RB_OKR_CommentRepository.cs
View file @
822ddba1
using
Edu.Common.Enum
;
using
Edu.Model.Entity.OKR
;
using
Edu.Model.ViewModel.OKR
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -45,6 +46,19 @@ namespace Edu.Repository.OKR
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_OKR_Comment_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
...
...
@@ -80,5 +94,110 @@ namespace Edu.Repository.OKR
string
sql
=
$@" select * from RB_OKR_Comment where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取分页列表(历史评论+选中评论)
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetCommentPageList_V2
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_OKR_Comment_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and c.State <> 3 and c.ParentId =0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
PeriodId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
PeriodId
)}
=
{
demodel
.
PeriodId
}
"
;
}
if
(
demodel
.
State
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(
demodel
.
AccountId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
if
(
demodel
.
SelectType
==
1
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
in(1,2,3)"
;
}
string
sql
=
$@" select c.*,e.EmName as UpdateByName from RB_OKR_Comment c
left join rb_employee e on c.UpdateBy = e.EmployeeId
where
{
where
}
order by c.Id asc"
;
return
GetPage
<
RB_OKR_Comment_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Comment_ViewModel
>
GetList_V2
(
RB_OKR_Comment_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and c.State <> 3"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
PeriodId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
PeriodId
)}
=
{
demodel
.
PeriodId
}
"
;
}
if
(
demodel
.
State
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
State
)}
=
{
demodel
.
State
}
"
;
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(
demodel
.
AccountId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
AccountId
)}
=
{
demodel
.
AccountId
}
"
;
}
if
(
demodel
.
Type
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
Type
)}
=
{
demodel
.
Type
}
"
;
}
if
(
demodel
.
TargetId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
TargetId
)}
=
{
demodel
.
TargetId
}
"
;
}
if
(
demodel
.
ParentId
>
0
)
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
=
{
demodel
.
ParentId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ParentIds
))
{
where
+=
$@" and c.
{
nameof
(
RB_OKR_Comment_ViewModel
.
ParentId
)}
in(
{
demodel
.
ParentIds
}
)"
;
}
string
sql
=
$@" select c.*,e.EmName as CreateByName,e.EmPhoto as CreateByIco from RB_OKR_Comment c
left join rb_employee e on c.CreateBy = e.EmployeeId
where
{
where
}
order by c.Id asc"
;
return
Get
<
RB_OKR_Comment_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
822ddba1
...
...
@@ -832,6 +832,35 @@ namespace Edu.WebApi.Controllers.OKR
var
list
=
okrPeriodModule
.
GetOKROthersObjectiveDropList
(
PeriodId
,
ObjectiveId
,
UserId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取他人的目标列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKROthersObjectiveDropListByName
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
//周期id
string
UserName
=
parms
.
GetStringValue
(
"UserName"
);
//用户名称
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
//当前目标
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
string
.
IsNullOrEmpty
(
UserName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递用户名称"
);
}
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递当前目标id"
);
}
var
list
=
okrPeriodModule
.
GetOKROthersObjectiveDropListByName
(
PeriodId
,
ObjectiveId
,
UserName
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
#
endregion
#
region
权限控制
...
...
@@ -1676,6 +1705,7 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
query
.
Type
=
4
;
var
list
=
okrPeriodModule
.
GetCommentPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
...
...
@@ -1706,7 +1736,9 @@ namespace Edu.WebApi.Controllers.OKR
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
),
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
),
Content
=
base
.
ParmJObj
.
GetStringValue
(
"Content"
),
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
)
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
),
Type
=
base
.
ParmJObj
.
GetInt
(
"Type"
,
0
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
,
0
)
};
if
(
extModel
.
PeriodId
<=
0
)
{
...
...
@@ -1750,11 +1782,100 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
ParamIsNull
(
message
:
"请传递评论状态!"
);
}
extModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
bool
flag
=
okrPeriodModule
.
Set
OKRComment
(
extModel
);
bool
flag
=
okrPeriodModule
.
Set
CommentStatus
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 新增评论状态
/// </summary>
/// <returns></returns>
public
ApiResult
SetOKRCheckedComment
()
{
var
userInfo
=
base
.
UserInfo
;
var
extModel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Comment_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
extModel
.
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
extModel
.
AccountId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
if
(
string
.
IsNullOrEmpty
(
extModel
.
CheckedName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递选中内容"
);
}
if
(
string
.
IsNullOrEmpty
(
extModel
.
Content
))
{
return
ApiResult
.
ParamIsNull
(
"请传递内容"
);
}
if
(
extModel
.
Type
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递类型"
);
}
if
(
extModel
.
TargetId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递目标/结果id"
);
}
extModel
.
CreateBy
=
userInfo
.
Id
;
extModel
.
State
=
1
;
extModel
.
CreateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateTime
=
System
.
DateTime
.
Now
;
extModel
.
UpdateBy
=
userInfo
.
Id
;
extModel
.
Group_Id
=
userInfo
.
Group_Id
;
bool
flag
=
okrPeriodModule
.
SetOKRCheckedComment
(
extModel
,
out
int
Id
);
return
flag
?
ApiResult
.
Success
(
""
,
Id
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCommentPageList_V2
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_OKR_Comment_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
),
State
=
base
.
ParmJObj
.
GetInt
(
"State"
,
0
),
PeriodId
=
base
.
ParmJObj
.
GetInt
(
"PeriodId"
,
0
),
AccountId
=
base
.
ParmJObj
.
GetInt
(
"AccountId"
,
0
),
SelectType
=
base
.
ParmJObj
.
GetInt
(
"SelectType"
,
0
)
};
if
(
query
.
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递期数"
);
}
if
(
query
.
AccountId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetCommentPageList_V2
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
UpdateByName
,
x
.
Content
,
x
.
Type
,
x
.
TargetId
,
x
.
Identify
,
x
.
State
,
CreateTimeStr
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
ChildList
=
x
.
ChildList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
CreateByName
,
z
.
CreateByIco
,
z
.
Content
,
z
.
Type
,
CreateTimeStr
=
z
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
})
});
return
ApiResult
.
Success
(
data
:
pageModel
);
}
#
endregion
...
...
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