<?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.willalp.group.mapper.HsGroupConfigMapper">

    <resultMap type="com.willalp.group.domain.HsGroupConfig" id="HsGroupConfigResult">
        <result property="id" column="id"/>
        <result property="groupCode" column="group_code"/>
        <result property="groupName" column="group_name"/>
        <result property="groupMember" column="group_member"/>
        <result property="isDelete" column="is_delete"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectHsGroupConfigVo">
        select id,
               group_code,
               group_name,
               group_member,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_group_config
    </sql>

    <select id="selectHsGroupConfigList" parameterType="HsGroupConfig" resultMap="HsGroupConfigResult">
        <include refid="selectHsGroupConfigVo"/>
        <where>
            is_delete = 0
            <if test="groupCode != null  and groupCode != ''">
                and group_code like concat('%', #{groupCode}, '%')
            </if>
            <if test="groupName != null  and groupName != ''">
                and group_name like concat('%', #{groupName}, '%')
            </if>
            <if test="groupMember != null  and groupMember != ''">
                and group_member like concat('%', #{groupMember}, '%')
            </if>
            <if test="isDelete != null ">
                and is_delete = #{isDelete}
            </if>
        </where>
    </select>
</mapper>
