package com.moral.api.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.entity.*;
import com.moral.api.mapper.*;
import com.moral.api.pojo.redisBean.AccountInfoDTO;
import com.moral.api.service.ManageRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.api.util.LogUtils;
import com.moral.constant.Constants;
import com.moral.constant.ResponseCodeEnum;
import com.moral.util.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Predicate;
/**
 * 
 * 后台角色表 服务实现类
 * 
 *
 * @author moral
 * @since 2021-03-09
 */
@Service
public class ManageRoleServiceImpl extends ServiceImpl implements ManageRoleService {
    @Resource
    ManageRoleMapper roleMapper;
    public ManageRole getManageRoleByAccountId(String accountId){
        if(StringUtils.isEmpty(accountId))
            return null;
        return null;
    }
    @Autowired(required = false)
    private ManageRoleMapper manageRoleMapper;
    @Autowired(required = false)
    private ManageMenuMapper manageMenuMapper;
    @Autowired(required = false)
    private ManageRoleMenuMapper manageRoleMenuMapper;
    @Autowired(required = false)
    private ManageAccountRoleMapper manageAccountRoleMapper;
    @Override
    public Map getAllWithPagingQuery(Map map) {
        Map resultMap = new HashMap<>();
        int current = Integer.parseInt(map.get("current").toString());
        int size = Integer.parseInt(map.get("size").toString());
        com.baomidou.mybatisplus.extension.plugins.pagination.Page page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(current, size);
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("is_delete",0);
        wrapper.orderByDesc("create_time");
        com.baomidou.mybatisplus.extension.plugins.pagination.Page resultpage = manageRoleMapper.selectPage(page,wrapper);
        List manageRoles = resultpage.getRecords();
        SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List