RepairApplicationFormMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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="com.platform.dao.mapper.repair.RepairApplicationFormMapper">
  4. <sql id="Base_Column_List">
  5. application.*,
  6. user.real_name as userName,
  7. user2.real_name as repairUserName,
  8. user3.real_name as checkUserName,
  9. sb.name as sbName,part.name as partName,
  10. sb.no as sbNo, sb.cph as sbCph, sb.model_id as modelId,
  11. error.name as repairErrorTypeName
  12. </sql>
  13. <select id="selectPageList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  14. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  15. select
  16. <include refid="Base_Column_List"/>
  17. from t_repair_application_form application
  18. left join t_sys_user user on application.user_id = user.user_id
  19. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  20. left join t_sys_user user3 on application.check_user_id = user3.user_id
  21. left join t_sb_info sb on application.sb_id = sb.id
  22. left join t_error_type error on application.repair_error_type_id = error.id
  23. left join t_part_info part on application.part_id = part.id
  24. <where>
  25. <if test="keyword != null and keyword != ''">
  26. and ( sb.name like concat('%',#{keyword},'%') or
  27. sb.no like concat('%',#{keyword},'%') or
  28. application.content like concat('%',#{keyword},'%') )
  29. </if>
  30. <if test="content != null and content != ''">
  31. and application.content like concat('%',#{content},'%')
  32. </if>
  33. <if test="sbId != null and sbId != ''">
  34. and application.sb_id = #{sbId}
  35. </if>
  36. <if test="category != null and category != ''">
  37. and application.category = #{category}
  38. </if>
  39. <if test="categoryList != null and categoryList.size > 0">
  40. AND application.category in
  41. <foreach item="item" index="index" collection="categoryList" open="(" close=")" separator=",">
  42. #{item}
  43. </foreach>
  44. </if>
  45. <if test="zbh != null and zbh != ''">
  46. and sb.zbh = #{zbh}
  47. </if>
  48. <if test="no != null and no != ''">
  49. and application.no = #{no}
  50. </if>
  51. <if test="planFlag != null and planFlag != ''">
  52. and application.plan_flag = #{planFlag}
  53. </if>
  54. <if test="status != null and status != ''">
  55. and application.status = #{status}
  56. </if>
  57. <if test="actualUser != null and actualUser != ''">
  58. and application.actual_user = #{actualUser}
  59. </if>
  60. <if test="mainRepairId != null and mainRepairId != ''">
  61. and application.main_repair_id = #{mainRepairId}
  62. </if>
  63. <if test="outType != null and outType != ''">
  64. and application.out_type = #{outType}
  65. </if>
  66. <if test="type != null and type != ''">
  67. and application.type = #{type}
  68. </if>
  69. <if test="status != null and status != ''">
  70. and application.status = #{status}
  71. </if>
  72. <if test="userId != null and userId != ''">
  73. and application.user_id = #{userId}
  74. </if>
  75. <if test="repairUserId != null and repairUserId != ''">
  76. <if test="repairUserIdOrNoAssignFlag != null and repairUserIdOrNoAssignFlag == true">
  77. and (application.repair_user_id = #{repairUserId} or application.repair_user_id is null)
  78. </if>
  79. <if test="repairUserIdOrNoAssignFlag == null || repairUserIdOrNoAssignFlag == false">
  80. and (application.repair_user_id = #{repairUserId} or sb.repair_user_second = #{repairUserId} )
  81. </if>
  82. </if>
  83. <if test="checkUserId != null and checkUserId != ''">
  84. and application.check_user_id = #{checkUserId}
  85. </if>
  86. <if test="repairUserName != null and repairUserName != ''">
  87. and user2.real_name like concat('%',#{repairUserName},'%')
  88. </if>
  89. <if test="searchStartTime != null">
  90. and application.apply_time <![CDATA[ >= ]]> #{searchStartTime}
  91. </if>
  92. <if test="searchEndTime != null">
  93. and application.apply_time <![CDATA[ <= ]]> #{searchEndTime}
  94. </if>
  95. <!-- 新增查询参数 -->
  96. <if test="queryRepairUserId != null">
  97. and application.repair_user_id = #{queryRepairUserId}
  98. </if>
  99. <if test="statusList != null and statusList.size > 0">
  100. AND application.status in
  101. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  102. #{item}
  103. </foreach>
  104. </if>
  105. <if test="repairStartTimeStart != null">
  106. and application.repair_start_time <![CDATA[ > ]]> #{repairStartTimeStart}
  107. </if>
  108. <if test="repairStartTimeEnd != null">
  109. and application.repair_start_time <![CDATA[ < ]]> #{repairStartTimeEnd}
  110. </if>
  111. </where>
  112. </select>
  113. <select id="selectById" parameterType="java.lang.Object"
  114. resultType="com.platform.dao.entity.repair.RepairApplicationForm">
  115. select
  116. <include refid="Base_Column_List"/>
  117. from t_repair_application_form application
  118. left join t_sys_user user on application.user_id = user.user_id
  119. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  120. left join t_sys_user user3 on application.check_user_id = user3.user_id
  121. left join t_sb_info sb on application.sb_id = sb.id
  122. left join t_part_info part on application.part_id = part.id
  123. left join t_error_type error on application.repair_error_type_id = error.id
  124. where application.id = #{id,jdbcType=VARCHAR}
  125. </select>
  126. <select id="selectNoById" parameterType="java.lang.Object" resultType="java.lang.String">
  127. select no
  128. from t_repair_application_form
  129. where id = #{id,jdbcType=VARCHAR}
  130. </select>
  131. <!-- 维修统计数据 -->
  132. <select id="getWorkplaceRepairData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  133. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  134. select count(1) as tempTotalNum,sum(fee.fee) as tempTotalFee,rf.status from t_repair_application_form rf
  135. join t_repair_fee fee on fee.repair_id = rf.id
  136. <where>
  137. <if test="repairUserId != null">
  138. and rf.repair_user_id = #{repairUserId}
  139. </if>
  140. <if test="searchTime != null">
  141. and rf.repair_start_time like concat('',#{searchTime},'%')
  142. </if>
  143. <if test="type != null">
  144. and rf.type = #{type}
  145. </if>
  146. </where>
  147. group by rf.status
  148. </select>
  149. <!-- 维修统计数据 -->
  150. <select id="getCurrentlyList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  151. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  152. select * from t_repair_application_form
  153. <where>
  154. <if test="searchStartTime != null">
  155. and repair_start_time <![CDATA[>]]> #{searchStartTime}
  156. </if>
  157. <if test="searchEndTime != null">
  158. and repair_start_time <![CDATA[<]]> #{searchEndTime}
  159. </if>
  160. <if test="repairUserId != null">
  161. and repair_user_id = #{repairUserId}
  162. </if>
  163. </where>
  164. </select>
  165. <!-- 近月统计单数和费用 -->
  166. <select id="getWorkplaceRepairSumData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  167. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  168. select count(1) as tempTotalNum,sum(fee.fee) as tempTotalFee from t_repair_application_form rf
  169. join t_repair_fee fee on fee.repair_id = rf.id
  170. <where>
  171. <if test="repairUserId != null">
  172. and rf.repair_user_id = #{repairUserId}
  173. </if>
  174. <if test="searchStartTime != null">
  175. and rf.repair_start_time <![CDATA[>]]> #{searchStartTime}
  176. </if>
  177. <if test="searchEndTime != null">
  178. and rf.repair_start_time <![CDATA[<]]> #{searchEndTime}
  179. </if>
  180. <if test="type != null">
  181. and rf.type = #{type}
  182. </if>
  183. </where>
  184. </select>
  185. </mapper>