数据权限 --代码复制

<if test="person != null and person != ''">and create_by = #{person}
</if>
<if test="dept != null and dept != ''">and dept_no = #{dept}
</if>
<if test="deptLike != null and deptLike != ''">
    <bind name="pattern" value="deptLike+'%'"/>
    and dept_no like #{pattern}
</if>
<if test="perMap != null">
    and
    <foreach collection="perMap.keys" item="key" open="(" close=")" separator="or" >
        <if test="perMap[key] == 'like'">
            <bind name="pattern" value="key+'%'"/>
            dept_no like #{pattern}
        </if>
        <if test="perMap[key] == 'equal'">
            dept_no = ${key}
        </if>
        <if test="perMap[key] != null and perMap[key] != 'like' and perMap[key] != 'equal'">
            dept_no = ${key} and create_by = #{perMap[${key}]}
        </if>
    </foreach>
</if>

 

 

Session session=ShiroUtils.getSession();
String person = (String)session.getAttribute("person");
params.put("person",person);
String dept = (String)session.getAttribute("dept");
params.put("dept",dept);
Map<String,String> perMap = (Map<String,String>)session.getAttribute("perMap");
params.put("perMap",perMap);
String deptLike = (String)session.getAttribute("deptLike");
params.put("deptLike",deptLike);
发布了234 篇原创文章 · 获赞 24 · 访问量 16万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览