<?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.pz.system.mapper.YypzOrderMapper"> <resultMap type="com.pz.system.domain.YypzOrder" id="YypzOrderResult"> <result property="id" column="id"/> <result property="orderId" column="order_id"/> <result property="hid" column="hid"/> <result property="visitor" column="visitor"/> <result property="did" column="did"/> <result property="visitTime" column="visit_time"/> <result property="phone" column="phone"/> <result property="status" column="status"/> <result property="overTime" column="over_time"/> <result property="voucher" column="voucher"/> <result property="delFlag" column="del_flag"/> <result property="createBy" column="create_by"/> <result property="createTime" column="create_time"/> <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> <result property="remark" column="remark"/> </resultMap> <select id="findYypzOrderVoPage" resultType="com.pz.system.domain.vo.YypzOrderVo"> SELECT tlo.order_type as order_type, tlo.id as toOrderId, tlo.order_sn AS orderSn, tlo.pay_money AS PayMoney, s.`name` AS serviceName, c.`name` AS cityName, h.`name` AS hName, CASE yyod.did WHEN 0 THEN yyod.did_name ELSE d.title END as title, e.`name` AS eName, tlo.remark AS remark, yyod.visit_time AS visitTime, yyod.phone AS phone, yyod.`status` AS yStatus, tlo.`status` AS tStatus, tlo.is_satisfaction AS isSatisfaction, tlo.evaluation_content AS evaluationContent, yyod.over_time AS overtime, yyod.voucher AS voucher, yyod.create_time as createTime, yyod.visitor as visitor FROM yypz_order AS yyod LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id LEFT JOIN city AS c ON c.id = tlo.city_id LEFT JOIN hospital AS h ON h.id = yyod.hid LEFT JOIN department AS d ON d.id = yyod.did LEFT JOIN services AS s ON s.id = tlo.service_id LEFT JOIN employees AS e ON e.id = tlo.em_id LEFT JOIN company AS co ON co.id = e.company_id LEFT JOIN user_vsitor AS uv ON uv.id = yyod.visitor <where> <if test="bo.orderSn != null and bo.orderSn != ''"> and tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%') </if> <if test="bo.userId != null"> and co.uid = #{bo.userId} </if> <if test="bo.orderType != null"> and tlo.order_type = #{bo.orderType} </if> <if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''"> and yyod.create_time > = #{bo.startTime} and yyod.create_time < = #{bo.endTime} </if> <if test="bo.yStatus != null"> and yyod.`status` = #{yStatus} </if> <if test="bo.vistorName != null and bo.vistorName != ''"> and uv.name LIKE CONCAT('%', #{vistorName}, '%') </if> <if test="bo.receiverName != null and bo.receiverName != ''"> and e.name LIKE CONCAT('%', #{receiverName}, '%') </if> and yyod.create_time < NOW() </where> order by yyod.create_time desc </select> <select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo"> select vsitor.name as userName, yypz_order.status as orderStatus, sys_user.avatar, hospital.name as hospital, yypz_order.visit_time, yypz_order.id as sonOrderId from yypz_order left join user_vsitor as vsitor on vsitor.id = yypz_order.visitor left join sys_user on sys_user.user_id = vsitor.uid left join hospital on hospital.id = yypz_order.hid where yypz_order.order_id = #{id} </select> <select id="selectYypzOrderDetailDataByTotalId" resultType="com.pz.system.domain.vo.YypzOrderItemVo"> select total_order.id as orderId, yypz_order.id as serviceOrderId, total_order.business_id, total_order.status as orderStatus, yypz_order.status as serviceStatus, yypz_order.phone, yypz_order.visit_time, services.name as project, business.name as businessName, total_order.evaluation_content, total_order.is_satisfaction as evaluation_flag, total_order.remark as description, yypz_order.voucher, CONVERT((1 - services.fenmo / 100), decimal (10, 2)) * CONVERT(services.price, decimal (10, 2)) as commission, user_vsitor.name as userName, hospital.name as hospital, yypz_order.did_name as department, yypz_order.remark, total_order.uid as userId, employees.uid as euserId from total_order left join business on business.id = total_order.business_id left join yypz_order on yypz_order.order_id = total_order.id left join services on total_order.service_id = services.id left join employees on employees.id = total_order.em_id left join user_vsitor on user_vsitor.id = yypz_order.visitor left join hospital on yypz_order.hid = hospital.id left join department on department.id = yypz_order.did where total_order.id = #{id} </select> <select id="selectFinishTime" resultType="java.lang.String"> select visit_time from total_order t left join yypz_order d on d.order_id = t.id where t.id = #{id} </select> </mapper>