wlzboy
2026-02-05 57e98ac3f59e9ca12d3fdbc6f89c9c0b1f86be4d
ruoyi-system/src/main/resources/mapper/system/ServiceOrderMapper.xml
@@ -30,28 +30,50 @@
        <result property="serviceOrdTraPaidType"    column="ServiceOrdTraPaidType"    />
        <result property="serviceOrdTraPaidPrice"    column="ServiceOrdTraPaidPrice"    />
        <result property="serviceOrdUnitRemarks"    column="ServiceOrdUnitRemarks"    />
        <result property="serviceOrdCCTime"    column="ServiceOrd_CC_Time"    />
        <result property="serviceOrdVisit"    column="ServiceOrdVisit"    />
    </resultMap>
    <resultMap type="java.util.HashMap" id="ServiceCancelResult">
        <result property="ServiceOrdState" column="ServiceOrdState" />
        <result property="ServiceOrdCancelReason" column="ServiceOrdCancelReason" />
        <result property="ServiceOrdCancelReasonTXT" column="ServiceOrdCancelReasonTXT" />
    </resultMap>
    <sql id="selectServiceOrderVo">
        select ServiceOrdID, ServiceOrdUserID, ServiceOrdClass, ServiceOrdType, ServiceOrdState, ServiceOrdStartDate, ServiceOrdApptDate, ServiceOrdCoName, ServiceOrdCoPhone, ServiceOrdPtName, ServiceOrdPtAge, ServiceOrdPtSex, ServiceOrdPtKG, ServiceOrdPtNat, ServiceOrdPtIDCard, ServiceOrdTraProvince, ServiceOrdTraCity, ServiceOrdTraStreet, ServiceOrdTraEnd, ServiceOrdTraDistance, ServiceOrdTraUnitPrice, ServiceOrdTraTxnPrice, ServiceOrdTraPaidType, ServiceOrdTraPaidPrice, ServiceOrdUnitRemarks from ServiceOrder
        select ServiceOrdID, ServiceOrdUserID, ServiceOrdClass, ServiceOrdType, ServiceOrdState, ServiceOrdStartDate, ServiceOrdApptDate, ServiceOrdCoName, ServiceOrdCoPhone, ServiceOrdPtName, ServiceOrdPtAge, ServiceOrdPtSex, ServiceOrdPtKG, ServiceOrdPtNat, ServiceOrdPtIDCard, ServiceOrdTraProvince, ServiceOrdTraCity, ServiceOrdTraStreet, ServiceOrdTraEnd, ServiceOrdTraDistance, ServiceOrdTraUnitPrice, ServiceOrdTraTxnPrice, ServiceOrdTraPaidType, ServiceOrdTraPaidPrice, ServiceOrdUnitRemarks, ServiceOrd_CC_Time, ServiceOrdVisit from ServiceOrder
    </sql>
    <select id="selectServiceOrderList" parameterType="ServiceOrder" resultMap="ServiceOrderResult">
        <include refid="selectServiceOrderVo"/>
    <sql id="selectServiceOrderWhere">
        <where>  
            <if test="serviceOrdUserID != null "> and ServiceOrdUserID = #{serviceOrdUserID}</if>
            <if test="serviceOrdClass != null  and serviceOrdClass != ''"> and ServiceOrdClass = #{serviceOrdClass}</if>
            <if test="serviceOrdType != null "> and ServiceOrdType = #{serviceOrdType}</if>
            <if test="serviceOrdState != null "> and ServiceOrdState = #{serviceOrdState}</if>
            <if test="serviceOrdStartDate != null "> and ServiceOrdStartDate = #{serviceOrdStartDate}</if>
            <if test="serviceOrdApptDate != null "> and ServiceOrdApptDate = #{serviceOrdApptDate}</if>
            <if test="serviceOrdCoName != null  and serviceOrdCoName != ''"> and ServiceOrdCoName like concat('%', #{serviceOrdCoName}, '%')</if>
            <if test="serviceOrdCoPhone != null  and serviceOrdCoPhone != ''"> and ServiceOrdCoPhone = #{serviceOrdCoPhone}</if>
            <if test="serviceOrdPtName != null  and serviceOrdPtName != ''"> and ServiceOrdPtName like concat('%', #{serviceOrdPtName}, '%')</if>
            <if test="serviceOrdPtAge != null  and serviceOrdPtAge != ''"> and ServiceOrdPtAge = #{serviceOrdPtAge}</if>
            <if test="serviceOrdPtSex != null  and serviceOrdPtSex != ''"> and ServiceOrdPtSex = #{serviceOrdPtSex}</if>
            <if test="serviceOrdPtIDCard != null  and serviceOrdPtIDCard != ''"> and ServiceOrdPtIDCard = #{serviceOrdPtIDCard}</if>
            <if test="serviceOrder.serviceOrdUserID != null "> and ServiceOrdUserID = #{serviceOrder.serviceOrdUserID}</if>
            <if test="serviceOrder.serviceOrdClass != null  and serviceOrder.serviceOrdClass != ''"> and ServiceOrdClass = #{serviceOrder.serviceOrdClass}</if>
            <if test="serviceOrder.serviceOrdType != null "> and ServiceOrdType = #{serviceOrder.serviceOrdType}</if>
            <if test="serviceOrder.serviceOrdState != null "> and ServiceOrdState = #{serviceOrder.serviceOrdState}</if>
            <if test="serviceOrder.serviceOrdStartDate != null "> and ServiceOrdStartDate = #{serviceOrder.serviceOrdStartDate}</if>
            <if test="serviceOrder.serviceOrdApptDate != null "> and ServiceOrdApptDate = #{serviceOrder.serviceOrdApptDate}</if>
            <if test="serviceOrder.serviceOrdCoName != null  and serviceOrder.serviceOrdCoName != ''"> and ServiceOrdCoName like '%' + #{serviceOrder.serviceOrdCoName} + '%'</if>
            <if test="serviceOrder.serviceOrdCoPhone != null  and serviceOrder.serviceOrdCoPhone != ''"> and ServiceOrdCoPhone = #{serviceOrder.serviceOrdCoPhone}</if>
            <if test="serviceOrder.serviceOrdPtName != null  and serviceOrder.serviceOrdPtName != ''"> and ServiceOrdPtName like '%' + #{serviceOrder.serviceOrdPtName} + '%'</if>
            <if test="serviceOrder.serviceOrdPtAge != null  and serviceOrder.serviceOrdPtAge != ''"> and ServiceOrdPtAge = #{serviceOrder.serviceOrdPtAge}</if>
            <if test="serviceOrder.serviceOrdPtSex != null  and serviceOrder.serviceOrdPtSex != ''"> and ServiceOrdPtSex = #{serviceOrder.serviceOrdPtSex}</if>
            <if test="serviceOrder.serviceOrdPtIDCard != null  and serviceOrder.serviceOrdPtIDCard != ''"> and ServiceOrdPtIDCard = #{serviceOrder.serviceOrdPtIDCard}</if>
            <if test="serviceOrder.serviceOrdTraTxnPrice != null  and serviceOrder.serviceOrdTraTxnPrice != ''"> and ServiceOrdTraTxnPrice = #{serviceOrder.serviceOrdTraTxnPrice}</if>
        </where>
    </sql>
    <select id="selectServiceOrderList" resultMap="ServiceOrderResult">
        SELECT *
        FROM (
            SELECT ROW_NUMBER() OVER (ORDER BY ServiceOrdID) AS RowNum, *
            FROM ServiceOrder
            <include refid="selectServiceOrderWhere"/>
        ) AS TempTable
        WHERE RowNum BETWEEN #{offset} + 1 AND #{offset} + #{pageSize}
    </select>
    <select id="selectServiceOrderCount" resultType="Integer">
        SELECT COUNT(1)
        FROM ServiceOrder
        <include refid="selectServiceOrderWhere"/>
    </select>
    
    <select id="selectServiceOrderById" parameterType="Long" resultMap="ServiceOrderResult">
@@ -156,4 +178,25 @@
            #{serviceOrdId}
        </foreach>
    </delete>
    <!-- 更新服务订单取消信息 -->
    <update id="updateServiceOrderCancelInfo">
        update ServiceOrder
        set ServiceOrdState = 4,
            ServiceOrdCancelReason = #{cancelReason},
            ServiceOrdCancelReasonTXT = #{cancelReasonText}
        where ServiceOrdID = #{serviceOrdId}
    </update>
    <!-- 根据服务订单ID查询订单状态 -->
    <select id="selectServiceOrderStateById" parameterType="Long" resultType="Integer">
        select ServiceOrdState
        from ServiceOrder
        where ServiceOrdID = #{serviceOrdId}
    </select>
    <select id="selectServiceCancelInfoById" parameterType="Long" resultMap="ServiceCancelResult">
        select ServiceOrdState, ServiceOrdCancelReason, ServiceOrdCancelReasonTXT
        from ServiceOrder
        where ServiceOrdID = #{serviceOrdId}
    </select>
</mapper>