IotProjectTaskMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="taskList" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO"
  11. resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO">
  12. select
  13. a.id,
  14. a.project_id,
  15. a.well_name,
  16. a.well_type,
  17. a.location,
  18. a.technique,
  19. a.workload_design,
  20. a.create_time,
  21. a.dept_ids,
  22. a.remark,
  23. b.manufacture_name,
  24. b.contract_name,
  25. b.contract_code
  26. from
  27. rqiot.rq_iot_project_task a,
  28. rqiot.rq_iot_project_info b
  29. where 1=1
  30. and a.project_id = b.id
  31. and a.deleted = 0
  32. and b.deleted = 0
  33. <if test="manufactureName != null and manufactureName != ''">
  34. and b.manufacture_name like concat('%', #{manufactureName}, '%')
  35. </if>
  36. <if test="contractName != null and contractName != ''">
  37. and b.contract_name like concat('%', #{contractName}, '%')
  38. </if>
  39. <if test="contractCode != null and contractCode != ''">
  40. and b.contract_code like concat('%', #{contractCode}, '%')
  41. </if>
  42. <if test="wellName != null and wellName != ''">
  43. and a.wellName like concat('%', #{wellName}, '%')
  44. </if>
  45. <if test="createTime != null and createTime.length > 0">
  46. <choose>
  47. <when test="createTime.length == 1">
  48. AND a.create_time = #{createTime[0]}
  49. </when>
  50. <otherwise>
  51. AND a.create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
  52. </otherwise>
  53. </choose>
  54. </if>
  55. <if test="deptIds != null and !deptIds.isEmpty()">
  56. AND a.dept_id IN
  57. <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
  58. #{deptId}
  59. </foreach>
  60. </if>
  61. ORDER BY a.id DESC
  62. </select>
  63. </mapper>