Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
deca2c0b
Commit
deca2c0b
authored
Apr 09, 2025
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
a037ef44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
HaobanRoleTest0410.java
haoban-manage3-service/src/test/java/HaobanRoleTest0410.java
+107
-0
No files found.
haoban-manage3-service/src/test/java/HaobanRoleTest0410.java
0 → 100644
View file @
deca2c0b
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMapper
;
import
com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.role.TabHaobanRole
;
import
com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
public
class
HaobanRoleTest0410
{
@Autowired
private
TabHaobanRoleMenuMapper
haobanRoleMenuMapper
;
@Autowired
private
TabHaobanRoleMapper
haobanRoleMapper
;
@Autowired
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Test
public
void
test
()
{
List
<
TabHaobanWxEnterprise
>
list
=
this
.
wxEnterpriseMapper
.
listAll
()
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
this
.
add
(
list
.
get
(
i
).
getWxEnterpriseId
());
}
}
private
List
<
String
>
existList
(
String
wxEnterpriseId
,
Long
roleId
,
List
<
String
>
ms
)
{
List
<
String
>
list
=
this
.
haobanRoleMenuMapper
.
getMenuInMenuCodes
(
wxEnterpriseId
,
roleId
,
ms
)
;
if
(
null
==
list
)
{
list
=
new
ArrayList
<>()
;
}
return
list
;
}
private
void
add
(
String
wxEnterpriseId
)
{
List
<
TabHaobanRoleMenu
>
addList
=
new
ArrayList
<>()
;
List
<
TabHaobanRole
>
list
=
this
.
haobanRoleMapper
.
getListByWxEnterpriseId
(
wxEnterpriseId
,
null
)
;
for
(
TabHaobanRole
role
:
list
)
{
if
(
role
.
getClerkType
()==
0
)
{
List
<
String
>
ms
=
Arrays
.
asList
(
"goalSetting"
,
"performanceDiagnosis"
)
;
List
<
String
>
existMenus
=
this
.
existList
(
wxEnterpriseId
,
role
.
getRoleId
(),
ms
)
;
for
(
String
s
:
ms
)
{
TabHaobanRoleMenu
m
=
new
TabHaobanRoleMenu
();
m
.
setRoleMenuId
(
UniqueIdUtils
.
uniqueLong
());
m
.
setMenuCode
(
s
);
m
.
setStatusFlag
(
1
);
m
.
setCreateTime
(
new
Date
());
m
.
setUpdateTime
(
new
Date
());
m
.
setWxEnterpriseId
(
wxEnterpriseId
);
m
.
setRoleId
(
role
.
getRoleId
());
if
(!
existMenus
.
contains
(
s
))
{
addList
.
add
(
m
);
}
}
}
else
if
(
role
.
getClerkType
()==
1
)
{
List
<
String
>
ms
=
Arrays
.
asList
(
"goalSetting"
,
"performanceDiagnosis"
)
;
List
<
String
>
existMenus
=
this
.
existList
(
wxEnterpriseId
,
role
.
getRoleId
(),
ms
)
;
for
(
String
s
:
ms
)
{
TabHaobanRoleMenu
m
=
new
TabHaobanRoleMenu
()
;
m
.
setRoleMenuId
(
UniqueIdUtils
.
uniqueLong
());
m
.
setMenuCode
(
s
);
m
.
setStatusFlag
(
1
);
m
.
setCreateTime
(
new
Date
());
m
.
setUpdateTime
(
new
Date
());
m
.
setWxEnterpriseId
(
wxEnterpriseId
);
m
.
setRoleId
(
role
.
getRoleId
());
if
(!
existMenus
.
contains
(
s
))
{
addList
.
add
(
m
);
}
}
}
else
if
(
role
.
getClerkType
()==
2
)
{
List
<
String
>
ms
=
Arrays
.
asList
(
"performanceDiagnosis"
)
;
List
<
String
>
existMenus
=
this
.
existList
(
wxEnterpriseId
,
role
.
getRoleId
(),
ms
)
;
for
(
String
s
:
ms
)
{
TabHaobanRoleMenu
m
=
new
TabHaobanRoleMenu
()
;
m
.
setRoleMenuId
(
UniqueIdUtils
.
uniqueLong
());
m
.
setMenuCode
(
s
);
m
.
setStatusFlag
(
1
);
m
.
setCreateTime
(
new
Date
());
m
.
setUpdateTime
(
new
Date
());
m
.
setWxEnterpriseId
(
wxEnterpriseId
);
m
.
setRoleId
(
role
.
getRoleId
());
if
(!
existMenus
.
contains
(
s
))
{
addList
.
add
(
m
);
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
addList
))
{
System
.
out
.
println
(
"*********************"
+
addList
.
size
());
this
.
haobanRoleMenuMapper
.
insertBatch
(
addList
);
}
}
}
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