<insertid="insertBatchRelation"> insert into employee_role(employee_id, role_id) VALUES <foreachcollection="roleIds"item="role_id"separator=","> (#{id},#{role_id}) </foreach> </insert> <deleteid="deleteRoleRelation"> delete from employee_role where employee_id=#{id} </delete>
<selectid="selectPage"resultType="com.zss.rbacproject.pojo.Employee"> select employee.id, employee.name, password, email, age, admin, dept_id, d.name as deptName, sn from employee join department d on employee.dept_id = d.id <where> <iftest="keyword!= null and keyword != '' "> and (employee.name like CONCAT('%',#{keyword},'%') or email like CONCAT('%',#{keyword},'%')) </if> <iftest="deptId != -1" > and dept_id=#{deptId} </if> </where> </select> <selectid="selectExpressions"resultType="java.lang.String"> select pr.expression from permission as pr join role_permission rp on pr.id = rp.permission_id join employee_role er on rp.role_id = er.role_id where employee_id=#{id} </select>