Maven使用注解联合查询

Maven使用注解联合查询
一、Maven无条件联合查询
public interface DeptMapper {
@Select("select * from dept where deptno=#{deptno}")
Dept dept(int deptno);
@Select("SELECT * FROM emp")
@Results({
@Result(property = "dept",
column = "deptno",
one = @One(select = "com.java.mapper.DeptMapper.dept"))
})
List allemp();
}

二、Maven有条件联合查询
public interface DeptMapper {
@Select("select * from dept where deptno=#{deptno}")
Dept dept(int deptno);
@Select("SELECT * FROM emp where deptno=#{deptno} ")
@Results({
@Result(property = "dept",
column = "deptno",
one = @One(select = "com.java.mapper.DeptMapper.dept"))
})
List empByDeptno( @Param("deptno ") int deptno);
}


你可能感兴趣的:(Maven使用注解联合查询)