IotProjectTaskMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.iocoder.yudao.module.pms.dal.mysql.iotprojecttask.IotProjectTaskMapper">
  4. <resultMap id="IotProjectTaskResultMap" type="cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO">
  5. <id column="id" property="id" />
  6. <result column="dept_id" property="deptId" />
  7. <result column="project_id" property="projectId" />
  8. <result column="well_name" property="wellName" />
  9. <result column="well_type" property="wellType" />
  10. <result column="location" property="location" />
  11. <result column="technique" property="technique" />
  12. <result column="workload_design" property="workloadDesign" />
  13. <result column="create_time" property="createTime" />
  14. <result column="dept_ids" property="deptIds" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
  15. <!-- 施工状态 -->
  16. <result column="status" property="status" />
  17. <result column="rd_status" property="rdStatus" />
  18. <result column="rig_status" property="rigStatus" />
  19. <result column="repair_status" property="repairStatus" />
  20. <result column="remark" property="remark" />
  21. <result column="manufacture_name" property="manufactureName" />
  22. <result column="contract_name" property="contractName" />
  23. <result column="contract_code" property="contractCode" />
  24. </resultMap>
  25. <select id="taskList" resultMap="IotProjectTaskResultMap">
  26. SELECT
  27. a.id,
  28. a.dept_id,
  29. a.project_id,
  30. a.well_name,
  31. a.well_type,
  32. a.location,
  33. a.technique,
  34. a.workload_design,
  35. a.create_time,
  36. a.dept_ids,
  37. a.status,
  38. a.rd_status,
  39. a.rig_status,
  40. a.repair_status,
  41. a.remark,
  42. b.manufacture_name,
  43. b.contract_name,
  44. b.contract_code
  45. FROM
  46. rq_iot_project_task a,
  47. rq_iot_project_info b
  48. WHERE 1=1
  49. AND a.project_id = b.id
  50. AND a.deleted = 0
  51. AND b.deleted = 0
  52. AND (a.platform_well = 0 or a.platform_well = 1)
  53. <if test="searchDeptIds != null and !searchDeptIds.isEmpty()">
  54. AND (
  55. <foreach collection="searchDeptIds" item="deptId" separator=" OR ">
  56. a.dept_ids LIKE CONCAT('%', #{deptId}, '%')
  57. </foreach>
  58. )
  59. </if>
  60. <if test="companyId != null and companyId != ''">
  61. AND a.dept_id = #{companyId}
  62. </if>
  63. <if test='platformFlag != null and platformFlag == "Y"'>
  64. AND a.platform_well = 1
  65. </if>
  66. <if test='platformFlag != null and platformFlag == "N"'>
  67. AND a.platform_well = 0
  68. </if>
  69. <if test="manufactureName != null and manufactureName != ''">
  70. AND b.manufacture_name LIKE concat('%', #{manufactureName}, '%')
  71. </if>
  72. <if test="contractName != null and contractName != ''">
  73. AND b.contract_name LIKE concat('%', #{contractName}, '%')
  74. </if>
  75. <if test="contractCode != null and contractCode != ''">
  76. AND b.contract_code LIKE concat('%', #{contractCode}, '%')
  77. </if>
  78. <if test="wellName != null and wellName != ''">
  79. AND a.well_name LIKE concat('%', #{wellName}, '%')
  80. </if>
  81. <if test="createTime != null and createTime.length > 0">
  82. <choose>
  83. <when test="createTime.length == 1">
  84. AND a.create_time = #{createTime[0]}
  85. </when>
  86. <otherwise>
  87. AND a.create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
  88. </otherwise>
  89. </choose>
  90. </if>
  91. <if test="deptIds != null and !deptIds.isEmpty()">
  92. AND a.dept_id IN
  93. <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
  94. #{deptId}
  95. </foreach>
  96. </if>
  97. <if test="projectIds != null and !projectIds.isEmpty()">
  98. AND a.project_id IN
  99. <foreach collection="projectIds" item="projectId" open="(" separator="," close=")">
  100. #{projectId}
  101. </foreach>
  102. </if>
  103. <if test="qualifiedTaskIds != null and !qualifiedTaskIds.isEmpty()">
  104. AND a.id IN
  105. <foreach collection="qualifiedTaskIds" item="taskId" open="(" separator="," close=")">
  106. #{taskId}
  107. </foreach>
  108. </if>
  109. <if test="dataPermissionTaskIds != null and !dataPermissionTaskIds.isEmpty()">
  110. AND a.id IN
  111. <foreach collection="dataPermissionTaskIds" item="taskId" open="(" separator="," close=")">
  112. #{taskId}
  113. </foreach>
  114. </if>
  115. ORDER BY a.id DESC
  116. </select>
  117. </mapper>