|
- <?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.simple.mapper.MallPermissionMapper">
- <resultMap id="BaseResultMap" type="com.simple.domain.po.MallPermission">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="available" jdbcType="VARCHAR" property="available" />
- <result column="parent_id" jdbcType="BIGINT" property="parentId" />
- <result column="parent_ids" jdbcType="VARCHAR" property="parentIds" />
- <result column="permission" jdbcType="VARCHAR" property="permission" />
- <result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
- <result column="url" jdbcType="VARCHAR" property="url" />
- <result column="sort" jdbcType="INTEGER" property="sort" />
- </resultMap>
-
- <sql id="allColumns">
- `id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
-
- <if test=" null != name ">
- and `name` like concat('%', #{name},'%')
-
- </if>
- <if test=" null != nameLike and '' != nameLike "> and `name` like concat('%', #{nameLike},'%')</if>
-
- <if test=" null != available ">
- and `available` like concat('%', #{available},'%')
-
- </if>
-
- <if test=" null != parentId ">
- and `parent_id` = #{parentId}
-
- </if>
-
- <if test=" null != parentIds ">
- and `parent_ids` like concat('%', #{parentIds},'%')
-
- </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` like concat('%', #{url},'%')
-
- </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.simple.domain.po.MallPermission" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from mall_permission
- <include refid="dynamicWhereConditions" />
- </select>
-
-
-
-
-
-
- </mapper>
|