<?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.WxTagsTypeMapper">
    <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTagsType">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="group_id" jdbcType="BIGINT" property="groupId"/>
        <result column="group_name" jdbcType="VARCHAR" property="groupName"/>
        <result column="flag" jdbcType="INTEGER" property="flag"/>
    </resultMap>

    <sql id="allColumns">
	    `id`,`name`,`group_id`,`group_name`,`flag`
	</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 != groupId ">
            and `group_id` = #{groupId}
        </if>

        <if test=" null != groupName ">
            and `group_name` = #{groupName}
        </if>

        <if test=" null != flag ">
            and `flag` = #{flag}
        </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.WxTagsType" resultMap="BaseResultMap">
        select
        <include refid="allColumns"/>
        from wx_tags_type
        <include refid="dynamicWhereConditions"/>
    </select>


</mapper>
