<?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.BusinessInfoMapper"> <!-- 通用查询映射结果 --> <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>