wanglizhong
2025-05-01 8ad07bd89eea15ea8ff9e0408616db290a96b131
ruoyi-system/src/main/resources/mapper/system/ServiceOrderMapper.xml
@@ -36,22 +36,37 @@
        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
    </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>
        </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">