ProjectApplicationDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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="platform.modules.company.dao.ProjectApplicationDao">
  4. <!-- 街道审批列表 -->
  5. <select id="findApproveList" resultType="platform.modules.company.entity.ProjectApplication">
  6. SELECT DISTINCT
  7. a.id,
  8. a.company_id,
  9. a.apply_no,
  10. a.apply_date,
  11. a.project_type,
  12. a.project_id,
  13. a.project_name,
  14. a.apply_status,
  15. a.approve_status,
  16. a.create_time,
  17. a.create_by,
  18. c.company_name as company_name
  19. FROM
  20. project_application a
  21. LEFT JOIN y_company c on c.id = a.company_id
  22. LEFT JOIN z_approval approval on approval.apply_id = a.id
  23. WHERE
  24. a.del_flag = '0' and a.approve_status is not null
  25. <if test="searchCondition.street_id!=null and searchCondition.street_id!=''">
  26. and a.street_id = #{searchCondition.street_id}
  27. </if>
  28. <if test="searchCondition.project_type!=null and searchCondition.project_type!=''">
  29. and a.project_type = #{searchCondition.project_type}
  30. </if>
  31. <if test="searchCondition.project_name!=null and searchCondition.project_name!=''">
  32. and a.project_name like CONCAT ('%',#{searchCondition.project_name},'%')
  33. </if>
  34. <if test="searchCondition.company_name!=null and searchCondition.company_name!=''">
  35. and c.company_name like CONCAT ('%',#{searchCondition.company_name},'%')
  36. </if>
  37. <if test="searchCondition.apply_status!=null and searchCondition.apply_status!=''">
  38. and a.apply_status = #{searchCondition.apply_status}
  39. </if>
  40. <if test="searchCondition.approve_status!=null and searchCondition.approve_status!=''">
  41. and a.approve_status=#{searchCondition.approve_status}
  42. </if>
  43. <if test="searchCondition.startTime!=null and searchCondition.startTime!=''">
  44. and a.apply_date &gt;= #{searchCondition.startTime}
  45. </if>
  46. <if test="searchCondition.endTime!=null and searchCondition.endTime!=''">
  47. and a.apply_date &lt;= #{searchCondition.endTime}
  48. </if>
  49. <if test="searchCondition.isPendingAudit == 1"><!-- 为1 ,取待审核数据-->
  50. <if test="searchCondition.pendingAuditStatus != null and searchCondition.pendingAuditStatus != '' ">
  51. <!-- 待审批状态的数据 -->
  52. and a.approve_status = #{searchCondition.pendingAuditStatus}
  53. </if>
  54. </if>
  55. <if test="searchCondition.isPendingAudit == 0"><!-- 为0 ,取已审核数据 ,街道审核过的数据-->
  56. and a.id in (
  57. SELECT DISTINCT APPLY_ID FROM z_approval
  58. WHERE checker = #{searchCondition.checker_id}
  59. and type = #{searchCondition.approveType}
  60. )
  61. <if test="searchCondition.pendingAuditStatus != null and searchCondition.pendingAuditStatus != '' ">
  62. <!-- 已审批列表去除待审批状态的数据 -->
  63. and a.approve_status != #{searchCondition.pendingAuditStatus}
  64. </if>
  65. </if>
  66. order by create_time desc
  67. </select>
  68. <select id="selectMutexApplications" resultType="platform.modules.company.entity.ProjectApplication">
  69. SELECT DISTINCT
  70. a.id,
  71. a.company_id,
  72. a.apply_no,
  73. a.apply_date,
  74. a.project_type,
  75. a.project_id,
  76. a.project_name,
  77. a.apply_status,
  78. a.approve_status,
  79. a.create_time,
  80. a.create_by
  81. FROM
  82. project_application a
  83. left join project p on a.project_id = p.id
  84. where
  85. a.del_flag = '0'
  86. and a.company_id = #{company_id}
  87. and left(a.apply_date,4) = DATE_FORMAT(NOW(), '%Y')
  88. and p.mutex = #{project.mutex}
  89. and p.id != #{project.id}
  90. </select>
  91. <select id="selectApplicationsByCidAndPid" resultType="platform.modules.company.entity.ProjectApplication">
  92. SELECT
  93. a.id,
  94. a.company_id,
  95. a.apply_no,
  96. a.apply_date,
  97. a.project_type,
  98. a.project_id,
  99. a.project_name,
  100. a.apply_status,
  101. a.approve_status,
  102. a.create_time,
  103. a.create_by
  104. FROM
  105. project_application a
  106. where
  107. a.del_flag = '0'
  108. and a.company_id = #{company_id}
  109. and a.project_id = #{project_id}
  110. and left(a.apply_date,4) = DATE_FORMAT(NOW(), '%Y')
  111. </select>
  112. <select id="canApplyProjectIntelligent" resultType="platform.modules.company.entity.ProjectApplication">
  113. SELECT
  114. pa.*
  115. FROM
  116. project_application pa
  117. LEFT JOIN project p ON p.id = pa.project_id
  118. WHERE
  119. pa.company_id = #{company}
  120. AND p.is_technical = 1
  121. AND pa.del_flag = 0
  122. </select>
  123. </mapper>