Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
Laisi_AutoMES2
Overview
Overview
Details
Activity
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
jiawei.su
Laisi_AutoMES2
Commits
6a44de0c
Commit
6a44de0c
authored
Jan 20, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some update
parent
d46d88c5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
218 additions
and
4 deletions
+218
-4
FixtureToolsController.cs
...r/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
+131
-0
siger_automation_fixture_tools_category.cs
...itory/Entities/siger_automation_fixture_tools_category.cs
+2
-2
AutomationFixtureToolsCategoryRepository.cs
.../Repositories/AutomationFixtureToolsCategoryRepository.cs
+28
-0
IAutomationFixtureToolsCategoryRepository.cs
...es/Interface/IAutomationFixtureToolsCategoryRepository.cs
+2
-0
RequestFixtureToolsCategory.cs
...ayer.AccRepository/Request/RequestFixtureToolsCategory.cs
+25
-0
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+28
-0
DB.script
Server/Infrastructure/Script/DB.script
+2
-2
No files found.
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
View file @
6a44de0c
...
...
@@ -31,6 +31,137 @@ namespace Siger.ApiACC.Controllers
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
}
[
HttpGet
]
public
IActionResult
GetPageList
(
int
id
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
id
,
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
[
HttpPost
]
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureToolsCategory
req
)
{
var
data
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
req
.
name
);
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parent
=
""
;
if
(
req
.
parentid
.
ToInt
()
>
0
)
{
var
exsit
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
parentid
.
ToInt
());
if
(
exsit
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
else
{
parent
=
exsit
.
guid
;
}
}
var
entity
=
new
siger_automation_fixture_tools_category
{
name
=
req
.
name
,
parent
=
parent
,
guid
=
Guid
.
NewGuid
().
ToString
(),
projectId
=
ProjectId
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
};
_toolsCategoryRepository
.
Insert
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureToolsCategory
req
)
{
var
entity
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
id
);
var
data
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
req
.
name
&&
q
.
id
!=
req
.
id
);
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parent
=
""
;
if
(
req
.
parentid
.
ToInt
()
>
0
)
{
var
exsit
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
parentid
.
ToInt
());
if
(
exsit
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
else
{
parent
=
exsit
.
guid
;
}
}
entity
.
name
=
req
.
name
;
entity
.
parent
=
parent
;
entity
.
guid
=
Guid
.
NewGuid
().
ToString
();
entity
.
updatetime
=
DateTime
.
Now
;
_toolsCategoryRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpGet
]
public
IActionResult
Delete
(
int
id
)
{
var
entity
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Deletes
([
FromBody
]
RequestDeleteRange
req
)
{
if
(
req
.
ids
==
null
||
!
req
.
ids
.
Any
())
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
entities
=
_toolsCategoryRepository
.
GetList
(
t
=>
req
.
ids
.
Contains
(
t
.
id
)
&&
t
.
projectId
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
if
(!
entities
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
foreach
(
var
entity
in
entities
)
{
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
entity
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_category.cs
View file @
6a44de0c
...
...
@@ -12,9 +12,9 @@ namespace Siger.Middlelayer.AccRepository.Entities
public
string
parent
{
get
;
set
;
}
public
DateTime
create
T
ime
{
get
;
set
;
}
public
DateTime
create
t
ime
{
get
;
set
;
}
public
DateTime
?
update
T
ime
{
get
;
set
;
}
public
DateTime
?
update
t
ime
{
get
;
set
;
}
public
string
extend1
{
get
;
set
;
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsCategoryRepository.cs
View file @
6a44de0c
...
...
@@ -4,6 +4,8 @@ using System.Linq.Expressions;
using
Microsoft.EntityFrameworkCore
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -16,5 +18,31 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
)
{
Expression
<
Func
<
ResponseFixtureToolsCategory
,
bool
>>
FunNum
=
f
=>
true
;
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_category
join
p
in
_context
.
siger_automation_fixture_tools_category
on
q
.
parent
equals
p
.
guid
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseFixtureToolsCategory
{
id
=
q
.
id
,
name
=
q
.
name
,
parentid
=
p
==
null
?
0
:
p
.
id
,
parentname
=
p
.
name
??
""
,
parent
=
q
.
parent
,
guid
=
q
.
guid
,
createtime
=
q
.
createtime
.
ToString
(
ParameterConstant
.
DateTimeFormat
),
time
=
q
.
createtime
};
if
(
id
>
0
)
{
FunNum
=
q
=>
q
.
id
==
id
;
}
var
entities
=
query
.
Where
(
FunNum
).
OrderBy
(
q
=>
q
.
parentid
).
OrderBy
(
q
=>
q
.
createtime
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
FunNum
).
Count
();
return
new
PagedCollectionResult
<
ResponseFixtureToolsCategory
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsCategoryRepository.cs
View file @
6a44de0c
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -6,5 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsCategoryRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_category
>
{
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestFixtureToolsCategory.cs
0 → 100644
View file @
6a44de0c
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations
;
using
Siger.Middlelayer.Common.ModuleEnum
;
using
Siger.Middlelayer.Repository.Request
;
namespace
Siger.Middlelayer.AccRepository.Request
{
public
class
RequestAddFixtureToolsCategory
{
public
string
parentid
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
}
public
class
RequestUpdateFixtureToolsCategory
:
RequestAddFixtureToolsCategory
{
public
int
id
{
get
;
set
;
}
}
public
class
RequestDeleteRange
{
public
List
<
int
>
ids
{
get
;
set
;
}
=
new
List
<
int
>();
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/FixtureToolsCategory.cs
0 → 100644
View file @
6a44de0c
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseFixtureToolsCategory
{
public
int
id
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
int
parentid
{
get
;
set
;
}
public
string
parentname
{
get
;
set
;
}
public
string
guid
{
get
;
set
;
}
public
string
parent
{
get
;
set
;
}
public
DateTime
time
{
get
;
set
;
}
s
public
string
createtime
{
get
;
set
;
}
public
string
updatetime
{
get
;
set
;
}
public
string
extend1
{
get
;
set
;
}
}
}
Server/Infrastructure/Script/DB.script
View file @
6a44de0c
...
...
@@ -184,8 +184,8 @@ CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_category` (
`parent` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'siger_automation_fixture_tools_category.guid',
`projectid` int(11) NOT NULL,
`status` int(11) NOT NULL,
`create
T
ime` datetime(0) NOT NULL,
`update
T
ime` datetime(0) NULL DEFAULT NULL,
`create
t
ime` datetime(0) NOT NULL,
`update
t
ime` datetime(0) NULL DEFAULT NULL,
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
...
...
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