12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?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.maintenance.dao.mapper.MaintenancePlanMapper" >
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="lift_id" property="liftId" jdbcType="BIGINT" />
- <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
- <result column="project_id" property="projectId" jdbcType="BIGINT" />
- <result column="worker_id" property="workerId" jdbcType="BIGINT" />
- <result column="plan_date" property="planDate" jdbcType="TIMESTAMP" />
- <result column="work_date" property="workDate" jdbcType="TIMESTAMP" />
- <result column="count" property="count" jdbcType="INTEGER" />
- <result column="type" property="type" jdbcType="TINYINT" />
- <result column="status" property="status" jdbcType="TINYINT" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, lift_id, mt_company_id, project_id, worker_id, plan_date, work_date, count, type,
- status
- </sql>
- <select id="findByCondition" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenancePlanResponse" parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenancePlanRequest">
- SELECT
- mp.id AS id,
- mp.plan_date AS planDate,
- l.id AS liftId,
- l.registration_code AS registrationCode,
- l.device_position AS devicePosition,
- p.project_name AS projectName,
- p.project_code AS projectCode,
- pclr.lift_company_status AS liftStatus,
- r.area_name AS regionName,
- ui.name AS workerName
- FROM platform_company_lift_relevance pclr
- LEFT JOIN maintenance_plan mp ON pclr.lift_id = mp.lift_id AND pclr.company_id = mp.mt_company_id
- LEFT JOIN lift l ON l.id = pclr.lift_id AND l.id = mp.lift_id
- LEFT JOIN lift_extension le ON l.id = le.id AND pclr.company_id = le.mt_company_id
- LEFT JOIN project p ON pclr.company_id = p.mt_company_id AND mp.project_id = p.id
- LEFT JOIN user_info ui ON le.worker_id = ui.user_id
- LEFT JOIN region r ON p.region_id = r.id
- WHERE 1=1
- <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
- AND mp.mt_company_id = #{request.mtCompanyId,jdbcType=VARCHAR}
- </if>
- <if test="request.projectId!=null and request.projectId!=''">
- AND p.id = #{request.projectId,jdbcType=BIGINT}
- </if>
- <if test="request.workerId!=null and request.workerId!=''">
- AND mp.worker_id = #{request.workerId,jdbcType=BIGINT}
- </if>
- <if test="request.regionId!=null and request.regionId!=''">
- AND p.region_id = #{request.regionId,jdbcType=BIGINT}
- </if>
- <if test="request.beginTime!=null and request.beginTime!=''">
- AND mp.plan_date > #{request.beginTime,jdbcType=VARCHAR}
- </if>
- <if test="request.endTime!=null and request.endTime!=''">
- AND <![CDATA[mp.plan_date < #{request.endTime,jdbcType=VARCHAR}]]>
- </if>
- <if test="request.registrationCode!=null and request.registrationCode!=''">
- AND l.registration_code like #{request.registrationCode,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="findIdList" resultMap="BaseResultMap" parameterType="java.util.Date">
- SELECT
- id,
- plan_date as planDate
- FROM maintenance_plan
- WHERE plan_date > #{currentTime,jdbcType=TIMESTAMP}
- </select>
- </mapper>
|