HotProductActivityMapper.xml 2.42 KB
<?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="cn.wisenergy.chnmuseum.party.mapper.HotProductActivityMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="HotProductActivity">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="content" property="content"/>
        <result column="image_url" property="imageUrl"/>
        <result column="type" property="type"/>
        <result column="is_show" property="isShow"/>
        <result column="sortorder" property="sortorder"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="icon" property="icon"/>
        <result column="bank_branch_id" property="bankBranchId"/>
        <result column="creator" property="creator"/>
        <result column="modifier" property="modifier"/>
        <result column="reject_reason" property="rejectReason"/>
        <result column="reviewer" property="reviewer"/>
        <result column="max_number" property="maxNumber"/>
        <result column="max_money" property="maxMoney"/>
        <result column="is_order" property="isOrder"/>
    </resultMap>

    <select id="getProActList" parameterType="java.util.HashMap" resultMap="BaseResultMap">
        SELECT
        hpa.`*`,
        bbi.name AS bankName,
        e.name AS creatorName,
        m.name AS modifierName,
        r.name AS reviewerName
        FROM hot_product_activity hpa
        LEFT JOIN bank_branch_info bbi ON hpa.bank_branch_id = bbi.id
        LEFT JOIN employee e ON e.id = hpa.creator
        LEFT JOIN employee m ON m.id = hpa.creator
        LEFT JOIN employee r ON r.id = hpa.reviewer
        <where>
            1=1
            <if test=" name != null and name != '' ">
                AND hpa.name LIKE CONCAT('%','${name}','%')
            </if>
            <if test=" bankId != null and bankId != '' ">
                AND bbi.id = #{bankId}
            </if>
            <if test=" type != null and type != '' ">
                AND hpa.type = #{type}
            </if>
            <if test="currentBankId != null and currentBankId != '' and roleId == 3">
                AND bbi.id = #{currentBankId}
            </if>
        </where>
        ORDER BY hpa.update_time DESC
    </select>

</mapper>