You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.8 KiB

3 years ago
package com.zh.project0512.mapper;
3 years ago
import com.alibaba.fastjson.JSONObject;
3 years ago
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zh.project0512.model.User;
3 years ago
import com.zh.project0512.model.Video;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 years ago
import org.apache.ibatis.annotations.Insert;
3 years ago
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
3 years ago
3 years ago
import java.time.LocalDate;
import java.time.LocalDateTime;
3 years ago
import java.util.List;
import java.util.Map;
3 years ago
3 years ago
/**
* <p>
* Mapper
* </p>
*
* @author zh
* @since 2022-05-18
*/
public interface VideoMapper extends BaseMapper<Video> {
3 years ago
@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);
3 years ago
@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);
3 years ago
@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);
3 years ago
}