ProductAppointmentRecordMapper.xml 4.27 KB
Newer Older
liqin's avatar
liqin committed
1 2
<?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">
liqin's avatar
liqin committed
3
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.ProductAppointmentRecordMapper">
liqin's avatar
liqin committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="ProductAppointmentRecord">
        <id column="id" property="id" />
        <result column="pro_act_id" property="proActId" />
        <result column="name" property="name" />
        <result column="phone_number" property="phoneNumber" />
        <result column="detail" property="detail" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="book_people_id" property="bookPeopleId" />
        <result column="recipient_id" property="recipientId" />
        <result column="bank_branch_id" property="bankBranchId" />
        <result column="type" property="type" />
        <result column="money" property="money" />
        <result column="number_of_people" property="numberOfPeople" />
    </resultMap>

    <select id="getPARList" parameterType="java.util.HashMap" resultMap="BaseResultMap">
        SELECT
            par.*,
            hpa.name AS proActName,
            hpa.icon AS icon,
            bbi.name AS bankName
        FROM product_appointment_record par
        LEFT JOIN hot_product_activity hpa ON par.pro_act_id = hpa.id
        LEFT JOIN bank_branch_info bbi ON par.bank_branch_id = bbi.id
        <where>
            <if test="proActName != null and proActName != ''">
                hpa.name LIKE concat('%', #{proActName}, '%')
            </if>
            <if test="type != null and type != ''">
                AND par.`type` = #{type}
            </if>
            <if test="id != null and id != ''">
                AND par.id = #{id}
            </if>
            <if test="bankId != null and bankId != ''">
                AND bbi.id = #{bankId}
            </if>
            <if test="bookPeopleId != null and bookPeopleId != ''">
                AND par.book_people_id = #{bookPeopleId}
            </if>
            <if test="currentBankId != null and currentBankId != '' and roleId == 3 ">
                AND bbi.id = #{currentBankId}
            </if>
        </where>
        ORDER BY par.create_time DESC
    </select>

    <select id="downLoadPAR" parameterType="java.util.HashMap" resultMap="BaseResultMap">
        SELECT
        par.*,
        hpa.name AS proActName,
        bbi.name AS bankName
        FROM product_appointment_record par
        LEFT JOIN hot_product_activity hpa ON par.pro_act_id = hpa.id
        LEFT JOIN bank_branch_info bbi ON par.bank_branch_id = bbi.id
        <where>
            <if test="proActName != null and proActName != ''">
                hpa.name LIKE concat('%', #{proActName}, '%')
            </if>
            <if test="type != null and type != ''">
                AND par.`type` = #{type}
            </if>
            <if test="id != null and id != ''">
                AND par.id = #{id}
            </if>
            <if test="bankId != null and bankId != ''">
                AND bbi.id = #{bankId}
            </if>
            <if test="bookPeopleId != null and bookPeopleId != ''">
                AND par.book_people_id = #{bookPeopleId}
            </if>
            <if test="currentBankId != null and currentBankId != '' and roleId == 3 ">
                AND bbi.id = #{currentBankId}
            </if>
        </where>
        ORDER BY par.create_time DESC
    </select>

    <select id="getPARListOnApp" parameterType="java.util.HashMap" resultMap="BaseResultMap">
        SELECT
            par.*,
            hpa.name AS proActName,
            hpa.icon AS icon
        FROM product_appointment_record par
        LEFT JOIN hot_product_activity hpa ON par.pro_act_id = hpa.id
        <where>
            <if test="type != null and type != ''">
                AND par.`type` = #{type}
            </if>
            <if test="bankId != null and bankId != ''">
                AND par.bank_branch_id = #{bankId}
            </if>
            <if test="bookPeopleId != null and bookPeopleId != ''">
                AND par.book_people_id = #{bookPeopleId}
            </if>
        </where>
        ORDER BY par.create_time DESC
    </select>
</mapper>