<?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="com.casic.missiles.mapper.business.BusinessInterchangeMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.casic.missiles.model.business.BusinessInterchange"> <id column="id" property="id"/> <result column="interchange_code" property="interchangeCode"/> <result column="order_id" property="orderId"/> <result column="certification_company" property="certificationCompany"/> <result column="certification_company_fex" property="certificationCompanyFex"/> <result column="certification_company_email" property="certificationCompanyEmail"/> <result column="reciever" property="reciever"/> <result column="reciever_phone" property="recieverPhone"/> <result column="certification_company_address" property="certificationCompanyAddress"/> <result column="customer_id" property="customerId"/> <result column="require_over_time" property="requireOverTime"/> <result column="deliver_time" property="deliverTime"/> <result column="mesure_category" property="mesureCategory"/> <result column="secrecy" property="secrecy"/> <result column="appearance" property="appearance"/> <result column="rely_file" property="relyFile"/> <result column="deliverer_sign_file" property="delivererSignFile"/> <result column="deliverer_sign_time" property="delivererSignTime"/> <result column="reciever_sign_file" property="recieverSignFile"/> <result column="remark" property="remark"/> <result column="is_del" property="isDel"/> <result column="create_user" property="createUser"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, interchange_code, order_id, certification_company, certification_company_fex, certification_company_email, reciever, reciever_phone, certification_company_address, customer_id, require_over_time, deliver_time, mesure_category, secrecy, appearance, rely_file, deliverer_sign_file, deliverer_sign_time, reciever_sign_file, remark, is_del, create_user, create_time, update_time </sql> <select id="selectInterchangeList" resultType="com.casic.missiles.dto.business.interchange.InterchangeListResponse"> SELECT * FROM ( SELECT id,interchange_code AS "interchangeCode",customer_code AS "customerCode",customer_name AS "customerName", deliverer,deliver_time AS "deliverTime",remark FROM business_interchange bi WHERE is_del = 0 <if test="request.interchangeCode != null and request.interchangeCode !=''"> AND interchange_Code=#{request.interchangeCode} </if> <if test="request.customerCode != null and request.customerCode !=''"> AND customer_Code=#{request.customerCode} </if> <if test="request.customerName != null and request.customerName !=''"> AND customer_name=#{request.customerName} </if> <if test="request.reciever != null and request.reciever !=''"> AND deliverer=#{request.reciever} </if> <if test="request.deliverTime != null and request.deliverTime !=''"> AND deliver_time=#{request.deliverTime} </if> <if test="request.deliverTime != null and request.deliverTime !=''"> AND deliver_time=#{request.deliverTime} </if> ) bif JOIN ( SELECT deliverer FROM business_order WHERE is_del = 0 <if test="request.deliverer != null and request.deliverer !=''"> AND deliverer=#{request.deliverer} </if> ) bo ON bo.id = bif.customer_id ORDER bif.deliver_time DESC </select> <select id="selectMaxExchangeNo" resultType="Long"> SELECT IFNULL(max(RIGHT(interchange_code, 12)), 0) FROM business_interchange </select> </mapper>