| <?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.stylefeng.guns.modular.system.dao.OrderCancelMapper"> | 
|   | 
|     <!-- 通用查询映射结果 --> | 
|     <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.OrderCancel"> | 
|         <id column="id" property="id"/> | 
|         <result column="orderId" property="orderId"/> | 
|         <result column="orderType" property="orderType"/> | 
|         <result column="reason" property="reason"/> | 
|         <result column="remark" property="remark"/> | 
|         <result column="payType" property="payType"/> | 
|         <result column="money" property="money"/> | 
|         <result column="state" property="state"/> | 
|         <result column="insertTime" property="insertTime"/> | 
|         <result column="userType" property="userType"/> | 
|         <result column="userId" property="userId"/> | 
|     </resultMap> | 
|   | 
|   | 
|     <select id="query" resultType="OrderCancel"> | 
|         select | 
|         id as id, | 
|         orderId as orderId, | 
|         orderType as orderType, | 
|         reason as reason, | 
|         remark as remark, | 
|         payType as payType, | 
|         money as money, | 
|         state as state, | 
|         insertTime as insertTime, | 
|         userType as userType, | 
|         userId as userId | 
|         from t_order_cancel where 1 = 1 | 
|         <if test="null != orderId"> | 
|             and orderId = #{orderId} | 
|         </if> | 
|         <if test="null != orderType"> | 
|             and orderType = #{orderType} | 
|         </if> | 
|         <if test="null != money"> | 
|             and money = #{money} | 
|         </if> | 
|         <if test="null != payType"> | 
|             and payType = #{payType} | 
|         </if> | 
|         <if test="null != state"> | 
|             and state = #{state} | 
|         </if> | 
|         order by insertTime desc limit 0,1 | 
|     </select> | 
|   | 
|   | 
|     <select id="queryCancel" resultType="map"> | 
|         select | 
|         (money * -1) as money, | 
|         DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, | 
|         CONCAT(if(orderType = 1, '专车', if(orderType = 2, '出租车', if(orderType = 3, '跨城', if(orderType = 4, '同城小件物流', if(orderType = 5, '跨城小件物流', '包车'))))), '订单取消') as name, | 
|         UNIX_TIMESTAMP(insertTime) as insertTime | 
|         from t_order_cancel where state = 2 and userType = 1 and money is not null and userId = #{uid} | 
|         <choose> | 
|             <when test="1 == isPay"> | 
|                 and money is null | 
|             </when> | 
|             <otherwise> | 
|                 and money is not null | 
|             </otherwise> | 
|         </choose> | 
|     </select> | 
| </mapper> |