MaintenancePlanMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper" >
  4. <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="lift_id" property="liftId" jdbcType="BIGINT" />
  7. <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
  8. <result column="project_id" property="projectId" jdbcType="BIGINT" />
  9. <result column="worker_id" property="workerId" jdbcType="BIGINT" />
  10. <result column="plan_date" property="planDate" jdbcType="TIMESTAMP" />
  11. <result column="work_date" property="workDate" jdbcType="TIMESTAMP" />
  12. <result column="count" property="count" jdbcType="INTEGER" />
  13. <result column="type" property="type" jdbcType="TINYINT" />
  14. <result column="status" property="status" jdbcType="TINYINT" />
  15. </resultMap>
  16. <sql id="Base_Column_List" >
  17. id, lift_id, mt_company_id, project_id, worker_id, plan_date, work_date, count, type,
  18. status
  19. </sql>
  20. <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">
  21. SELECT
  22. mp.id AS id,
  23. mp.plan_date AS planDate,
  24. l.id AS liftId,
  25. l.registration_code AS registrationCode,
  26. l.device_position AS devicePosition,
  27. p.project_name AS projectName,
  28. p.project_code AS projectCode,
  29. pclr.lift_company_status AS liftStatus,
  30. r.area_name AS regionName,
  31. ui.name AS workerName
  32. FROM platform_company_lift_relevance pclr
  33. LEFT JOIN maintenance_plan mp ON pclr.lift_id = mp.lift_id AND pclr.company_id = mp.mt_company_id
  34. LEFT JOIN lift l ON l.id = pclr.lift_id AND l.id = mp.lift_id
  35. LEFT JOIN lift_extension le ON l.id = le.id AND pclr.company_id = le.mt_company_id
  36. LEFT JOIN project p ON pclr.company_id = p.mt_company_id AND mp.project_id = p.id
  37. LEFT JOIN user_info ui ON le.worker_id = ui.user_id
  38. LEFT JOIN region r ON p.region_id = r.id
  39. WHERE 1=1
  40. <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
  41. AND mp.mt_company_id = #{request.mtCompanyId,jdbcType=VARCHAR}
  42. </if>
  43. <if test="request.projectId!=null and request.projectId!=''">
  44. AND p.id = #{request.projectId,jdbcType=BIGINT}
  45. </if>
  46. <if test="request.workerId!=null and request.workerId!=''">
  47. AND mp.worker_id = #{request.workerId,jdbcType=BIGINT}
  48. </if>
  49. <if test="request.regionId!=null and request.regionId!=''">
  50. AND p.region_id = #{request.regionId,jdbcType=BIGINT}
  51. </if>
  52. <if test="request.beginTime!=null and request.beginTime!=''">
  53. AND mp.plan_date > #{request.beginTime,jdbcType=VARCHAR}
  54. </if>
  55. <if test="request.endTime!=null and request.endTime!=''">
  56. AND <![CDATA[mp.plan_date < #{request.endTime,jdbcType=VARCHAR}]]>
  57. </if>
  58. <if test="request.registrationCode!=null and request.registrationCode!=''">
  59. AND l.registration_code like #{request.registrationCode,jdbcType=VARCHAR}
  60. </if>
  61. </select>
  62. <select id="findIdList" resultMap="BaseResultMap" parameterType="java.util.Date">
  63. SELECT
  64. id,
  65. plan_date as planDate
  66. FROM maintenance_plan
  67. WHERE plan_date > #{currentTime,jdbcType=TIMESTAMP}
  68. </select>
  69. </mapper>