记一次项目科室功能增加

本文档详细介绍了在Jeecg中如何实现数据权限控制,从Controller层的注解设置到Service层的SQL拼接,以及前端页面的条件查询和滚动条优化。通过设置规则字段和条件,实现了根据用户部门进行数据过滤。同时,提供了前端组件增加滚动条的CSS样式解决方案,提升用户体验。
摘要由CSDN通过智能技术生成

jeecg数据权限问题

在controller层方法添加注解如下,pageComponent 后面为组件路径
@PermissionData(pageComponent = "expenditure/ExpenditureApprovalBatchList")
在service层写以下代码
public IPage<ExpenditurePlanVo> queryPageList(Page<ExpenditurePlanVo> page, ExpenditurePlanVo expenditurePlanVo) {
expenditurePlanVo.setPermissionSql(QueryGenerator.installAuthJdbcCustom(ExpenditurePlan.class,"a"))
}

规则名称:查询归口科室

规则字段:centralizedDeptId(需要权限的相对应的字段,使用实体类的字段名(驼峰))

条件规则:选择模糊

规则值:#{sys_dept_id}(填写上下文变量,使用账号所属部门进行匹配值) 

jeecg文档--数据权限

条件查询--后端

使用vo接收条件参数,如mapper方法

    public IPage<ExpenditurePlanVo> queryPageList(Page<ExpenditurePlanVo> page, @Param("map")ExpenditurePlanVo expenditurePlanVo);

mapper.xml文件编写循环条件参数,vo添加centralizedDeptId、centDeptIdList两个参数,centDeptIdList为List<String>类型,centralizedDeptId为String类型

<if test="map.centralizedDeptId != null and map.centralizedDeptId != ''">
            and
            <foreach collection="map.centDeptIdList" item="item" index="index" open="(" separator="or" close=")">
                b.centralized_dept_id = ${item}
            </foreach>
        </if>

前端组件增加滚动条

可以在组件外面包一层div,使用css样式的overflow-y

<template>
      <div class="list">
        <a-form :form="form">
        </a-form>
      </div>
</template>
<style scoped>
  .list{
    width: 100%;
    height: 400px;
    overflow-y: auto;
  }
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值