@ -113,4 +113,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
Integer countUserIdAndRoleId(@Param("userId") Long userId, @Param("roleId") Long roleId);
int selectUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);
Boolean deleteRoleByUserId(@Param("ids") List<Long> ids);
}
@ -87,6 +87,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
if (user_ids == null || user_ids.size() == 0) {
ExceptionCast.cast(HrmsCode.EMPLOYEE_IS_NULL);
this.getBaseMapper().deleteRoleByUserId(user_ids);
return this.getBaseMapper().deleteByIds(user_ids);
@ -626,4 +626,12 @@
SELECT COUNT(id) FROM hrms_employee_role WHERE user_id = #{userId} AND role_id = #{roleId}
</select>
<!-- 删除用户对应的角色信息 -->
<delete id="deleteRoleByUserId" parameterType="long">
DELETE FROM hrms_employee_role WHERE user_id IN
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
</delete>
</mapper>