package cn.pluss.platform.userRewardInfo.impl;

import cn.pluss.platform.entity.UserRewardInfo;
import cn.pluss.platform.mapper.UserRewardInfoMapper;
import cn.pluss.platform.userRewardInfo.UserRewardInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户奖励信息表 服务实现类
 * </p>
 *
 * @author bzg
 * @since 2022-02-22
 */
@Service
public class UserRewardInfoServiceImpl extends ServiceImpl<UserRewardInfoMapper, UserRewardInfo> implements UserRewardInfoService {


    /**
     * 根据用户ID获取区域配置
     * @date: 2022/3/1 15:18
     * @param userId:
     * @param roleCode:
     * @return java.util.List<cn.pluss.platform.entity.UserRewardInfo>
     */
    @Override
    public List<UserRewardInfo> selectListByUserIdAndRole(Long userId,String roleCode) {
        QueryWrapper<UserRewardInfo> queryWrapper = new QueryWrapper<UserRewardInfo>()
                .last(" A left join tb_pluss_reward_config c on A.reId = c.id  where a.status = 1 and a.userId = "+userId+" and c.roleCode = '"+roleCode+"' ").select(" A.*,c.scale as scale ");
        return baseMapper.selectList(queryWrapper);
    }
}
