<?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.userinfo.mapper.HsSysUserinfoMapper">

    <sql id="columns">
         user_id as userId, user_name as userName, phone_number as phoneNumber, user_password as userPassword, card_type as cardType, card_number as cardNumber, birthday as birthday, address as address, mail_box as mailBox, related_account as relatedAccount, organization_code as organizationCode, is_delete as isDelete, create_by as createBy, create_time as createTime, update_by as updateBy, update_time as updateTime
    </sql>

    <sql id="where">
        <where>
            <if test="@sqlt.Ognl@isNotEmpty(userName)">
                and user_name like concat('%', #{userName}, '%')
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(phoneNumber)">
                and phone_number = #{phoneNumber}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(cardType)">
                and card_type = #{cardType}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(cardNumber)">
                and card_number = #{cardNumber}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(birthday)">
                and birthday = #{birthday}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(address)">
                and address = #{address}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(mailBox)">
                and mail_box = #{mailBox}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(relatedAccount)">
                and related_account = #{relatedAccount}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(organizationCode)">
                and organization_code = #{organizationCode}
            </if>
            <if test="@sqlt.Ognl@isNotEmpty(isDelete)">
                and is_delete = #{isDelete}
            </if>
        </where>
    </sql>

    <select id="selectHsSysUserinfoList" resultType="com.willalp.control.userinfo.domain.HsSysUserinfo">
        select
        <include refid="columns"/>
        from hs_sys_userinfo
        <include refid="where"/>
    </select>
</mapper>
