<?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.DemandInfoMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="DemandInfo"> <id column="id" property="id" /> <result column="line_number" property="lineNumber" /> <result column="content" property="content" /> <result column="phone_number" property="phoneNumber" /> <result column="feedback_info" property="feedbackInfo" /> <result column="advisor_id" property="advisorId" /> <result column="type" property="type" /> <result column="create_time" property="createTime" /> <result column="feedback_link" property="feedbackLink" /> <result column="feedback_person_id" property="feedbackPersonId" /> <result column="feedback_time" property="feedbackTime" /> <result column="bank_branch_id" property="bankBranchId" /> </resultMap> <select id="selectOneById" resultMap="BaseResultMap"> SELECT di.*, ep.`name` AS feedbackPersonName, bbi.`name` AS bankBranchName FROM demand_info di LEFT JOIN employee ep ON ep.id = di.feedback_person_id LEFT JOIN bank_branch_info bbi ON bbi.id = di.bank_branch_id <where> <if test=" id != null and id != '' "> di.id = #{id} </if> </where> </select> <select id="selectDemandInfoList" resultMap="BaseResultMap"> SELECT di.*, ep.`name` AS feedbackPersonName, bbi.`name` AS bankBranchName FROM demand_info di LEFT JOIN employee ep ON ep.id = di.feedback_person_id LEFT JOIN bank_branch_info bbi ON bbi.id = di.bank_branch_id <where> 1=1 <if test=" lineNumber != null and lineNumber != '' "> AND di.line_number = #{lineNumber} </if> <if test=" content != null and content != '' "> AND di.content LIKE CONCAT('%','${content}','%') </if> <if test=" phoneNumber != null and phoneNumber != '' "> AND di.phone_number = #{phoneNumber} </if> <if test=" startDate != null and startDate != '' and endDate != null and endDate != '' "> AND di.feedback_time BETWEEN #{startDate} AND #{endDate} </if> <if test=" callStartDate != null and callStartDate != '' and callEndDate != null and callEndDate != '' "> AND di.create_time BETWEEN #{callStartDate} AND #{callEndDate} </if> <if test=" type != null and type != '' "> AND di.type = #{type} </if> <if test=" bankBranchId != null and bankBranchId != '' "> AND bbi.id = #{bankBranchId} </if> <if test="currentBankId != null and currentBankId != '' and roleId == 3 "> AND bbi.id = #{currentBankId} </if> </where> ORDER BY di.create_time DESC </select> </mapper>