Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
a45e7414
Commit
a45e7414
authored
Jun 25, 2022
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mybatis-plus-join
parent
d6557609
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
pom.xml
+6
-0
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
+8
-3
src/main/java/cn/timer/api/dao/qyxx/CmsContentMapper.java
+2
-1
No files found.
pom.xml
View file @
a45e7414
...
@@ -312,6 +312,12 @@
...
@@ -312,6 +312,12 @@
<artifactId>
mybatis-plus
</artifactId>
<artifactId>
mybatis-plus
</artifactId>
<version>
3.3.0
</version>
<version>
3.3.0
</version>
</dependency>
</dependency>
<!-- mybatis-plus-join -->
<dependency>
<groupId>
com.github.yulichang
</groupId>
<artifactId>
mybatis-plus-join
</artifactId>
<version>
1.2.2
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok-maven-plugin -->
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok-maven-plugin -->
<!-- <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok-maven-plugin</artifactId>
<!-- <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok-maven-plugin</artifactId>
...
...
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
View file @
a45e7414
...
@@ -9,6 +9,7 @@ import java.util.TimerTask;
...
@@ -9,6 +9,7 @@ import java.util.TimerTask;
import
cn.timer.api.bean.qyxx.*
;
import
cn.timer.api.bean.qyxx.*
;
import
cn.timer.api.dto.qyxx.CmsContentReadDto
;
import
cn.timer.api.dto.qyxx.CmsContentReadDto
;
import
cn.timer.api.utils.redis.RedisUtil
;
import
cn.timer.api.utils.redis.RedisUtil
;
import
com.github.yulichang.query.MPJQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
@@ -147,9 +148,13 @@ public class CmsController {
...
@@ -147,9 +148,13 @@ public class CmsController {
for
(
CmsContentModular
cmsContentModular
:
list
)
{
for
(
CmsContentModular
cmsContentModular
:
list
)
{
// 分类模块id
// 分类模块id
Integer
id
=
cmsContentModular
.
getId
();
Integer
id
=
cmsContentModular
.
getId
();
QueryWrapper
<
CmsContent
>
queryWrapper
=
new
QueryWrapper
<>();
MPJQueryWrapper
<
CmsContent
>
queryWrapper
=
new
MPJQueryWrapper
<>();
queryWrapper
.
select
(
"id"
,
"modularid"
,
"title"
,
"author"
,
"releasetime"
).
eq
(
"releasestate"
,
0
)
queryWrapper
.
select
(
"t.id"
,
"t.modularid"
,
"t.title"
,
"t.author"
,
"t.releasetime"
)
.
eq
(
"organization_id"
,
userBean
.
getOrgCode
()).
orderByDesc
(
"releasetime"
).
eq
(
"modularid"
,
id
)
.
leftJoin
(
"cms_content_read ccr on t.id = ccr.cms_content_id"
);
queryWrapper
.
eq
(
"t.releasestate"
,
0
).
and
(!
StringUtils
.
isEmpty
(
userBean
.
getEmpNum
()),
wq
->
wq
.
eq
(
"t.open_status"
,
1
).
or
().
and
(
true
,
q
->
q
.
eq
(
"t.open_status"
,
0
).
eq
(
"ccr.user_id"
,
userBean
.
getEmpNum
())))
.
eq
(
"ccr.user_id"
,
userBean
.
getEmpNum
())
.
eq
(
"t.organization_id"
,
userBean
.
getOrgCode
()).
orderByDesc
(
"t.releasetime"
).
eq
(
"t.modularid"
,
id
)
.
last
(
"limit 5"
);
.
last
(
"limit 5"
);
List
<
CmsContent
>
qynrs
=
CmsContent
.
builder
().
build
().
selectList
(
queryWrapper
);
List
<
CmsContent
>
qynrs
=
CmsContent
.
builder
().
build
().
selectList
(
queryWrapper
);
o
.
add
(
qynrs
);
o
.
add
(
qynrs
);
...
...
src/main/java/cn/timer/api/dao/qyxx/CmsContentMapper.java
View file @
a45e7414
package
cn
.
timer
.
api
.
dao
.
qyxx
;
package
cn
.
timer
.
api
.
dao
.
qyxx
;
import
com.github.yulichang.base.MPJBaseMapper
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
@@ -12,6 +13,6 @@ import cn.timer.api.bean.qyxx.CmsContent;
...
@@ -12,6 +13,6 @@ import cn.timer.api.bean.qyxx.CmsContent;
* @author dsc 2019-12-10
* @author dsc 2019-12-10
*/
*/
@Repository
@Repository
public
interface
CmsContentMapper
extends
BaseMapper
<
CmsContent
>
{
public
interface
CmsContentMapper
extends
MPJ
BaseMapper
<
CmsContent
>
{
}
}
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