123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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.jeeplus.modules.sys.mapper.DataRuleMapper">
-
- <sql id="dataRuleColumns">
- a.id AS "id",
- a.menu_id AS "menuId",
- a.name AS "name",
- a.className AS "className",
- a.t_field AS "field",
- a.t_express AS "express",
- a.t_value AS "value",
- a.sql_segment AS "sqlSegment",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag"
- </sql>
-
- <sql id="dataRuleJoins">
- </sql>
-
-
- <select id="get" resultType="DataRule" >
- SELECT
- <include refid="dataRuleColumns"/>
- FROM sys_datarule a
- <include refid="dataRuleJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="DataRule" >
- SELECT
- <include refid="dataRuleColumns"/>
- FROM sys_datarule a
- <include refid="dataRuleJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="menuId != null and menuId != ''">
- AND a.menu_id =#{menuId}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <select id="findByUserId" resultType="DataRule">
- SELECT DISTINCT
- <include refid="dataRuleColumns"/>
- FROM sys_datarule a
- JOIN sys_role_datarule rd ON rd.datarule_id = a.id
- JOIN sys_role r ON r.id = rd.role_id AND r.useable='1'
- JOIN sys_user_role ur ON ur.role_id = r.id
- JOIN sys_user u ON u.id = ur.user_id AND u.id = #{id}
- WHERE a.del_flag = #{DEL_FLAG_NORMAL} AND r.del_flag = #{DEL_FLAG_NORMAL} AND u.del_flag = #{DEL_FLAG_NORMAL}
- </select>
-
-
- <select id="findAllList" resultType="DataRule" >
- SELECT
- <include refid="dataRuleColumns"/>
- FROM sys_datarule a
- <include refid="dataRuleJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert">
- INSERT INTO sys_datarule(
- id,
- menu_id,
- name,
- className,
- t_field,
- t_express,
- t_value,
- sql_segment,
- remarks,
- del_flag
- ) VALUES (
- #{id},
- #{menuId},
- #{name},
- #{className},
- #{field},
- #{express},
- #{value},
- #{sqlSegment},
- #{remarks},
- #{delFlag}
- )
- </insert>
-
- <update id="update">
- UPDATE sys_datarule SET
- menu_id = #{menuId},
- name = #{name},
- className = #{className},
- t_field = #{field},
- t_express = #{express},
- t_value = #{value},
- sql_segment = #{sqlSegment},
- remarks = #{remarks}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM sys_datarule
- WHERE id = #{id}
- </update>
-
- <update id="deleteRoleDataRule">
- DELETE FROM sys_role_datarule
- WHERE datarule_id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE sys_datarule SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="DataRule" statementType="STATEMENT">
- select * FROM sys_datarule where ${propertyName} = '${value}'
- </select>
-
- </mapper>
|