PensionOrderDao.xml 4.54 KB
<?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="io.hmit.modules.serviceOrder.dao.PensionOrderDao">

    <resultMap type="io.hmit.modules.serviceOrder.entity.PensionOrderEntity" id="pensionOrderMap">
        <result property="id" column="id"/>
        <result property="orderNum" column="order_num"/>
        <result property="status" column="status"/>
        <result property="statusName" column="status_name"/>
        <result property="address" column="address"/>
        <result property="serviceId" column="service_id"/>
        <result property="serviceName" column="service_name"/>
        <result property="appointmentPerson" column="appointment_person"/>
        <result property="appointmentPhone" column="appointment_phone"/>
        <result property="appointmentTime" column="appointment_time"/>
        <result property="remark" column="remark"/>
        <result property="orderRecipientId" column="order_recipient_id"/>
        <result property="orderRecipientName" column="order_recipient_name"/>
        <result property="orderRecipientTime" column="order_recipient_time"/>
        <result property="orderRecipientPhone" column="order_recipient_phone"/>
        <result property="deptId" column="dept_id"/>
        <result property="creator" column="creator"/>
        <result property="creatorName" column="creator_name"/>
        <result property="creatorTel" column="creator_tel"/>
        <result property="createDate" column="create_date"/>
        <result property="updater" column="updater"/>
        <result property="updateDate" column="update_date"/>
    </resultMap>

    <select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
        SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
    </select>

    <select id="getOrderPageByStatusOrUserId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
        select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
        po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
        po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
        po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
        from pension_order po, pension_service ps
        where po.service_id = ps.id
        <if test="status != null and status == 0">
            <if test="userId != null">
                and order_recipient_id is null
            </if>
            and po.status = 0
        </if>
        <if test="status != null and status != 0">
            <if test="userId != null">
                and order_recipient_id = #{userId}
            </if>
            and po.status = #{status}
        </if>
        <if test="status == null and userId != null">
            and order_recipient_id = #{userId}
        </if>
    </select>

    <select id="getOrderInfoByIdAndUserIdOrStatus" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
        select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
               po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
               po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
               po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
        from pension_order po, pension_service ps
        where po.service_id = ps.id and po.id = #{orderId}
        <if test="userId != null">
            and po.order_recipient_id = #{userId}
        </if>
        <if test="status != null">
            and po.status = #{status}
        </if>
    </select>

    <select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
        select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
               po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
               po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
               po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
        from pension_order po, pension_service ps
        where po.service_id = ps.id and TO_DAYS(appointment_time) = TO_DAYS(NOW()) and po.status = 0 and order_recipient_id IS NULL
    </select>

</mapper>