MaintainancePlanMachineV1ServiceDaoImplMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="maintainancePlanMachineV1ServiceDaoImpl">
  6. <!-- 保存保养设备信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveMaintainancePlanMachineInfo" parameterType="Map">
  8. insert into maintainance_plan_machine(
  9. mpm_id,machine_id,plan_id,community_id,machine_name
  10. ) values (
  11. #{mpmId},#{machineId},#{planId},#{communityId},#{machineName}
  12. )
  13. </insert>
  14. <!-- 查询保养设备信息 add by wuxw 2018-07-03 -->
  15. <select id="getMaintainancePlanMachineInfo" parameterType="Map" resultType="Map">
  16. select t.mpm_id,t.mpm_id mpmId,t.machine_id,t.machine_id machineId,t.create_time,t.create_time
  17. createTime,t.plan_id,t.plan_id planId,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id
  18. communityId,t.machine_name,t.machine_name machineName
  19. from maintainance_plan_machine t
  20. where 1 =1
  21. and t.status_cd = '0'
  22. <if test="mpmId !=null and mpmId != ''">
  23. and t.mpm_id= #{mpmId}
  24. </if>
  25. <if test="machineId !=null and machineId != ''">
  26. and t.machine_id= #{machineId}
  27. </if>
  28. <if test="createTime !=null and createTime != ''">
  29. and t.create_time= #{createTime}
  30. </if>
  31. <if test="planId !=null and planId != ''">
  32. and t.plan_id= #{planId}
  33. </if>
  34. <if test="communityId !=null and communityId != ''">
  35. and t.community_id= #{communityId}
  36. </if>
  37. <if test="machineName !=null and machineName != ''">
  38. and t.machine_name= #{machineName}
  39. </if>
  40. order by t.create_time desc
  41. <if test="page != -1 and page != null ">
  42. limit #{page}, #{row}
  43. </if>
  44. </select>
  45. <!-- 修改保养设备信息 add by wuxw 2018-07-03 -->
  46. <update id="updateMaintainancePlanMachineInfo" parameterType="Map">
  47. update maintainance_plan_machine t set t.status_cd = #{statusCd}
  48. <if test="newBId != null and newBId != ''">
  49. ,t.b_id = #{newBId}
  50. </if>
  51. <if test="machineId !=null and machineId != ''">
  52. , t.machine_id= #{machineId}
  53. </if>
  54. <if test="createTime !=null and createTime != ''">
  55. , t.create_time= #{createTime}
  56. </if>
  57. <if test="planId !=null and planId != ''">
  58. , t.plan_id= #{planId}
  59. </if>
  60. <if test="communityId !=null and communityId != ''">
  61. , t.community_id= #{communityId}
  62. </if>
  63. <if test="machineName !=null and machineName != ''">
  64. , t.machine_name= #{machineName}
  65. </if>
  66. where 1=1
  67. <if test="mpmId !=null and mpmId != ''">
  68. and t.mpm_id= #{mpmId}
  69. </if>
  70. </update>
  71. <!-- 查询保养设备数量 add by wuxw 2018-07-03 -->
  72. <select id="queryMaintainancePlanMachinesCount" parameterType="Map" resultType="Map">
  73. select count(1) count
  74. from maintainance_plan_machine t
  75. where 1 =1
  76. and t.status_cd = '0'
  77. <if test="mpmId !=null and mpmId != ''">
  78. and t.mpm_id= #{mpmId}
  79. </if>
  80. <if test="machineId !=null and machineId != ''">
  81. and t.machine_id= #{machineId}
  82. </if>
  83. <if test="createTime !=null and createTime != ''">
  84. and t.create_time= #{createTime}
  85. </if>
  86. <if test="planId !=null and planId != ''">
  87. and t.plan_id= #{planId}
  88. </if>
  89. <if test="communityId !=null and communityId != ''">
  90. and t.community_id= #{communityId}
  91. </if>
  92. <if test="machineName !=null and machineName != ''">
  93. and t.machine_name= #{machineName}
  94. </if>
  95. </select>
  96. <!-- 查询保养设备信息 add by wuxw 2018-07-03 -->
  97. <select id="queryMaintainancePlanMachinesGroupCount" parameterType="Map" resultType="Map">
  98. select t.plan_id planId,count(1) machineCount
  99. from maintainance_plan_machine t
  100. where 1 =1
  101. and t.status_cd = 0
  102. <if test="planIds !=null ">
  103. and t.plan_id in
  104. <foreach collection="planIds" item="item" open="(" close=")" separator=",">
  105. #{item}
  106. </foreach>
  107. </if>
  108. <if test="communityId !=null and communityId != ''">
  109. and t.community_id= #{communityId}
  110. </if>
  111. group by t.plan_id
  112. </select>
  113. </mapper>