BusinessInfoMapper.xml 2.77 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.BusinessInfoMapper">
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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="BusinessInfo">
        <id column="id" property="id"/>
        <result column="creator" property="creator"/>
        <result column="name" property="name"/>
        <result column="icon" property="icon"/>
        <result column="process" property="process"/>
        <result column="guide" property="guide"/>
        <result column="is_skip" property="isSkip"/>
        <result column="skip_link" property="skipLink"/>
        <result column="status" property="status"/>
        <result column="sortorder" property="sortorder"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="modifier" property="modifier"/>
        <result column="bank_branch_id" property="bankBranchId"/>
        <result column="icon_color" property="iconColor"/>
        <result column="reviewer" property="reviewer"/>
        <result column="reject_reason" property="rejectReason"/>
    </resultMap>

    <select id="selectOneById" resultMap="BaseResultMap">
        SELECT
        bif.*,
        ce.`name` AS CreateEmployee,
        me.`name` AS ModifyEmployee,
        bbi.name AS BankName,
        bbi.id AS BankId
        FROM
        business_info bif
        LEFT JOIN employee ce ON ce.id = bif.creator
        LEFT JOIN employee me ON me.id = bif.modifier
        LEFT JOIN bank_branch_info bbi ON bif.bank_branch_id = bbi.id
        <where>
            <if test=" id != null and id != '' ">
                bif.id = #{id}
            </if>
        </where>
    </select>

    <select id="selectListByName" resultMap="BaseResultMap">
        SELECT
        bif.*,
        ce.`name` AS CreateEmployee,
        me.`name` AS ModifyEmployee,
        re.`name` AS reviewerName,
        bbi.name AS BankName
        FROM
        business_info bif
        LEFT JOIN employee ce ON ce.id = bif.creator
        LEFT JOIN employee me ON me.id = bif.modifier
        LEFT JOIN employee re ON re.id = bif.reviewer
        LEFT JOIN bank_branch_info bbi ON bif.bank_branch_id = bbi.id
        <where>
            <if test=" name != null and name != '' ">
                bif.name LIKE CONCAT('%','${name}','%')
            </if>
            <if test="bankId != null and bankId != ''">
                AND bbi.id = #{bankId}
            </if>
            <if test="currentBankId != null and currentBankId != '' and roleId == 3">
                AND bbi.id = #{currentBankId}
            </if>
        </where>
        ORDER BY bif.update_time DESC
    </select>

</mapper>