【添加】mapper文件添加

This commit is contained in:
zer0Black
2021-03-12 10:45:28 +08:00
parent b7708f1639
commit 688e4cecc3
8 changed files with 170 additions and 4 deletions
@@ -1,4 +1,4 @@
package com.jero.generater.modules.online.auth.b;
package com.jero.generater.modules.online.auth.constant;
public class AuthConstants {
public static final int a = 3;
@@ -1,12 +1,10 @@
package com.jero.generater.modules.online.auth.a;
package com.jero.generater.modules.online.auth.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import java.util.ArrayList;
import java.util.HashMap;
@@ -0,0 +1,11 @@
package com.jero.generater.modules.online.auth.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.jero.common.system.vo.SysPermissionDataRuleModel;
import com.jero.generater.modules.online.auth.entity.OnlAuthData;
public interface OnlAuthDataMapper extends BaseMapper<OnlAuthData> {
List<SysPermissionDataRuleModel> queryOwnerAuth(@Param("userId") String str, @Param("cgformId") String str2);
}
@@ -0,0 +1,19 @@
package com.jero.generater.modules.online.auth.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.jero.generater.modules.online.auth.entity.OnlAuthPage;
import com.jero.generater.modules.online.auth.vo.AuthPageVO;
public interface OnlAuthPageMapper extends BaseMapper<OnlAuthPage> {
List<AuthPageVO> queryAuthButtonByFormId(@Param("cgformId") String str);
List<AuthPageVO> queryAuthColumnByFormId(@Param("cgformId") String str);
List<AuthPageVO> queryRoleAuthByFormId(@Param("roleId") String str, @Param("cgformId") String str2, @Param("type") int i);
List<AuthPageVO> queryRoleDataAuth(@Param("roleId") String str, @Param("cgformId") String str2);
List<String> queryRoleNoAuthCode(@Param("userId") String str, @Param("cgformId") String str2, @Param("control") Integer num, @Param("page") Integer num2, @Param("type") Integer num3);
}
@@ -0,0 +1,7 @@
package com.jero.generater.modules.online.auth.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.generater.modules.online.auth.entity.OnlAuthRelation;
public interface OnlAuthRelationMapper extends BaseMapper<OnlAuthRelation> {
}
@@ -0,0 +1,28 @@
<?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.jero.generater.modules.online.auth.mapper.OnlAuthDataMapper">
<resultMap id="SysPermissionDataRuleModel" type="com.jero.common.system.vo.SysPermissionDataRuleModel">
<result column="rule_name" property="ruleName" jdbcType="VARCHAR"/>
<result column="rule_column" property="ruleColumn" jdbcType="VARCHAR"/>
<result column="rule_operator" property="ruleConditions" jdbcType="VARCHAR"/>
<result column="rule_value" property="ruleValue" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询某个表单数据权限 -->
<select id="queryOwnerAuth" parameterType="Object" resultMap="SysPermissionDataRuleModel">
select a.rule_name,
a.rule_column,
a.rule_operator,
a.rule_value
from onl_auth_data a
join onl_auth_relation b on b.auth_id = a.id
join sys_role c on b.role_id = c.id
join sys_user_role d on d.role_id = c.id
where a.status = 1
and a.cgform_id = #{cgformId,jdbcType=VARCHAR}
and b.type = 3
and d.user_id = #{userId,jdbcType=VARCHAR}
</select>
</mapper>
@@ -0,0 +1,98 @@
<?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.jero.generater.modules.online.auth.mapper.OnlAuthPageMapper">
<resultMap id="AuthPageVO" type="com.jero.modules.online.auth.vo.AuthPageVO">
<result column="id" property="id" jdbcType="VARCHAR"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="page" property="page" jdbcType="INTEGER"/>
<result column="control" property="control" jdbcType="INTEGER"/>
<result column="rel_id" property="relId" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询某个表单的字段/按钮权限数据 -->
<select id="queryRoleAuthByFormId" parameterType="Object" resultMap="AuthPageVO">
select a.id,
a.code,
a.page,
a.control,
b.db_field_txt as title,
c.id as rel_id
from onl_auth_page a
join onl_cgform_field b on a.code = b.db_field_name and b.cgform_head_id = #{cgformId,jdbcType=VARCHAR}
left join onl_auth_relation c
on c.auth_id = a.id and c.type = #{type,jdbcType=INTEGER} and c.role_id = #{roleId,jdbcType=VARCHAR}
where a.status = 1
and a.cgform_id = #{cgformId,jdbcType=VARCHAR}
and a.type = #{type,jdbcType=INTEGER}
</select>
<!-- 查询某个表单数据权限 -->
<select id="queryRoleDataAuth" parameterType="Object" resultMap="AuthPageVO">
select a.id,
a.rule_name as title,
c.id as rel_id
from onl_auth_data a
left join onl_auth_relation c on c.auth_id = a.id
where a.status = 1
and a.cgform_id = #{cgformId,jdbcType=VARCHAR}
and c.role_id = #{roleId,jdbcType=VARCHAR}
and c.type = 3
</select>
<!-- 查询某个表单的字段权限数据 -->
<select id="queryAuthColumnByFormId" parameterType="Object" resultMap="AuthPageVO">
select a.id,
a.code,
a.page,
a.control,
b.db_field_txt as title
from onl_auth_page a
join onl_cgform_field b on a.code = b.db_field_name and b.cgform_head_id = #{cgformId,jdbcType=VARCHAR}
where a.status = 1 and a.type = 1
and a.cgform_id = #{cgformId,jdbcType=VARCHAR}
</select>
<!-- 查询某个表单的按钮权限数据 -->
<select id="queryAuthButtonByFormId" parameterType="Object" resultMap="AuthPageVO">
select a.id,
a.code,
a.page,
a.control,
b.BUTTON_NAME as title
from onl_auth_page a
left join onl_cgform_button b on a.code = b.BUTTON_CODE and b.CGFORM_HEAD_ID = #{cgformId,jdbcType=VARCHAR}
where a.status = 1 and a.type = 2
and a.cgform_id = #{cgformId,jdbcType=VARCHAR}
</select>
<!-- 查询 隐藏/禁用 的 列和字段 配置了权限数据 但是没有授权 -->
<select id="queryRoleNoAuthCode" parameterType="Object" resultType="java.lang.String">
select t.code
from onl_auth_page t
where t.status = 1
<if test="null!=page and ''!=page">
and t.page = #{page,jdbcType=INTEGER}
</if>
<if test="null!=control and ''!=control">
and t.control = #{control,jdbcType=INTEGER}
</if>
<if test="null!=type and ''!=type">
and t.type = #{type,jdbcType=INTEGER}
</if>
and t.cgform_id = #{cgformId,jdbcType=VARCHAR}
and NOT EXISTS(
select * from onl_auth_relation a
join sys_role b on b.id = a.role_id
join sys_user_role c on c.role_id = b.id
where c.user_id = #{userId,jdbcType=VARCHAR}
and a.auth_id = t.id
and a.type in (1,2)
)
</select>
</mapper>
@@ -0,0 +1,5 @@
<?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.jero.generater.modules.online.auth.mapper.OnlAuthRelationMapper">
</mapper>