Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
legobackend
/
lego-manage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4c8cc66f
authored
2025-08-17 19:01:25 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
65b48b6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
3 deletions
lego-core/src/main/java/com/lego/core/mapper/CourseMapper.java
lego-core/src/main/java/com/lego/core/service/impl/CourseServiceImpl.java
lego-system/src/main/resources/mapper/CourseMapper.xml
lego-core/src/main/java/com/lego/core/mapper/CourseMapper.java
View file @
4c8cc66
package
com
.
lego
.
core
.
mapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.lego.common.core.mapper.BaseMapperPlus
;
import
com.lego.core.domain.Course
;
import
com.lego.core.domain.vo.CourseVo
;
import
org.apache.ibatis.annotations.Param
;
/**
* 课程Mapper接口
...
...
@@ -11,4 +16,5 @@ import com.lego.core.domain.vo.CourseVo;
* @date 2024/9/8 15:22
*/
public
interface
CourseMapper
extends
BaseMapperPlus
<
CourseMapper
,
Course
,
CourseVo
>
{
Page
<
CourseVo
>
selectPageCourse
(
IPage
<
CourseVo
>
page
,
@Param
(
Constants
.
WRAPPER
)
QueryWrapper
<
CourseVo
>
wrapper
);
}
...
...
lego-core/src/main/java/com/lego/core/service/impl/CourseServiceImpl.java
View file @
4c8cc66
package
com
.
lego
.
core
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.lego.common.constant.UserConstants
;
import
com.lego.common.core.domain.entity.SysUser
;
import
com.lego.common.core.page.TableDataInfo
;
import
com.lego.common.core.service.OssService
;
import
com.lego.common.utils.MessageUtils
;
import
com.lego.common.utils.StreamUtils
;
import
com.lego.common.utils.StringUtils
;
import
com.lego.core.annotation.LanguageAnnotation
;
import
com.lego.core.domain.Course
;
import
com.lego.core.domain.bo.CourseBo
;
...
...
@@ -51,9 +56,22 @@ public class CourseServiceImpl implements ICourseService {
*/
@Override
public
TableDataInfo
<
CourseVo
>
listPage
(
CourseQueryBo
query
,
String
language
)
{
Page
<
CourseVo
>
page
=
baseMapper
.
selectVoPage
(
query
.
build
(),
Wrappers
.<
Course
>
lambdaQuery
().
like
(
StrUtil
.
isNotBlank
(
query
.
getSearchKey
()),
Course:
:
getName
,
query
.
getSearchKey
())
.
eq
(
Course:
:
getLanguage
,
language
).
orderByAsc
(
Course:
:
getSort
));
QueryWrapper
<
CourseVo
>
wrapper
=
Wrappers
.
query
();
if
(
StringUtils
.
isNotBlank
(
query
.
getSearchKey
()))
{
wrapper
.
eq
(
"u.del_flag"
,
UserConstants
.
USER_NORMAL
)
.
eq
(
"u.language"
,
language
)
.
and
(
w
->
w
.
like
(
StringUtils
.
isNotBlank
(
query
.
getSearchKey
()),
"u.name"
,
query
.
getSearchKey
())
.
or
().
like
(
StringUtils
.
isNotBlank
(
query
.
getSearchKey
()),
"v.name"
,
query
.
getSearchKey
())
.
or
().
like
(
StringUtils
.
isNotBlank
(
query
.
getSearchKey
()),
"w.name"
,
query
.
getSearchKey
())
)
.
orderByAsc
(
"u.sort"
);
}
else
{
wrapper
.
eq
(
"u.del_flag"
,
UserConstants
.
USER_NORMAL
)
.
eq
(
"u.language"
,
language
)
.
orderByAsc
(
"u.sort"
);
}
Page
<
CourseVo
>
page
=
baseMapper
.
selectPageCourse
(
query
.
build
(),
wrapper
);
List
<
CourseVo
>
list
=
page
.
getRecords
();
if
(
ObjectUtil
.
isNotEmpty
(
list
))
{
Set
<
String
>
ids
=
StreamUtils
.
toSet
(
list
,
CourseVo:
:
getEntiretyId
);
...
...
lego-system/src/main/resources/mapper/CourseMapper.xml
0 → 100644
View file @
4c8cc66
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.lego.core.mapper.CourseMapper"
>
<resultMap
type=
"CourseVo"
id=
"CourseResult"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"entiretyId"
column=
"entirety_id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"twoDimensionalType"
column=
"two_dimensional_type"
/>
<result
property=
"twoDimensionalUrl"
column=
"two_dimensional_url"
/>
<result
property=
"threeDimensionalType"
column=
"two_dimensional_type"
/>
<result
property=
"threeDimensionalType"
column=
"three_dimensional_type"
/>
<result
property=
"threeDimensionalUrl"
column=
"three_dimensional_url"
/>
<result
property=
"threeDimensionalType"
column=
"three_dimensional_type"
/>
<result
property=
"caseOssId"
column=
"case_oss_id"
/>
<result
property=
"caseName"
column=
"case_name"
/>
<result
property=
"teachingOssId"
column=
"teaching_oss_id"
/>
<result
property=
"teachingName"
column=
"teaching_name"
/>
<result
property=
"pptOssId"
column=
"ppt_oss_id"
/>
<result
property=
"pptName"
column=
"ppt_name"
/>
<result
property=
"ossId"
column=
"oss_id"
/>
<result
property=
"language"
column=
"language"
/>
<result
property=
"canPack"
column=
"can_pack"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"programType"
column=
"program_type"
/>
</resultMap>
<select
id=
"selectPageCourse"
resultMap=
"CourseResult"
>
select u.*
from core_course u
inner join core_entirety v ON v.id = u.entirety_id
inner join core_building_block w ON w.id = v.building_block_id
${ew.getCustomSqlSegment}
</select>
</mapper>
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment