if标签
动态传入查询所需要的条件。
1 | public interface EmployeeMapperDynamicSQL { |
1 | <mapper namespace="dao.EmployeeMapperDynamicSQL"> |
choose标签
1 | <select id="getEmpByConditionChoose" resultType="bean.Employee"> |
set标签
1 | <update id="updateEmp"> |
foreach标签
1 | // 查询员工 id在给定集合中 |
1 | <select id="getEmpByConditionForeach" resultType="bean.Employee"> |
1 | List<Employee> employeeList = mapper.getEmpByConditionForeach(Arrays.asList(5, 6, 7)); |
foreach批量添加数据
1 | // 批量添加 |
1 | <insert id="addEmps"> |
1 | List<Employee> emps = new ArrayList<Employee>(); |