RepairApplicationFormMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. user4.real_name as repairUser,
  10. sb.name as sbName,part.name as partName,
  11. sb.no as sbNo, sb.cph as sbCph, sb.model_id as modelId,
  12. error.name as repairErrorTypeName
  13. </sql>
  14. <select id="selectPageList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  15. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  16. select
  17. <include refid="Base_Column_List"/>
  18. from t_repair_application_form application
  19. left join t_sys_user user on application.user_id = user.user_id
  20. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  21. left join t_sys_user user3 on application.check_user_id = user3.user_id
  22. left join t_sb_info sb on application.sb_id = sb.id
  23. left join t_sys_user user4 on sb.repair_user = user4.user_id
  24. left join t_error_type error on application.repair_error_type_id = error.id
  25. left join t_part_info part on application.part_id = part.id
  26. <where>
  27. <if test="keyword != null and keyword != ''">
  28. and ( sb.name like concat('%',#{keyword},'%') or
  29. sb.no like concat('%',#{keyword},'%') or
  30. application.content like concat('%',#{keyword},'%') )
  31. </if>
  32. <if test="content != null and content != ''">
  33. and application.content like concat('%',#{content},'%')
  34. </if>
  35. <if test="sbId != null and sbId != ''">
  36. and application.sb_id = #{sbId}
  37. </if>
  38. <if test="category != null and category != ''">
  39. and application.category = #{category}
  40. </if>
  41. <if test="categoryList != null and categoryList.size > 0">
  42. AND application.category in
  43. <foreach item="item" index="index" collection="categoryList" open="(" close=")" separator=",">
  44. #{item}
  45. </foreach>
  46. </if>
  47. <if test="zbh != null and zbh != ''">
  48. and sb.zbh = #{zbh}
  49. </if>
  50. <if test="no != null and no != ''">
  51. and application.no = #{no}
  52. </if>
  53. <if test="planFlag != null and planFlag != ''">
  54. and application.plan_flag = #{planFlag}
  55. </if>
  56. <if test="status != null and status != ''">
  57. and application.status = #{status}
  58. </if>
  59. <if test="actualUser != null and actualUser != ''">
  60. and application.actual_user = #{actualUser}
  61. </if>
  62. <if test="mainRepairId != null and mainRepairId != ''">
  63. and application.main_repair_id = #{mainRepairId}
  64. </if>
  65. <if test="outType != null and outType != ''">
  66. and application.out_type = #{outType}
  67. </if>
  68. <if test="type != null and type != ''">
  69. and application.type = #{type}
  70. </if>
  71. <if test="status != null and status != ''">
  72. and application.status = #{status}
  73. </if>
  74. <if test="userId != null and userId != ''">
  75. and application.user_id = #{userId}
  76. </if>
  77. <if test="repairUserId != null and repairUserId != ''">
  78. <if test="repairUserIdOrNoAssignFlag != null and repairUserIdOrNoAssignFlag == true">
  79. and (application.repair_user_id = #{repairUserId} or application.repair_user_id is null)
  80. </if>
  81. <if test="repairUserIdOrNoAssignFlag == null || repairUserIdOrNoAssignFlag == false">
  82. and (application.repair_user_id = #{repairUserId} or sb.repair_user_second = #{repairUserId} )
  83. </if>
  84. </if>
  85. <if test="checkUserId != null and checkUserId != ''">
  86. and application.check_user_id = #{checkUserId}
  87. </if>
  88. <if test="repairUserName != null and repairUserName != ''">
  89. and user2.real_name like concat('%',#{repairUserName},'%')
  90. </if>
  91. <if test="searchStartTime != null">
  92. and application.apply_time <![CDATA[ >= ]]> #{searchStartTime}
  93. </if>
  94. <if test="searchEndTime != null">
  95. and application.apply_time <![CDATA[ <= ]]> #{searchEndTime}
  96. </if>
  97. </where>
  98. </select>
  99. <select id="selectById" parameterType="java.lang.Object"
  100. resultType="com.platform.dao.entity.repair.RepairApplicationForm">
  101. select
  102. <include refid="Base_Column_List"/>
  103. from t_repair_application_form application
  104. left join t_sys_user user on application.user_id = user.user_id
  105. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  106. left join t_sys_user user3 on application.check_user_id = user3.user_id
  107. left join t_sb_info sb on application.sb_id = sb.id
  108. left join t_part_info part on application.part_id = part.id
  109. left join t_error_type error on application.repair_error_type_id = error.id
  110. where application.id = #{id,jdbcType=VARCHAR}
  111. </select>
  112. <select id="selectNoById" parameterType="java.lang.Object" resultType="java.lang.String">
  113. select no
  114. from t_repair_application_form
  115. where id = #{id,jdbcType=VARCHAR}
  116. </select>
  117. </mapper>