<!-- public List<Employee> getEmpsByLastNameLike(String lastName);--><!--resultType;如果返回的是一个集合,要写集合中元素的类型--><selectid="getEmpsByLastNameLike"resultType="com.atguigu.mybatis.bean.Employee">select * from tb1_employee where last_name like #{lastName}
</select>
<!-- public Map<String,Object> getEmpByIdReturnMap(Integer id);--><selectid="getEmpByIdReturnMap"resultType="map">select * from tb1_employee where id = #{id}</select>
<!--resultType;如果返回的是一个集合,要写集合中元素的类型--><!-- public Map<Integer,Employee> getEmpByLastNameLikeReturnMap(String lastName);--><selectid="getEmpByLastNameLikeReturnMap"resultType="com.atguigu.mybatis.bean.Employee">select * from tb1_employee where last_name like #{lastName}</select>
普通方式
public class Employee {private Integer id;private String lastName;private String email;private String gender;private Department dept;}public class Department {private Integer id;private String departmentName;}public interface EmployeeMapperPlus {…
OGNL if
要求:查询员工,要求,携带了哪个字段查询条件就带上这个字段的值 //携带了哪个字段查询条件就带上这个字段的值public List<Employee> getEmpsByConditionIf(Employee employee);<!-- public List<Employee> getEm…
choose
如果带了id就用id查,如果带了lastName就用lastName查;只会进入其中一个 public List<Employee> getEmpByConditionChoose(Employee employee);<!-- public List<Employee> getEmpByConditionChoose(Employee employee);-->…
因为sql语句拼装后,set语句后面可能会多一个逗号,所以要用set标签
set
<!-- public void updateEmp(Employee employee);-->
<update id"updateEmp">update tb1_employee<set><if test "lastName!null"&…
Linux 内核维护者 Dan Williams 曾于 7 月初提交一份提案,建议逐步取消 master/slave 和 blacklist/whitelist 术语。近日,Linus Torvalds 则在 Linux 5.8 版本库的拉取请求中批准了该提议。自此,Linux 开发人员则需要使用新的术语来替代 mas…