<?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.hc.gpbusiness.mapper.WebQrCodeMapper">

    <resultMap type="com.hc.gpbusiness.model.WebQrCode" id="WebQrCodeMap">
        <result property="qrId" column="qr_id" jdbcType="INTEGER"/>
        <result property="qrName1" column="qr_name1" jdbcType="VARCHAR"/>
        <result property="qrName2" column="qr_name2" jdbcType="VARCHAR"/>
        <result property="qrType" column="qr_type" jdbcType="VARCHAR"/>
        <result property="qrId1" column="qr_id1" jdbcType="INTEGER"/>
        <result property="qrId2" column="qr_id2" jdbcType="INTEGER"/>
        <result property="fileName" column="file_name" jdbcType="VARCHAR"/>
        <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        qr_id,
           qr_name1,
           qr_name2,
           qr_type,
           qr_id1,
           qr_id2,
           file_name,
           file_url
    </sql>

    <select id="queryByAll" resultType="com.hc.gpbusiness.model.WebQrCode">
        SELECT
        <include refid="Base_Column_List"/>
        from web_qr_code
        <where>
            <if test="qrName1!=null and qrName1!=''">
                AND qr_name1 LIKE "%"#{qrName1}"%"
            </if>
            <if test="qrName2!=null and qrName2!=''">
                AND qr_name2 LIKE "%"#{qrName2}"%"
            </if>
            <if test="qrId1!=null">
                AND qr_id1 = #{qrId1}
            </if>
            <if test="qrId2!=null">
                AND qr_id2 = #{qrId2}
            </if>
            <if test="qrType!=null">
                AND qr_type = #{qrType}
            </if>
            <if test="fileName!=null and fileName!=''">
                AND file_name LIKE "%"#{fileName}"%"
            </if>
        </where>
        ORDER BY qr_id asc
    </select>

</mapper>
