package io.renren.modules.sys.dao.algs;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;

import io.renren.modules.sys.entity.algs.AlgorithmTemplate_Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

/**
 * @Author: Ivan Q
 * @Date: 2021/5/27 20:33
 * 用于查询模板界面的数据
 */
@Mapper
public interface AlgorithmTemplateVoMapper extends BaseMapper<AlgorithmTemplate_Vo> {
    @Select("SELECT a.*, b.username FROM algorithm_template a LEFT JOIN sys_user b ON a.uid = b.user_id ${ew.customSqlSegment}")
//下面这样写法会产生两个WHERE报错
//    @Select("SELECT a.*, b.username FROM algorithm_template a, sys_user b WHERE a.uid = b.user_id ${ew.customSqlSegment}")
    List<AlgorithmTemplate_Vo> getTemplateInfo(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("SELECT a.*, b.username FROM algorithm_template a sys_user b WHERE a.uid = b.user_id and a.uid = #{id,jdbcType=BIGINT}")
    List<AlgorithmTemplate_Vo> getTemplateInfoById(@Param("id") Long id);
}
