RuoYi-Vue-Plus数据权限

该文章描述了一个Java方法queryPageList,用于从数据库中根据传入参数查询技术奖项列表,涉及奖级、等级、名称、项目名等字段,并使用了PageQuery对象进行分页和排序。同时展示了TechnologyAwardsMapper接口和SQL查询片段,强调了数据权限控制和关联表查询。
摘要由CSDN通过智能技术生成
@Override
    public TableDataInfo<TechnologyAwardsVo> queryPageList(TechnologyAwardsBo bo, PageQuery pageQuery) {
        QueryWrapper<TechnologyAwardsVo> wrapper = Wrappers.query();
        wrapper.eq(bo.getAwardLevel() != null, "t.award_level", bo.getAwardLevel())
            .eq(bo.getAwardGrade() != null, "t.award_grade", bo.getAwardGrade())
            .like(StrUtil.isNotBlank(bo.getAwardName()), "t.award_name", bo.getAwardName())
            .like(StrUtil.isNotBlank(bo.getProjectName()), "t.project_name", bo.getProjectName())
            .like(StrUtil.isNotBlank(bo.getAwardeeName()), "t.awardeeLabel", bo.getAwardeeName())
            .le(bo.getParams().get("beginAwardeeTime") != null, "t.awardee_time", bo.getParams().get("beginAwardeeTime"))
            .ge(bo.getParams().get("endAwardeeTime") != null, "t.awardee_time", bo.getParams().get("endAwardeeTime"))
            .orderByDesc("t.create_time");
//            .and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id"))
//            .notIn(CollUtil.isNotEmpty(userIds), "u.user_id", userIds)
//            .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
//            .like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber());
        Page<TechnologyAwardsVo> page = baseMapper.getTechnologyAwards(pageQuery.build(), wrapper);
        return TableDataInfo.build(page);
public interface TechnologyAwardsMapper extends BaseMapperPlus<TechnologyAwardsMapper, TechnologyAwards, TechnologyAwardsVo> {

    @DataPermission({
        @DataColumn(key = "userName", value = "t.user_id")
    })
    Page<TechnologyAwardsVo> getTechnologyAwards(@Param("page") Page<TechnologyAwardsVo> page, @Param(Constants.WRAPPER) Wrapper<TechnologyAwardsVo> queryWrapper);

}
    <select id="getTechnologyAwards" resultType="com.ruoyi.biz.domain.vo.TechnologyAwardsVo">
        SELECT
            *
        FROM
            (
                SELECT DISTINCT
                    ANY_VALUE ( a.id ) id,
                    ANY_VALUE ( a.award_level ) award_level,
                    ANY_VALUE ( a.award_grade ) award_grade,
                    ANY_VALUE ( a.award_name ) award_name,
                    ANY_VALUE ( a.project_name ) project_name,
                    (
                        SELECT
                            GROUP_CONCAT( NAME )
                        FROM
                            biz_employee
                        WHERE
                                id IN ( SELECT emp_id FROM biz_technology_awards_emp WHERE technology_awards_id = a.id )) awardeeLabel,
                    ANY_VALUE ( d.dept_name ) awardeeUnitLabel,
                    ANY_VALUE ( a.awardee_time ) awardee_time,
                    ANY_VALUE ( a.create_time ) create_time,
                    ANY_VALUE ( a.user_id ) user_id
                FROM
                    `biz_technology_awards` a
                        LEFT JOIN sys_dept d ON a.dept_id = d.dept_id
                        LEFT JOIN biz_technology_awards_emp ae ON a.id = ae.technology_awards_id
                        LEFT JOIN biz_employee e ON ae.emp_id = e.id
            ) t
            ${ew.getCustomSqlSegment}
    </select>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值