|
- <?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.iformall.mapper.MallPermissionMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.MallPermission">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="parent_id" jdbcType="BIGINT" property="parentId"/>
- <result column="available" jdbcType="VARCHAR" property="available"/>
- <result column="permission" jdbcType="VARCHAR" property="permission"/>
- <result column="resource_type" jdbcType="VARCHAR" property="resourceType"/>
- <result column="module_color" jdbcType="VARCHAR" property="moduleColor"/>
- <result column="module_color_num" jdbcType="VARCHAR" property="moduleColorNum"/>
- <result column="url" jdbcType="VARCHAR" property="url"/>
- <result column="icon" jdbcType="VARCHAR" property="icon"/>
- <result column="version_type" jdbcType="VARCHAR" property="versionType"/>
- <result column="sort" jdbcType="INTEGER" property="sort"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`name`,`parent_id`,`available`,`permission`,`resource_type`,`module_color`,`module_color_num`,`url`,`icon`,`sort`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != name ">
- and `name` = #{name}
- </if>
- <if test=" null != nameLike and '' != nameLike ">
- and `name` like concat('%', #{nameLike},'%')
- </if>
-
- <if test=" null != parentId ">
- and `parent_id` = #{parentId}
- </if>
-
- <if test=" null != available ">
- and `available` like concat('%', #{available},'%')
- </if>
-
- <if test=" null != permission ">
- and `permission` like concat('%', #{permission},'%')
- </if>
- <if test=" null != permissions ">
- and `permission` in
- <foreach collection="permissions" item="item_permission" open="(" close=")" separator=",">
- #{item_permission}
- </foreach>
- </if>
-
- <if test=" null != resourceType ">
- and `resource_type` like concat('%', #{resourceType},'%')
- </if>
-
- <if test=" null != url ">
- and `url` = #{url}
- </if>
-
- <if test=" null != icon ">
- and `icon` = #{icon}
- </if>
-
- <if test=" null != sort ">
- and `sort` = #{sort}
- </if>
- <if test=" null != sortFrom ">and `sort` >= #{sortFrom}</if>
- <if test=" null != sortTo ">and #{sortTo} >= `sort`</if>
- <if test=" null != sortGte ">and `sort` >= #{sortGte}</if>
- <if test=" null != sortGt ">and `sort` > #{sortGt}</if>
- <if test=" null != sortLte ">and #{sortLte} >= `sort`</if>
- <if test=" null != sortLt ">and #{sortLt} > `sort`</if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.MallPermission" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_permission
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="queryListParentId" parameterType="long" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_permission
- where 1=1 and `parent_id` = #{value} and available = 'Y' order by sort asc
- </select>
-
- <select id="queryBtnListByParentId" parameterType="long" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_permission
- where `parent_id` = #{value} and available = 'Y' and `resource_type` = 2 order by sort asc
- </select>
-
- <select id="queryNotButtonList" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from mall_permission
- where 1=1 and `resource_type` != 2 and `available` = 'Y' order by sort asc
- </select>
-
-
- </mapper>
|