<?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.WxLogicPermissionMapper">
	<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLogicPermission">
		<id column="id" jdbcType="BIGINT" property="id"/>
		<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
		<result column="name" jdbcType="VARCHAR" property="name"/>
		<result column="permission" jdbcType="VARCHAR" property="permission"/>
		<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
		<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
	</resultMap>
	
	<sql id="allColumns">
        `id`,`parent_id`,`name`,`permission`,`create_date`,`update_date`
	</sql>
	
	<sql id="dynamicWhereConditions">
		where 1 = 1
		
		<if test=" null != id ">
			and `id` = #{id}
		</if>
		
		<if test=" null != parentId ">
			and `parent_id` = #{parentId}
		</if>
		
		<if test=" null != name ">
			and `name` like concat('%',#{name},'%')
		</if>
		<if test=" null != sortColumns">order by ${sortColumns}</if>
	</sql>
	
	<select id="findList" parameterType="com.iformall.domain.po.WxLogicPermission" resultMap="BaseResultMap">
		select
		<include refid="allColumns"/>
		from wx_logic_permission
		<include refid="dynamicWhereConditions"/>
	</select>

</mapper>
