From daa697719eb0ddfd170f1ab94c5422a4f5b93951 Mon Sep 17 00:00:00 2001 From: zhaoxiaohao <279049017@qq.com> Date: Fri, 18 Sep 2020 14:36:54 +0800 Subject: [PATCH] Merge branch 'dev' --- kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleOrganizationMapper.xml | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 120 insertions(+), 0 deletions(-) diff --git a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleOrganizationMapper.xml b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleOrganizationMapper.xml new file mode 100644 index 0000000..fa9564d --- /dev/null +++ b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysRoleOrganizationMapper.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!--角色对应的 部门--> +<mapper namespace="com.kidgrow.usercenter.mapper.SysRoleOrganizationMapper"> + + <!--定义数据权限的查询--> + <sql id="Role_Organization"> + <if test="p.roleOrg != null and p.roleOrg.size>0"> + <foreach item="item" collection="p.roleOrg" index=""> + <foreach item="itemto" collection="item" index="inx"> + <choose> + <when test="inx == 1"> + <if test="itemto.flag"> + + </if> + <if test="!itemto.flag"> + or ( is_del = 0 and enabled=1) + </if> + </when> + <when test="inx==2"> + <if test="itemto.flag"> + AND + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + and is_del = 0 and enabled=1 + ) + </if> + </when> + <when test="inx == 3"> + <if test="itemto.flag"> + AND + create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_org_code = #{itemto.object} and is_del = 0 and enabled=1) + </if> + </when> + <when test="inx == 4"> + <if test="itemto.flag"> + AND + create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (create_user_org_code like '${itemto.object}%' and is_del = 0 and enabled=1) + </if> + </when> + <when test="inx == 5"> + <if test="itemto.flag"> + AND + create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_id = #{itemto.object} and is_del = 0 and enabled=1) + </if> + </when> + <otherwise> + AND id is null + </otherwise> + </choose> + </foreach> + </foreach> + </if> + </sql> + + <!--定义查询列--> + <sql id="Column_List"> + * + </sql> + + <!--sql查询片段--> + <sql id="where"> + <where> + <!--查询条件自行添加--> + is_del=0 + <if test="p.id != null and p.id !=''"> + and id = #{p.id} + </if> + <if test="p.type != null and p.type !=''"> + and type = #{p.type} + </if> + <if test="p.roleId != null and p.roleId !=''"> + and role_id = #{p.roleId} + </if> + <if test="p.orgId != null and p.orgId !=''"> + and org_id = #{p.orgId} + </if> + <if test="p.orgCode != null and p.orgCode !=''"> + and org_code = #{p.orgCode} + </if> + </where> + </sql> + + <!--定义根据-SysRoleOrganization当作查询条件返回对象--> + <select id="findByObject" resultType="com.kidgrow.usercenter.model.SysRoleOrganization"> + select + <include refid="Column_List"/> + from sys_role_organization + <include refid="where"/> + order by id desc + limit 1 + </select> + + <!--定义根据-SysRoleOrganization当作查询条件返回对象集合--> + <select id="findList" resultType="com.kidgrow.usercenter.model.SysRoleOrganization"> + select + <include refid="Column_List"/> + from sys_role_organization + <include refid="where"/> + order by id desc + </select> +</mapper> \ No newline at end of file -- Gitblit v1.8.0