LiftMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.library.dao.mapper.LiftMapper" >
  4. <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.library.dao.entity.Lift" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="registration_code" property="registrationCode" jdbcType="VARCHAR" />
  7. <result column="category" property="category" jdbcType="TINYINT" />
  8. <result column="lift_type" property="liftType" jdbcType="INTEGER" />
  9. <result column="lift_code" property="liftCode" jdbcType="CHAR" />
  10. <result column="manufacture_date" property="manufactureDate" jdbcType="DATE" />
  11. <result column="factory_code" property="factoryCode" jdbcType="VARCHAR" />
  12. <result column="device_usage" property="deviceUsage" jdbcType="TINYINT" />
  13. <result column="lift_brand" property="liftBrand" jdbcType="VARCHAR" />
  14. <result column="install_company" property="installCompany" jdbcType="VARCHAR" />
  15. <result column="lift_model" property="liftModel" jdbcType="VARCHAR" />
  16. <result column="pulley_diameter" property="pulleyDiameter" jdbcType="DECIMAL" />
  17. <result column="rope_num" property="ropeNum" jdbcType="INTEGER" />
  18. <result column="lock_model" property="lockModel" jdbcType="VARCHAR" />
  19. <result column="rated_load" property="ratedLoad" jdbcType="INTEGER" />
  20. <result column="promote_height" property="promoteHeight" jdbcType="DECIMAL" />
  21. <result column="step_width" property="stepWidth" jdbcType="DECIMAL" />
  22. <result column="sidewalk_length" property="sidewalkLength" jdbcType="DECIMAL" />
  23. <result column="tilt_angle" property="tiltAngle" jdbcType="DECIMAL" />
  24. <result column="motor_power" property="motorPower" jdbcType="DECIMAL" />
  25. <result column="rated_speed" property="ratedSpeed" jdbcType="DECIMAL" />
  26. <result column="layer_station_door" property="layerStationDoor" jdbcType="VARCHAR" />
  27. <result column="clamp_type" property="clampType" jdbcType="TINYINT" />
  28. <result column="reform_company" property="reformCompany" jdbcType="VARCHAR" />
  29. <result column="device_position" property="devicePosition" jdbcType="VARCHAR" />
  30. <result column="coordinate" property="coordinate" jdbcType="VARCHAR" />
  31. <result column="remarks" property="remarks" jdbcType="VARCHAR" />
  32. <result column="creator_id" property="creatorId" jdbcType="BIGINT" />
  33. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  34. <result column="steel_belt" property="steelBelt" jdbcType="INTEGER" />
  35. <result column="cylinder_type" property="cylinderType" jdbcType="VARCHAR" />
  36. <result column="cylinder_num" property="cylinderNum" jdbcType="INTEGER" />
  37. <result column="top_type" property="topType" jdbcType="TINYINT" />
  38. <result column="control_type" property="controlType" jdbcType="VARCHAR" />
  39. <result column="mpa" property="mpa" jdbcType="INTEGER" />
  40. <result column="factory" property="factory" jdbcType="VARCHAR" />
  41. <result column="custom_number" property="customNumber" jdbcType="VARCHAR" />
  42. <result column="use_company_code" property="useCompanyCode" jdbcType="VARCHAR" />
  43. <result column="device_position_code" property="devicePositionCode" jdbcType="CHAR" />
  44. <result column="agency" property="agency" jdbcType="VARCHAR" />
  45. <result column="reform_date" property="reformDate" jdbcType="TIMESTAMP" />
  46. <result column="install_date" property="installDate" jdbcType="TIMESTAMP" />
  47. <result column="inner_floor" property="innerFloor" jdbcType="TINYINT" />
  48. <result column="annual_inspection_date" property="annualInspectionDate" jdbcType="DATE" />
  49. <result column="area_code" property="areaCode" jdbcType="CHAR" />
  50. <result column="device_id" property="deviceId" jdbcType="VARCHAR" />
  51. <result column="device_type" property="deviceType" jdbcType="TINYINT" />
  52. </resultMap>
  53. <sql id="Base_Column_List" >
  54. id, registration_code, category, lift_type, lift_code, manufacture_date, factory_code,
  55. device_usage, lift_brand, install_company, lift_model, pulley_diameter, rope_num,
  56. lock_model, rated_load, promote_height, step_width, sidewalk_length, tilt_angle,
  57. motor_power, rated_speed, layer_station_door, clamp_type, reform_company, device_position,
  58. coordinate, remarks, creator_id, create_date, steel_belt, cylinder_type, cylinder_num,
  59. top_type, control_type, mpa, factory, custom_number, use_company_code, device_position_code,
  60. agency, reform_date, install_date, inner_floor, annual_inspection_date, area_code, device_id, device_type
  61. </sql>
  62. <!-- 根据区域,项目,电梯号,电梯品牌,电梯类型,维保工查询电梯列表信息-->
  63. <select id="findByCondition" resultType="cn.com.ty.lift.business.library.dao.entity.model.LiftResponse" parameterType="cn.com.ty.lift.business.library.dao.entity.model.LiftRequest" >
  64. SELECT
  65. l.id AS id,
  66. l.lift_code AS liftCode,
  67. l.registration_code AS registrationCode,
  68. l.lift_type AS liftType,
  69. l.device_position AS devicePosition,
  70. lb.name AS liftBrand,
  71. pclr.lift_company_status AS liftStatus,
  72. plr.first_time AS firstMaintenanceTime,
  73. p.project_name AS projectName
  74. FROM platform_company_lift_relevance pclr
  75. LEFT JOIN lift l ON pclr.lift_id = l.id
  76. LEFT JOIN project_lift_relevance plr ON pclr.company_id = plr.company_id and pclr.lift_id = plr.lift_id
  77. LEFT JOIN project p ON pclr.company_id = p.mt_company_id and plr.project_id = p.id
  78. LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
  79. WHERE 1=1
  80. <if test="request.companyId!=null and request.companyId!=''">
  81. AND pclr.company_id = #{request.companyId,jdbcType=BIGINT}
  82. </if>
  83. <if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 1">
  84. AND pclr.lift_company_status != 1
  85. </if>
  86. <if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 0">
  87. AND pclr.lift_company_status = 1
  88. </if>
  89. <if test="request.liftType!=null and request.liftType!=''">
  90. AND l.lift_type = #{request.liftType,jdbcType=VARCHAR}
  91. </if>
  92. <if test="request.liftBrand!=null and request.liftBrand!=''">
  93. AND lb.code = #{request.liftBrand,jdbcType=VARCHAR}
  94. </if>
  95. <if test="request.registrationCode!=null and request.registrationCode!=''">
  96. AND l.registration_code LIKE #{request.registrationCode,jdbcType=VARCHAR}
  97. </if>
  98. </select>
  99. <!-- 查询项目下电梯列表 -->
  100. <select id="findLiftListByProjectId" resultType="cn.com.ty.lift.business.library.dao.entity.model.LiftResponse" parameterType="cn.com.ty.lift.business.library.dao.entity.model.LiftRequest">
  101. SELECT
  102. l.id AS id,
  103. l.lift_code AS liftCode,
  104. l.registration_code AS registrationCode,
  105. l.lift_type AS liftType,
  106. l.device_position AS devicePosition,
  107. lb.name AS liftBrand,
  108. l.annual_inspection_date AS annualInspectionDate,
  109. pclr.lift_company_status AS liftStatus,
  110. ui.name AS workerName
  111. FROM project_lift_relevance plr
  112. LEFT JOIN lift l ON l.id = plr.lift_id
  113. LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
  114. LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
  115. LEFT JOIN platform_company_lift_relevance pclr ON plr.lift_id = pclr.lift_id AND pclr.id = plr.relevance_id
  116. WHERE 1=1
  117. <if test="request.projectId!=null and request.projectId!=''">
  118. AND plr.project_id = #{request.projectId,jdbcType=BIGINT}
  119. </if>
  120. </select>
  121. <!--根据注册代码查询电梯是否存在,返回电梯id -->
  122. <select id="findLiftExist" parameterType="java.lang.String" resultType="java.lang.Long">
  123. SELECT id FROM lift
  124. WHERE registration_code = #{registrationCode,jdbcType=VARCHAR}
  125. </select>
  126. </mapper>