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

import cn.wisenergy.chnmuseum.party.model.Asset;
liqin's avatar
liqin committed
4
import cn.wisenergy.chnmuseum.party.model.TBoxOperation;
liqin's avatar
liqin committed
5
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
liqin's avatar
liqin committed
6 7
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
liqin's avatar
liqin committed
8

liqin's avatar
liqin committed
9 10
import java.util.List;

liqin's avatar
liqin committed
11 12 13 14 15 16 17 18 19 20
/**
 * <p>
 * 视频 Mapper 接口
 * </p>
 *
 * @author Danny Lee
 * @since 2021-03-16
 */
public interface AssetMapper extends BaseMapper<Asset> {

liqin's avatar
liqin committed
21 22 23
    @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
24 25
            "where a.ref_item_id = vc.id " +
            "and vc.video_content_cat_id = vcc.id " +
liqin's avatar
liqin committed
26
            "and vc.video_content_copyright_owner_id = co.id " +
liqin's avatar
liqin committed
27 28 29
            "and vc.is_published = 1 and vc.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
30
            "<if test='videoContentCatId != null'>and vcc.id = #{videoContentCatId} </if>" +
liqin's avatar
liqin committed
31 32 33
            "<if test='videoContentCopyrightOwnerId != null'>and co.id = #{videoContentCopyrightOwnerId} </if>" +
            "order by a.create_time desc" +
            "</script>")
liqin's avatar
liqin committed
34 35
    Page<Asset> selectPageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId);

liqin's avatar
liqin committed
36 37 38 39 40
    @Select("<script>" +
            "SELECT b.*, o.code as organ_code, o.`name` as organ_name " +
            "FROM t_box_operation b, t_organ o " +
            "where b.organ_id = o.id and b.private_key IS NOT NULL" +
            "</script>")
liqin's avatar
liqin committed
41 42
    List<TBoxOperation> selectBoxListByOrgan();

liqin's avatar
liqin committed
43
}