AssetMapper.java 1.47 KB
Newer Older
liqin's avatar
liqin committed
1 2 3 4
package cn.wisenergy.chnmuseum.party.mapper;

import cn.wisenergy.chnmuseum.party.model.Asset;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
liqin's avatar
liqin committed
5 6
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
liqin's avatar
liqin committed
7 8 9 10 11 12 13 14 15 16 17

/**
 * <p>
 * 视频 Mapper 接口
 * </p>
 *
 * @author Danny Lee
 * @since 2021-03-16
 */
public interface AssetMapper extends BaseMapper<Asset> {

liqin's avatar
liqin committed
18 19 20
    @Select("<script>" +
            "SELECT a.*, co.`name` AS video_content_copyright_owner_name, vcc.`name` AS video_content_cat_name " +
            "FROM asset a, video_content vc, copyright_owner co, video_content_cat vcc " +
liqin's avatar
liqin committed
21 22
            "where a.ref_item_id = vc.id " +
            "and vc.video_content_cat_id = vcc.id " +
liqin's avatar
liqin committed
23
            "and vc.video_content_copyright_owner_id = co.id " +
liqin's avatar
liqin committed
24 25 26 27
            "and vc.is_published = 1 and vc.is_deleted = 0 " +
            "and co.is_deleted = 0 and vcc.is_deleted = 0 " +
            "<![CDATA[and co.expire_date_start <= DATE_FORMAT(now(), '%Y-%m-%d') ]]>" +
            "<![CDATA[and co.expire_date_end >= DATE_FORMAT(now(), '%Y-%m-%d') ]]>" +
liqin's avatar
liqin committed
28
            "<if test='videoContentCatId != null'>and vcc.id = #{videoContentCatId} </if>" +
liqin's avatar
liqin committed
29 30 31
            "<if test='videoContentCopyrightOwnerId != null'>and co.id = #{videoContentCopyrightOwnerId} </if>" +
            "order by a.create_time desc" +
            "</script>")
liqin's avatar
liqin committed
32 33
    Page<Asset> selectPageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId);

liqin's avatar
liqin committed
34
}