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.
86 lines
3.8 KiB
86 lines
3.8 KiB
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.Reference;
|
|
import com.zh.project0512.model.Task;
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* <p>
|
|
* Mapper 接口
|
|
* </p>
|
|
*
|
|
* @author zh
|
|
* @since 2022-05-21
|
|
*/
|
|
public interface TaskMapper extends BaseMapper<Task> {
|
|
@Insert("insert into task (title,subtitle,start,end) values (#{title},#{subtitle},#{start},#{end})")
|
|
int add(Task task);
|
|
|
|
@Select("<script>" +
|
|
"SELECT t1.id " +
|
|
"from task t1 " +
|
|
"WHERE t1.id " +
|
|
|
|
"<if test='tagIdList !=null and tagIdList.size()!=0'> " +
|
|
"and t1.id in (SELECT taskId from taskTag WHERE taskTag.tagId in " +
|
|
"<foreach collection='tagIdList' index='index' item='item' open='(' separator=',' close=')'>#{item}</foreach> " +
|
|
")" +
|
|
"</if>" +
|
|
|
|
"<if test='brandIdList !=null and brandIdList.size()!=0'> " +
|
|
"and t1.id in (SELECT taskId from taskBrand WHERE taskBrand.brandId in " +
|
|
"<foreach collection='brandIdList' index='index' item='item' open='(' separator=',' close=')'>#{item}</foreach> " +
|
|
")" +
|
|
"</if>" +
|
|
|
|
"<if test='openid!=null'>" +
|
|
"and IF((SELECT count(*)!=0 FROM taskDepartment WHERE taskId = t1.id)>0," +
|
|
"t1.id in (SELECT taskId from taskDepartment inner JOIN user on user.openid =#{openid} " +
|
|
"and user.main_department = taskDepartment.departmentId), " +
|
|
" 1=1)" +
|
|
"</if>" +
|
|
|
|
"<if test='ew != null'>" +
|
|
"<if test='ew.nonEmptyOfWhere'>" +
|
|
"AND " +
|
|
"</if> " +
|
|
"${ew.SqlSegment}" +
|
|
"</if> " +
|
|
|
|
"ORDER BY t1.updateAt DESC,t1.creatAt DESC" +
|
|
"</script>")
|
|
IPage<Integer> idList(IPage iPage, String openid, List<Integer> tagIdList, List<Integer> brandIdList, @Param("ew") Wrapper<Reference> queryWrapper);
|
|
|
|
List<Map> list(String openid, List<Integer> list, List<Integer> tagIdList, List<Integer> brandIdList, @Param("ew") Wrapper<Reference> queryWrapper);
|
|
|
|
Task detailById(String openid, int id);
|
|
|
|
@Select("SELECT SUM(t1.playNum) as playNumSum,SUM(t1.commendNum) as commendNumSum,\n" +
|
|
"SUM(t1.collectionNum) as collectionNumSum,SUM(t1.commentNum) as commentNumSum,\n" +
|
|
"SUM(t1.reSendNum) as reSendNumSum,SUM(t1.recommendNum) as recommendNumSum,SUM(t1.effectResult) as effectResultSum,t1.userId,\n" +
|
|
"t2.title as taskTitle from video as t1 INNER JOIN task as t2 on t2.id = 31 and t2.id = t1.taskId\n" +
|
|
"LEFT JOIN user as t3 on t1.userId = t3.id\n" +
|
|
"LEFT JOIN qywxDepartment as t4 on t3.main_department = t4.departmentId " +
|
|
"${ew.customSqlSegment}")
|
|
JSONObject taskEffect(@Param("ew") Wrapper<Task> queryWrapper);
|
|
|
|
@Select("SELECT SUM(t1.playNum) as playNumSum,SUM(t1.commendNum) as commendNumSum,\n" +
|
|
"SUM(t1.collectionNum) as collectionNumSum,SUM(t1.commentNum) as commentNumSum,\n" +
|
|
"SUM(t1.reSendNum) as reSendNumSum,SUM(t1.recommendNum) as recommendNumSum,SUM(t1.effectResult) as effectResultSum,t1.userId,\n" +
|
|
"t2.title as taskTitle,t3.name as userName,t4.name as departmentName from video as t1 INNER JOIN task as t2 on t2.id = 31 and t2.id = t1.taskId\n" +
|
|
"LEFT JOIN user as t3 on t1.userId = t3.id\n" +
|
|
"LEFT JOIN qywxDepartment as t4 on t3.main_department = t4.departmentId " +
|
|
"${ew.customSqlSegment}")
|
|
List<Map> taskEffectData(@Param("ew") Wrapper<Task> queryWrapper);
|
|
|
|
@Select("select t1.departmentId,t2.name as departmentName from taskDepartment t1 left join qywxDepartment t2 on t1.departmentId = t2.departmentId")
|
|
List<Map> taskDepartment(int taskId);
|
|
}
|