package org.jeecg.modules.system.app.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.system.app.entity.AppKongfuZone;
import org.jeecg.modules.system.app.mapper.AppKongfuZoneMapper;
import org.jeecg.modules.system.app.service.IAppKongfuZoneService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 首页金刚区管理
 * @Author: jeecg-boot
 * @Date: 2023-08-14
 * @Version: V1.0
 */
@Service
public class AppKongfuZoneServiceImpl extends ServiceImpl<AppKongfuZoneMapper, AppKongfuZone> implements IAppKongfuZoneService {

    @Override
    public List<AppKongfuZone> queryKongfuZone() {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        return this.baseMapper.selectList(Wrappers.<AppKongfuZone>lambdaQuery()
                .like(AppKongfuZone::getRoleCode, sysUser.getRoleCode())
                .eq(AppKongfuZone::getIzShow, 1)
                .orderByDesc(AppKongfuZone::getOrderNumber));
    }
}
