package com.xjrsoft.module.system.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.system.entity.SystemMenuCommonlyUsed;
import com.xjrsoft.module.system.mapper.SystemMenuCommonlyUsedMapper;
import com.xjrsoft.module.system.service.ISystemMenuCommonlyUsedService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

/**
* @title: 常用功能设置
* @Author brealinxx
* @Date: 2024-04-18
* @Version 1.0
*/
@Service
@AllArgsConstructor
public class SystemMenuCommonlyUsedServiceImpl extends MPJBaseServiceImpl<SystemMenuCommonlyUsedMapper, SystemMenuCommonlyUsed> implements ISystemMenuCommonlyUsedService {
    @Override
    public Boolean removeByMenuId(List<Long> ids) {
        return this.remove(
            new QueryWrapper<SystemMenuCommonlyUsed>().lambda()
            .eq(SystemMenuCommonlyUsed::getCreateUserId, StpUtil.getLoginIdAsLong()).in(SystemMenuCommonlyUsed::getMenuId, ids)
        );
    }
}
