BankBranchInfoMapper.xml 2.28 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.chnmuseum.party.mapper.BankBranchInfoMapper">
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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="BankBranchInfo">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="address" property="address" />
        <result column="is_deleted" property="isDeleted" />
        <result column="image_url" property="imageUrl" />
        <result column="phone_num" property="phoneNum" />
        <result column="width" property="width" />
        <result column="height" property="height" />
        <result column="sortorder" property="sortorder" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="status" property="status" />
        <result column="bank_qr_code" property="bankQrCode" />
        <result column="head_image" property="headImage" />
        <result column="reject_reason" property="rejectReason" />
        <result column="creator" property="creator" />
        <result column="modifier" property="modifier" />
        <result column="is_show" property="isShow" />
        <result column="reviewer" property="reviewer"/>
        <result column="lon" property="lon"/>
        <result column="lat" property="lat"/>
    </resultMap>

    <select id="selectListByName" resultMap="BaseResultMap">
liqin's avatar
liqin committed
31
        SELECT bbi.*,
liqin's avatar
liqin committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
            c.name AS creatorName,
            m.name AS modifierName
        FROM bank_branch_info bbi
        LEFT JOIN employee c ON bbi.creator = c.id
        LEFT JOIN employee m ON bbi.modifier = m.id
        <where>
            bbi.is_deleted = 0
            <if test=" name != null and name != '' ">
                AND bbi.name LIKE CONCAT('%','${name}','%')
            </if>
            <if test="currentBankId != null and currentBankId != '' and roleId == 3 ">
                AND bbi.id = #{currentBankId}
            </if>
            <if test=" query != null and query == 'map' ">
                AND bbi.id != '0'
            </if>
        </where>
        ORDER BY CONVERT (bbi.name USING gbk) COLLATE gbk_chinese_ci ASC
    </select>

</mapper>