|
|
|
package com.zh.project0512.mapper;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.zh.project0512.model.User;
|
|
|
|
import com.zh.project0512.model.Video;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
|
import org.apache.ibatis.annotations.Insert;
|
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>
|
|
|
|
* Mapper 接口
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @author zh
|
|
|
|
* @since 2022-05-18
|
|
|
|
*/
|
|
|
|
public interface VideoMapper extends BaseMapper<Video> {
|
|
|
|
@Insert("update video INNER JOIN task on task.id = video.taskId and date_format(task.end, '%Y-%m-%d') = #{now}\n" +
|
|
|
|
" set video.status = 1 \n" +
|
|
|
|
"WHERE video.status = 0")
|
|
|
|
void updStatusWhenTaskEnd(String now);
|
|
|
|
@Select("SELECT t1.*,t2.name as providerName,t3.name as departmentName,t4.title as taskTitle\n" +
|
|
|
|
" from video as t1\n" +
|
|
|
|
"LEFT JOIN user as t2 on t2.id = t1.userId\n" +
|
|
|
|
"LEFT JOIN qywxDepartment as t3 on t3.departmentId = t2.main_department\n" +
|
|
|
|
"LEFT JOIN task as t4 on t4.id = t1.taskId " +
|
|
|
|
"${ew.customSqlSegment} " +
|
|
|
|
"ORDER BY updateAt DESC,creatAt DESC")
|
|
|
|
IPage<Map> pageList(IPage iPage, @Param("ew") Wrapper<Video> queryWrapper);
|
|
|
|
@Select("SELECT sum(t1.playNum) as playNumSum,\n" +
|
|
|
|
"sum(t1.commendNum) as commendNum ,\n" +
|
|
|
|
"sum(t1.collectionNum) as collectionNum ,\n" +
|
|
|
|
"sum(t1.commentNum) as commentNum ,\n" +
|
|
|
|
"sum(t1.reSendNum) as reSendNum ,\n" +
|
|
|
|
"sum(t1.recommendNum) as recommendNum \n" +
|
|
|
|
" from video as t1" +
|
|
|
|
" inner join user on user.openid = #{openid} and user.id = t1.userId\n")
|
|
|
|
JSONObject record(String openid);
|
|
|
|
}
|