Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
3ad83ec2
Commit
3ad83ec2
authored
Dec 11, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取用户是否参加活动
parent
c4499b84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
17 deletions
+45
-17
ActivityPopularizeUserBiz.java
...xxfc/platform/activity/biz/ActivityPopularizeUserBiz.java
+45
-17
No files found.
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeUserBiz.java
View file @
3ad83ec2
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
org.springframework.stereotype.Service
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.activity.entity.ActivityPopularizeUser
;
import
com.xxfc.platform.activity.mapper.ActivityPopularizeUserMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户与推广活动(邀请有礼)的关系表
...
...
@@ -19,19 +21,45 @@ import java.util.List;
* @date 2019-07-05 15:23:04
*/
@Service
public
class
ActivityPopularizeUserBiz
extends
BaseBiz
<
ActivityPopularizeUserMapper
,
ActivityPopularizeUser
>
{
public
ActivityPopularizeUser
insertSelectiveReT
(
ActivityPopularizeUser
entity
)
{
if
(
insertSelectiveRe
(
entity
)
>
0
)
{
return
selectById
(
entity
.
getId
());
}
else
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
}
public
class
ActivityPopularizeUserBiz
extends
BaseBiz
<
ActivityPopularizeUserMapper
,
ActivityPopularizeUser
>
{
public
ActivityPopularizeUser
insertSelectiveReT
(
ActivityPopularizeUser
entity
)
{
if
(
insertSelectiveRe
(
entity
)
>
0
)
{
return
selectById
(
entity
.
getId
());
}
else
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
}
public
void
deleteByUserIds
(
List
<
Integer
>
userIds
)
{
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIn
(
"userId"
,
userIds
);
mapper
.
deleteByExample
(
example
);
}
public
void
deleteByUserIds
(
List
<
Integer
>
userIds
)
{
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIn
(
"userId"
,
userIds
);
mapper
.
deleteByExample
(
example
);
}
public
Map
<
String
,
Object
>
getByUserIdAndPopularizeId
(
Integer
userId
,
List
<
Integer
>
popularizeIds
)
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
if
(
userId
==
null
||
popularizeIds
==
null
)
{
return
map
;
}
map
.
put
(
"userId"
,
userId
);
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userId"
,
userId
);
criteria
.
andIn
(
"popularizeId"
,
popularizeIds
);
List
<
ActivityPopularizeUser
>
activityPopularizeUsers
=
mapper
.
selectByExample
(
example
);
if
(
activityPopularizeUsers
==
null
||
activityPopularizeUsers
.
size
()
<=
0
)
{
return
map
;
}
List
<
Map
<
Integer
,
Boolean
>>
activityIds
=
Lists
.
newArrayList
();
activityPopularizeUsers
.
parallelStream
().
forEach
(
result
->
{
if
(
popularizeIds
.
contains
(
result
.
getPopularizeId
()))
{
Map
<
Integer
,
Boolean
>
map1
=
Maps
.
newHashMap
();
map1
.
put
(
result
.
getPopularizeId
(),
true
);
activityIds
.
add
(
map1
);
}
});
map
.
put
(
"popularizeIds"
,
activityIds
);
return
map
;
}
}
\ 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