package cn.chnmuseum.party.mapper; import cn.chnmuseum.party.model.Asset; import cn.chnmuseum.party.model.TBoxOperation; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Select; import java.util.List; /** * <p> * 视频 Mapper 接口 * </p> * * @author Danny Lee * @since 2021-03-16 */ public interface AssetMapper extends BaseMapper<Asset> { @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 " + "where a.ref_item_id = vc.id " + "and vc.video_content_cat_id = vcc.id " + "and a.is_published = 1 " + "and vc.video_content_copyright_owner_id = co.id " + "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') ]]>" + "<if test='videoContentCatId != null'>and vcc.id = #{videoContentCatId} </if>" + "<if test='videoContentCopyrightOwnerId != null'>and co.id = #{videoContentCopyrightOwnerId} </if>" + "order by a.create_time desc" + "</script>") Page<Asset> selectPageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId); @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.mac IS NOT NULL" + "</script>") List<TBoxOperation> selectBoxListByOrgan(); }