IotProjectTaskMapper.xml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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="project_id" property="projectId" />
  7. <result column="well_name" property="wellName" />
  8. <result column="well_type" property="wellType" />
  9. <result column="location" property="location" />
  10. <result column="technique" property="technique" />
  11. <result column="workload_design" property="workloadDesign" />
  12. <result column="create_time" property="createTime" />
  13. <result column="dept_ids" property="deptIds" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
  14. <result column="remark" property="remark" />
  15. <result column="manufacture_name" property="manufactureName" />
  16. <result column="contract_name" property="contractName" />
  17. <result column="contract_code" property="contractCode" />
  18. </resultMap>
  19. <select id="taskList" resultMap="IotProjectTaskResultMap">
  20. SELECT
  21. a.id,
  22. a.project_id,
  23. a.well_name,
  24. a.well_type,
  25. a.location,
  26. a.technique,
  27. a.workload_design,
  28. a.create_time,
  29. a.dept_ids,
  30. a.remark,
  31. b.manufacture_name,
  32. b.contract_name,
  33. b.contract_code
  34. FROM
  35. rq_iot_project_task a,
  36. rq_iot_project_info b
  37. WHERE 1=1
  38. AND a.project_id = b.id
  39. AND a.deleted = 0
  40. AND b.deleted = 0
  41. AND (a.platform_well = 0 or a.platform_well = 1)
  42. <if test="searchDeptIds != null and !searchDeptIds.isEmpty()">
  43. AND (
  44. <foreach collection="searchDeptIds" item="deptId" separator=" OR ">
  45. a.dept_ids LIKE CONCAT('%', #{deptId}, '%')
  46. </foreach>
  47. )
  48. </if>
  49. <if test="companyId != null and companyId != ''">
  50. AND a.dept_id = #{companyId}
  51. </if>
  52. <if test='platformFlag != null and platformFlag == "Y"'>
  53. AND a.platform_well = 1
  54. </if>
  55. <if test='platformFlag != null and platformFlag == "N"'>
  56. AND a.platform_well = 0
  57. </if>
  58. <if test="manufactureName != null and manufactureName != ''">
  59. AND b.manufacture_name LIKE concat('%', #{manufactureName}, '%')
  60. </if>
  61. <if test="contractName != null and contractName != ''">
  62. AND b.contract_name LIKE concat('%', #{contractName}, '%')
  63. </if>
  64. <if test="contractCode != null and contractCode != ''">
  65. AND b.contract_code LIKE concat('%', #{contractCode}, '%')
  66. </if>
  67. <if test="wellName != null and wellName != ''">
  68. AND a.well_name LIKE concat('%', #{wellName}, '%')
  69. </if>
  70. <if test="createTime != null and createTime.length > 0">
  71. <choose>
  72. <when test="createTime.length == 1">
  73. AND a.create_time = #{createTime[0]}
  74. </when>
  75. <otherwise>
  76. AND a.create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
  77. </otherwise>
  78. </choose>
  79. </if>
  80. <if test="deptIds != null and !deptIds.isEmpty()">
  81. AND a.dept_id IN
  82. <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
  83. #{deptId}
  84. </foreach>
  85. </if>
  86. <if test="projectIds != null and !projectIds.isEmpty()">
  87. AND a.project_id IN
  88. <foreach collection="projectIds" item="projectId" open="(" separator="," close=")">
  89. #{projectId}
  90. </foreach>
  91. </if>
  92. ORDER BY a.id DESC
  93. </select>
  94. </mapper>