<?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.push.mapper.HsAppPushMapper">

    <resultMap type="com.willalp.push.domain.HsAppPush" id="HsAppPushResult">
        <result property="pushId" column="push_id"/>
        <result property="pushCid" column="push_cid"/>
        <result property="userNo" column="user_no"/>
        <result property="orgNo" column="org_no"/>
        <result property="ipAddr" column="ip_addr"/>
        <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="selectHsAppPushVo">
        select push_id,
               push_cid,
               user_no,
               org_no,
               ip_addr,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_app_push
    </sql>

    <select id="selectHsAppPushList" parameterType="HsAppPush" resultMap="HsAppPushResult">
        <include refid="selectHsAppPushVo"/>
        <where>
            is_delete = 0
            <if test="pushCid != null  and pushCid != ''">
                and push_cid like concat('%', #{pushCid}, '%')
            </if>
            <if test="userNo != null  and userNo != ''">
                and user_no like concat('%', #{userNo}, '%')
            </if>
            <if test="orgNo != null  and orgNo != ''">
                and org_no like concat('%', #{orgNo}, '%')
            </if>
            <if test="ipAddr != null  and ipAddr != ''">
                and ip_addr like concat('%', #{ipAddr}, '%')
            </if>
            <if test="isDelete != null ">
                and is_delete = #{isDelete}
            </if>
        </where>
    </select>
</mapper>
