LearningContentBoardMapper.java 5.8 KB
Newer Older
liqin's avatar
liqin committed
1 2
package cn.wisenergy.chnmuseum.party.mapper;

liqin's avatar
liqin committed
3
import cn.wisenergy.chnmuseum.party.model.Asset;
liqin's avatar
liqin committed
4
import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard;
liqin's avatar
liqin committed
5 6
import cn.wisenergy.chnmuseum.party.model.LearningContentBoard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
liqin's avatar
liqin committed
7 8
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
liqin's avatar
liqin committed
9 10 11
import org.apache.ibatis.annotations.Select;

import java.util.List;
liqin's avatar
liqin committed
12 13 14 15 16 17 18 19 20 21 22

/**
 * <p>
 * 学习内容展板 Mapper 接口
 * </p>
 *
 * @author Danny Lee
 * @since 2021-03-16
 */
public interface LearningContentBoardMapper extends BaseMapper<LearningContentBoard> {

liqin's avatar
liqin committed
23 24 25 26 27 28
    @Select("SELECT lcb.*, eb.`name` as exhibition_board_name " +
            "FROM learning_content_board lcb, exhibition_board eb " +
            "WHERE lcb.exhibition_board_id = eb.id " +
            "and lcb.learning_content_id = #{learningContentId} " +
            "and eb.is_published = 1 and eb.is_deleted = 0 " +
            "order by lcb.sortorder desc")
liqin's avatar
liqin committed
29 30
    List<LearningContentBoard> selectBoardListByLearningContentId(String learningContentId);

liqin's avatar
liqin committed
31 32 33
    @Select("<script>"
            + "SELECT eb.* FROM learning_content_board lcb, exhibition_board eb "
            + "WHERE lcb.exhibition_board_id = eb.id "
liqin's avatar
liqin committed
34
            + "and eb.is_published = 1 and is_deleted = 0 "
liqin's avatar
liqin committed
35
            + "<if test='learningContentId != null'>and lcb.learning_content_id = #{learningContentId} </if>"
liqin's avatar
liqin committed
36 37
            + "<if test='nameOrCode != null'>and eb.name like CONCAT('%', #{nameOrCode}, '%') </if>"
            + "order by lcb.sortorder desc"
liqin's avatar
liqin committed
38 39 40 41
            + "</script>"
    )
    IPage<ExhibitionBoard> selectBoardPageByLearningContentId(Page<?> page, String learningContentId, String nameOrCode);

liqin's avatar
liqin committed
42
    @Select("SELECT t.* FROM " +
liqin's avatar
liqin committed
43
            "(" +
liqin's avatar
liqin committed
44
            "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
liqin's avatar
liqin committed
45 46
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
liqin's avatar
liqin committed
47 48
            + "and eb.video_content_id = vc.id "
            + "and vc.id = a.ref_item_id "
liqin's avatar
liqin committed
49
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 and vc.is_deleted = 0 "
liqin's avatar
liqin committed
50
            + "and a.file_type = 'VIDEO' "
liqin's avatar
liqin committed
51 52
            + "and lc.applicable_scope = 'THIS_ORGAN' "
            + "and lc.organ_code = #{organCode} "
liqin's avatar
liqin committed
53
            + "UNION "
liqin's avatar
liqin committed
54
            + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
liqin's avatar
liqin committed
55 56 57
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
            + "and eb.id = a.ref_item_id "
liqin's avatar
liqin committed
58
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 "
liqin's avatar
liqin committed
59 60 61 62
            + "and a.file_cat = 'EXHIBITION_BOARD_DATUM' "
            + "and a.file_type = 'VIDEO' "
            + "and lc.applicable_scope = 'THIS_ORGAN' "
            + "and lc.organ_code = #{organCode} "
liqin's avatar
liqin committed
63
            + "UNION "
liqin's avatar
liqin committed
64 65
            + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover "
            + "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
liqin's avatar
liqin committed
66 67
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
liqin's avatar
liqin committed
68 69
            + "and eb.video_content_id = vc.id "
            + "and vc.id = a.ref_item_id "
liqin's avatar
liqin committed
70
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 and vc.is_deleted = 0 "
liqin's avatar
liqin committed
71
            + "and a.file_type = 'VIDEO' "
liqin's avatar
liqin committed
72 73
            + "and lc.applicable_scope = 'THIS_ORGAN_SUB'"
            + "and lc.organ_code like CONCAT(#{organCode},'%') "
liqin's avatar
liqin committed
74
            + "UNION "
liqin's avatar
liqin committed
75
            + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
liqin's avatar
liqin committed
76 77 78
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
            + "and eb.id = a.ref_item_id "
liqin's avatar
liqin committed
79
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 "
liqin's avatar
liqin committed
80 81 82 83
            + "and a.file_cat = 'EXHIBITION_BOARD_DATUM' "
            + "and a.file_type = 'VIDEO' "
            + "and lc.applicable_scope = 'THIS_ORGAN_SUB' "
            + "and lc.organ_code = #{organCode} "
liqin's avatar
liqin committed
84
            + "UNION "
liqin's avatar
liqin committed
85
            + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
liqin's avatar
liqin committed
86 87
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
liqin's avatar
liqin committed
88 89
            + "and eb.video_content_id = vc.id "
            + "and vc.id = a.ref_item_id "
liqin's avatar
liqin committed
90
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 and vc.is_deleted = 0 "
liqin's avatar
liqin committed
91
            + "and a.file_type = 'VIDEO' "
liqin's avatar
liqin committed
92
            + "and lc.applicable_scope = 'ALL_PLAT'"
liqin's avatar
liqin committed
93
            + "UNION "
liqin's avatar
liqin committed
94 95
            + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover "
            + "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
liqin's avatar
liqin committed
96 97 98
            + "WHERE lcb.learning_content_id = lc.id "
            + "and lcb.exhibition_board_id = eb.id "
            + "and eb.id = a.ref_item_id "
liqin's avatar
liqin committed
99
            + "and lc.is_published = 1 and eb.is_published = 1 and eb.is_deleted = 0 "
liqin's avatar
liqin committed
100 101 102 103
            + "and a.file_cat = 'EXHIBITION_BOARD_DATUM' "
            + "and a.file_type = 'VIDEO' "
            + "and lc.applicable_scope = 'ALL_PLAT'" +
            ") t"
liqin's avatar
liqin committed
104
    )
liqin's avatar
liqin committed
105
    IPage<Asset> selectAssetPageByOrganCode(Page<?> page, String organCode);
liqin's avatar
liqin committed
106

liqin's avatar
liqin committed
107
}