<?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.event.mapper.HsAssociationsInfoMapper">

    <resultMap type="com.willalp.event.domain.HsAssociationsInfo" id="HsAssociationsInfoResult">
        <result property="id" column="id"/>
        <result property="projectName" column="project_name"/>
        <result property="associationsName" column="associations_name"/>
        <result property="users" column="users"/>
        <result property="mien" column="mien"/>
        <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="selectHsAssociationsInfoVo">
        select id,
               project_name,
               associations_name,
               users,
               mien,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_associations_info
    </sql>

    <select id="selectHsAssociationsInfoList" parameterType="HsAssociationsInfo" resultMap="HsAssociationsInfoResult">
        <include refid="selectHsAssociationsInfoVo"/>
        <where>
            is_delete = 0
            <if test="projectName != null  and projectName != ''">
                and project_name like concat('%', #{projectName}, '%')
            </if>
            <if test="associationsName != null  and associationsName != ''">
                and associations_name like concat('%', #{associationsName}, '%')
            </if>
            <if test="users != null  and users != ''">
                and users = #{users}
            </if>
            <if test="mien != null  and mien != ''">
                and mien = #{mien}
            </if>
        </where>
    </select>
    <select id="appGetClubs" resultType="com.willalp.event.domain.HsAssociationsInfo">
        select id,
               project_name,
               associations_name
        from hs_associations_info
        where is_delete = 0
          AND locate(#{userCode}, users)
    </select>
</mapper>
