PensionOrderDao.xml 8.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?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"/>
mlchun's avatar
mlchun committed
22 23 24
        <result property="actPrice" column="act_price"/>
        <result property="communityName" column="community_name"/>
        <result property="communityId" column="community_id"/>
25 26 27 28 29 30 31 32 33
        <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>

mlchun's avatar
mlchun committed
34
    <select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
mlchun's avatar
mlchun committed
35 36 37 38 39 40 41
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date
        FROM pension_order po
        WHERE po.id = #{orderId} AND po.status = #{status}
mlchun's avatar
mlchun committed
42 43
    </select>

44
    <select id="getOrderPageByStatusOrUserId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
mlchun's avatar
mlchun committed
45 46 47 48 49 50 51 52
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               ps.icon
        FROM pension_order po, pension_service ps
        WHERE po.service_id = ps.id
53 54
        <if test="status != null and status == 0">
            <if test="userId != null">
mlchun's avatar
mlchun committed
55
                AND po.order_recipient_id IS NULL
56
            </if>
mlchun's avatar
mlchun committed
57
            AND po.status = 0
58 59 60
        </if>
        <if test="status != null and status != 0">
            <if test="userId != null">
mlchun's avatar
mlchun committed
61
                AND po.order_recipient_id = #{userId}
62
            </if>
mlchun's avatar
mlchun committed
63
            AND po.status = #{status}
64 65
        </if>
        <if test="status == null and userId != null">
mlchun's avatar
mlchun committed
66
            AND po.order_recipient_id = #{userId}
67 68 69 70
        </if>
    </select>

    <select id="getOrderInfoByIdAndUserIdOrStatus" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
mlchun's avatar
mlchun committed
71 72 73 74 75 76 77 78
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               ps.icon
        FROM pension_order po, pension_service ps
        WHERE po.service_id = ps.id AND po.id = #{orderId}
79
        <if test="userId != null">
mlchun's avatar
mlchun committed
80
            AND po.order_recipient_id = #{userId}
81 82
        </if>
        <if test="status != null">
mlchun's avatar
mlchun committed
83
            AND po.status = #{status}
84 85 86 87
        </if>
    </select>

    <select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
mlchun's avatar
mlchun committed
88 89 90 91 92 93 94 95
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               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 po.order_recipient_id IS NULL
96 97
    </select>

98
    <select id="getElderTodayOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
mlchun's avatar
mlchun committed
99 100 101 102 103 104 105 106
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               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.creator = #{creator}
107 108 109
    </select>

    <select id="getElderAllOrderOrByStatusList" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
mlchun's avatar
mlchun committed
110 111 112 113 114 115 116 117
        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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               ps.icon
        FROM pension_order po, pension_service ps
        WHERE po.service_id = ps.id AND po.creator = #{creator}
118
        <if test="status != null">
mlchun's avatar
mlchun committed
119
            AND po.status = #{status}
120 121 122
        </if>
    </select>

mlchun's avatar
mlchun committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    <select id="getAllOrderByCommunityUserIdPage" 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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               ps.icon
        FROM pension_order po, pension_service ps, tb_user tu
        WHERE po.service_id = ps.id AND po.community_id = tu.community_id AND tu.id = #{userId}
    </select>

    <select id="getElderAllOrderByCommunityUserIdPage" 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_time, po.order_recipient_phone,
               po.act_price, po.community_name, po.community_id, po.dept_id,
               po.creator, po.creator_name, po.creator_tel, po.create_date,
               ps.icon
        FROM pension_order po, pension_service ps, tb_user tu
        WHERE po.service_id = ps.id AND po.community_id = tu.community_id
          AND tu.id = #{userId} AND po.appointment_person LIKE CONCAT('%', #{appointmentPerson}, '%')
    </select>

146
</mapper>