123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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.ty.lift.business.emergency.mapper.EmergencyRepairMapper" >
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.emergency.dto.RepairResponse" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
- <result column="lift_id" property="liftId" jdbcType="BIGINT" />
- <result column="is_trapped" property="isTrapped" jdbcType="TINYINT" />
- <result column="is_critical" property="isCritical" jdbcType="TINYINT" />
- <result column="source" property="source" jdbcType="TINYINT" />
- <result column="caller_id" property="callerId" jdbcType="BIGINT" />
- <result column="caller_tel" property="callerTel" jdbcType="CHAR" />
- <result column="caller_date" property="callerDate" jdbcType="TIMESTAMP" />
- <result column="stop_date" property="stopDate" jdbcType="TIMESTAMP" />
- <result column="recovery_date" property="recoveryDate" jdbcType="TIMESTAMP" />
- <result column="charge" property="charge" jdbcType="VARCHAR" />
- <result column="worker_id" property="workerId" jdbcType="BIGINT" />
- <result column="worker_tel" property="workerTel" jdbcType="CHAR" />
- <result column="position" property="position" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="TINYINT" />
- <result column="creator_id" property="creatorId" jdbcType="BIGINT" />
- <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
- <result column="repair_reason" property="repairReason" jdbcType="TINYINT" />
- <result column="parts_cost" property="partsCost" jdbcType="DECIMAL" />
- <result column="safety_confirm" property="safetyConfirm" jdbcType="VARCHAR" />
- <result column="read_time" property="readTime" jdbcType="TIMESTAMP" />
- <result column="worker_id1" property="workerId1" jdbcType="BIGINT" />
- <result column="wl_floor" property="wlFloor" jdbcType="INTEGER" />
- <result column="wl_liftdoor" property="wlLiftdoor" jdbcType="TINYINT" />
- <result column="wl_fault" property="wlFault" jdbcType="VARCHAR" />
- <result column="wl_fault_reason" property="wlFaultReason" jdbcType="VARCHAR" />
- <result column="wl_fault_handle" property="wlFaultHandle" jdbcType="VARCHAR" />
- <result column="wl_run_direction" property="wlRunDirection" jdbcType="TINYINT" />
- <result column="cost_total" property="costTotal" jdbcType="DECIMAL" />
- <result column="project_id" property="projectId" jdbcType="INTEGER" />
- <result column="caller_fault_description" property="callerFaultDescription" jdbcType="LONGVARCHAR" />
- <result column="sparepart" property="sparepart" jdbcType="LONGVARCHAR" />
- <result column="worker_fault_description" property="workerFaultDescription" jdbcType="LONGVARCHAR" />
- <result column="field_description" property="fieldDescription" jdbcType="LONGVARCHAR" />
- <result column="repair_procedure" property="repairProcedure" jdbcType="LONGVARCHAR" />
- <result column="project_name" property="projectName" jdbcType="VARCHAR" />
- <result column="area_name" property="areaName" jdbcType="VARCHAR" />
- <result column="registration_code" property="registrationCode" jdbcType="VARCHAR" />
- <result column="device_position" property="devicePosition" jdbcType="VARCHAR" />
- <result column="call_name" property="callName" jdbcType="VARCHAR" />
- <result column="create_name" property="createName" jdbcType="VARCHAR" />
- <result column="worker_name" property="workerName" jdbcType="VARCHAR" />
- <result column="lift_company_status" property="liftCompanyStatus" jdbcType="VARCHAR" />
- <result column="repair_diff" property="repairDiff" jdbcType="BIGINT" />
- </resultMap>
- <!--查询急修中-->
- <select id="listByRepairing" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest">
- SELECT
- t.*,
- ui.name AS worker_name
- FROM
- (SELECT
- er.*,
- ui.`name` AS create_name,
- li.registration_code,
- li.device_position,
- pr.project_name,
- pclr.lift_company_status
- FROM
- emergency_repair er
- LEFT JOIN user_info ui ON ui.user_id = er.caller_id
- LEFT JOIN lift li ON li.id = er.lift_id
- LEFT JOIN project pr ON pr.id = er.project_id
- LEFT JOIN platform_company_lift_relevance pclr ON pclr.lift_id = li.id
- WHERE
- er.`status` <![CDATA[ <> ]]> 4 ) t
- LEFT JOIN user_info ui ON ui.user_id = t.worker_id1
- </select>
- <!--根据条件查询急修记录总条数-->
- <select id="countByCondition" resultType="java.lang.Long" parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest" >
- SELECT
- count(*)
- FROM
- emergency_repair er
- LEFT JOIN project pr ON er.project_id = pr.id
- LEFT JOIN region re ON pr.region_id = re.id
- LEFT JOIN lift li ON er.lift_id = li.id
- WHERE 1 = 1
- <if test="cond.status != null">
- AND er.status = #{cond.status}
- </if>
- </select>
- <!--根据条件查询急修记录-->
- <select id="listByCondition" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest" >
- SELECT
- er.*,
- li.registration_code AS registration_code,
- li.device_position AS device_position,
- pr.project_name,
- re.area_name,
- ui.name AS worker_name,
- TimeStampDiff(SECOND ,er.stop_date,er.recovery_date) AS repair_diff
- FROM
- emergency_repair er
- LEFT JOIN project pr ON er.project_id = pr.id
- LEFT JOIN region re ON pr.region_id = re.id
- LEFT JOIN lift li ON er.lift_id = li.id
- LEFT JOIN user_info ui ON ui.user_id = er.worker_id1
- WHERE 1 = 1
- <if test="cond.projectId != null and cond.projectId > 0">
- AND pr.id = #{cond.projectId}
- </if>
- <if test="cond.regionId != null and cond.regionId > 0">
- AND pr.region_id = #{cond.regionId}
- </if>
- <if test="cond.workerId != null and cond.workerId > 0">
- AND er.worker_id1 = #{cond.workerId}
- </if>
- <if test="cond.repairBegin != null">
- AND er.caller_date > #{cond.repairBegin}
- </if>
- <if test="cond.repairEnd != null">
- AND er.caller_date < #{cond.repairEnd}
- </if>
- <if test="cond.status != null">
- AND er.status = #{cond.status}
- </if>
- <if test="cond.source != null">
- AND er.source = #{cond.source}
- </if>
- <if test="cond.info != null and cond.info != ''">
- AND li.registration_code LIKE #{cond.info}
- </if>
- </select>
- <!--根据id查找带扩展信息-->
- <select id="selectByIdWithInfo" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest" >
- SELECT
- er.*,
- li.registration_code AS registration_code,
- pr.project_name,
- re.area_name
- FROM
- emergency_repair er
- LEFT JOIN project pr ON er.project_id = pr.id
- LEFT JOIN region re ON pr.region_id = re.id
- LEFT JOIN lift li ON er.lift_id = li.id
- WHERE er.id = #{cond.id}
- </select>
- </mapper>
|