WorkOrderMapper.xml 7.41 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="cn.com.glsx.admin.modules.mapper.WorkOrderMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.WorkOrder">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
        <result column="partner_order_no" jdbcType="VARCHAR" property="partnerOrderNo"/>
        <result column="order_source" jdbcType="VARCHAR" property="orderSource"/>
        <result column="ref_order_id" jdbcType="INTEGER" property="refOrderId"/>
        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
        <result column="shop_contactor" jdbcType="VARCHAR" property="shopContactor"/>
        <result column="shop_telephone" jdbcType="VARCHAR" property="shopTelephone"/>
        <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
        <result column="service_type" jdbcType="VARCHAR" property="serviceType"/>
        <result column="service_time" jdbcType="TIMESTAMP" property="serviceTime"/>
        <result column="service_apm" jdbcType="VARCHAR" property="serviceApm"/>
        <result column="service_period" jdbcType="TINYINT" property="servicePeriod"/>
        <result column="service_expire_time" jdbcType="TIMESTAMP" property="serviceExpireTime"/>
        <result column="area" jdbcType="VARCHAR" property="area"/>
        <result column="province" jdbcType="VARCHAR" property="province"/>
        <result column="city" jdbcType="VARCHAR" property="city"/>
        <result column="district" jdbcType="VARCHAR" property="district"/>
        <result column="service_address" jdbcType="VARCHAR" property="serviceAddress"/>
        <result column="service_linker" jdbcType="VARCHAR" property="serviceLinker"/>
        <result column="service_linker_phone" jdbcType="VARCHAR" property="serviceLinkerPhone"/>
        <result column="service_explain" jdbcType="VARCHAR" property="serviceExplain"/>
        <result column="need_install" jdbcType="VARCHAR" property="needInstall"/>
        <result column="need_insure" jdbcType="VARCHAR" property="needInsure"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="service_provider" jdbcType="VARCHAR" property="serviceProvider"/>
        <result column="service_provider_phone" jdbcType="VARCHAR" property="serviceProviderPhone"/>
        <result column="mechanic_name" jdbcType="VARCHAR" property="mechanicName"/>
        <result column="mechanic_phone" jdbcType="VARCHAR" property="mechanicPhone"/>
        <result column="finished_remark" jdbcType="VARCHAR" property="finishedRemark"/>
        <result column="notify_target" jdbcType="VARCHAR" property="notifyTarget"/>
        <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
        <result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
        <result column="created_by" jdbcType="INTEGER" property="createdBy"/>
        <result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate"/>
        <result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, order_no, partner_order_no, order_source, ref_order_id, shop_name, area, province, city, district,
        shop_contactor, shop_telephone, shop_address, service_type, service_time, service_apm, service_period, service_expire_time,
        service_address, service_linker, service_linker_phone, service_explain, need_install, need_insure,
        remark, `status`, service_provider, service_provider_phone, mechanic_name, mechanic_phone,
        finished_remark, notify_target, del_flag, created_date, created_by, updated_date, updated_by
    </sql>

    <select id="selectById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_workorder
        where del_flag = 0
        and id = #{id}
    </select>

    <select id="selectByOrderNo" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_workorder
        where del_flag = 0
        and order_no = #{orderNo}
    </select>

    <select id="selectByPartnerOrderNo" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_workorder
        where del_flag = 0
        and partner_order_no = #{partnerOrderNo}
    </select>

    <select id="search" resultType="cn.com.glsx.admin.modules.model.WorkOrderDTO">
        select tw.id,
               tw.order_no                                                                       orderNo,
               tw.partner_order_no                                                               bizOrderNo,
               tw.service_type                                                                   serviceType,
               concat(DATE_FORMAT(tw.service_time, '%Y-%m-%d'), '/', ifnull(tw.service_apm, '')) serviceTime,
               twv.lessee_name                                                                   ownerName,
               twv.vin,
               twv.device_compose                                                                deviceCompose,
               tt.tenant_name                                                                    tenantName,
               tw.status,
               tw.service_provider                                                               serviceProvider,
               tw.mechanic_name                                                                  mechanicName,
               tu.username                                                                       createdBy,
               tw.created_date                                                                   createdDate
        from t_workorder tw
                 left join t_workorder_vehicle twv on twv.workorder_id = tw.id
                 left join t_user tu on tu.id = tw.created_by
                 left join t_tenant tt on tt.id = tu.tenant_id
        where tw.del_flag = 0
        order by tw.created_date desc
    </select>

    <select id="export" resultType="cn.com.glsx.admin.modules.model.export.WorkOrderExport">
        select tw.id,
               tw.order_no         orderNo,
               tw.partner_order_no bizOrderNo,
               tw.service_type     serviceType,
               tw.service_time     serviceTime,
               tw.service_apm      serviceApm,
               twv.lessee_name     ownerName,
               twv.vin,
               twv.device_compose  deviceCompose,
               tt.tenant_name      tenantName,
               tw.status,
               tw.service_provider serviceProvider,
               tw.mechanic_name    mechanicName,
               tu.username         createdBy,
               tw.created_date     createdDate
        from t_workorder tw
                 left join t_workorder_vehicle twv on twv.workorder_id = tw.id
                 left join t_user tu on tu.id = tw.created_by
                 left join t_tenant tt on tt.id = tu.tenant_id
        where tw.del_flag = 0
        order by tw.created_date desc
    </select>

    <update id="logicDeleteById">
        update t_workorder
        set del_flag = -1
        where id = #{id}
    </update>
</mapper>