package com.lunhan.xxx.repository.mapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
import com.lunhan.xxx.entity.dto.search.SearchTestInfo;
|
import com.lunhan.xxx.repository.BasicMapper;
|
import com.lunhan.xxx.repository.po.TestInfoPO;
|
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Select;
|
|
import java.util.List;
|
|
@Mapper
|
public interface TestInfoMapper extends BasicMapper<TestInfoPO> {
|
// #{param}:会进行预编译,而且进行类型匹配,最后进行变量替换,括号中可以添加映射类型如
|
// @Select(
|
// "<script>" +
|
// "select * from student where id= #{param,javaType=int,jdbcType=NUMERIC}" +
|
// "</script> "
|
// )
|
// ${param}:$只是只是简单的字符串拼接,要特别小心sql注入问题,对应非变量部分,只能用$。$方式一般用于传入数据库对象,比如这种group by 字段 ,order by 字段,表名,字段名等没法使用占位符的就需要使用${param}
|
|
@Select("select * from test_info where id = #{id}")
|
TestInfoPO testGet(Long id);
|
|
@Select("select * from test_info where name = #{name}")
|
TestInfoPO testGet2(String userName);
|
|
@Select("select * from test_info where status = #{ew.status}")
|
List<TestInfoPO> testList1(@Param(Constants.WRAPPER) SearchTestInfo search);
|
|
@Select("select * from test_info where status = #{search.status}")
|
List<TestInfoPO> testList2(@Param("search") SearchTestInfo search);
|
|
}
|