案例
根据 非id 两个字段删除
void deleteBatchRelation(@Param(entites) List<AttrAttrgroupRelationEntity> entites);
<delete id=deleteBatchRelation>
delete from pms_attr_attrgroup_relation where
-- 遍历循环删除 item separator是分隔符 or
<foreach collection=entites item=item separator=OR>
(attr_id=#{item.attrId} and attr_group_id=#{item.attrGroupId})
</foreach>
</delete>
【多选删除】根据ids
EmployeeController层
@RequestMapping(/delempList)
public String deleteEmp(@RequestBody Integer[] ids){
employeeService.deleteList(ids);
return success删除;
}
EmployeeService层
void deleteList(Integer[] ids);
EmployeeServiceImpl层
public void deleteList(Integer[] ids) {
employeeDao.deleteList(ids);
}
核心数EmployeeDao
<delete id=deleteList >
delete from employee where id in
<foreach collection=array item=ids open=( separator=,
close=)>
</foreach>
</delete>
模糊查询
<select id=getEmpListByname resultType=com.springboot10.entity.EmployeeEntity>
SELECT * FROM employee where lastname like CONCAT(CONCAT(
</select>