CompanyDataReport.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ydtech.modules.admin.dao.CompanyDataReportMapper">
  6. <select id="querOrders" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
  7. SELECT
  8. count( 0 ) AS "orderNumber",
  9. b.licenseno as "licenseno",
  10. b.frameno as "frameno"
  11. FROM
  12. (
  13. SELECT
  14. io.orderstatus AS orderstatus,
  15. io.frameno AS frameno,
  16. ifnull(io.licenseno, '') AS licenseno
  17. FROM
  18. ins_orders io
  19. LEFT JOIN sys_user su on io.userid=su.id
  20. <where>
  21. 1=1
  22. <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
  23. AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
  24. </if>
  25. <if test="vo.licenseno != null and vo.licenseno!='' ">
  26. AND io.licenseno =#{vo.licenseno}
  27. </if>
  28. <if test="vo.userId != null and vo.userId!='' ">
  29. AND io.userid =#{vo.userId}
  30. </if>
  31. <if test="vo.userName != null and vo.userName!='' ">
  32. AND su.name =#{vo.userName}
  33. </if>
  34. <if test="vo.mobile != null and vo.mobile!='' ">
  35. AND su.mobile =#{vo.mobile}
  36. </if>
  37. <if test="vo.frameno != null and vo.frameno!='' ">
  38. AND io.frameno =#{vo.frameno}
  39. </if>
  40. <if test="vo.deptId != null and vo.deptId!='' ">
  41. and io.deptid like concat('%', #{vo.deptId}, '%')
  42. </if>
  43. </where>
  44. ) b
  45. GROUP BY
  46. b.licenseno,
  47. b.frameno
  48. </select>
  49. <select id="querOrdersTotal" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
  50. select
  51. ifnull(sum(a.orderNumber),0) as "orderNumber",
  52. count(a.frameno) as "frameno"
  53. from (
  54. SELECT
  55. count( 0 ) AS "orderNumber",
  56. b.licenseno as "licenseno",
  57. b.frameno as "frameno"
  58. FROM
  59. (
  60. SELECT
  61. io.orderstatus AS orderstatus,
  62. io.frameno AS frameno,
  63. ifnull(io.licenseno, '') AS licenseno
  64. FROM
  65. ins_orders io
  66. LEFT JOIN sys_user su on io.userid=su.id
  67. <where>
  68. 1=1
  69. <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
  70. AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
  71. </if>
  72. <if test="vo.year != null and vo.year!='' ">
  73. AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
  74. </if>
  75. <if test="vo.licenseno != null and vo.licenseno!='' ">
  76. AND io.licenseno =#{vo.licenseno}
  77. </if>
  78. <if test="vo.userId != null and vo.userId!='' ">
  79. AND io.userid =#{vo.userId}
  80. </if>
  81. <if test="vo.userName != null and vo.userName!='' ">
  82. AND su.name =#{vo.userName}
  83. </if>
  84. <if test="vo.mobile != null and vo.mobile!='' ">
  85. AND su.mobile =#{vo.mobile}
  86. </if>
  87. <if test="vo.frameno != null and vo.frameno!='' ">
  88. AND io.frameno =#{vo.frameno}
  89. </if>
  90. <if test="vo.deptId != null and vo.deptId!='' ">
  91. and io.deptid like concat('%', #{vo.deptId}, '%')
  92. </if>
  93. <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
  94. AND io.deptid in
  95. <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
  96. #{item}
  97. </foreach>
  98. </if>
  99. <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
  100. AND io.userid in
  101. <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
  102. #{item}
  103. </foreach>
  104. </if>
  105. </where>
  106. ) b
  107. GROUP BY
  108. b.licenseno,
  109. b.frameno ) a
  110. </select>
  111. <select id="smallQuerOrders" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
  112. select count(0) as "orderNumber"
  113. from ins_area_company iac
  114. left join ins_orders io on io.orderno = iac.orderno
  115. LEFT JOIN sys_user su on io.userid=su.id
  116. <where>
  117. io.orderstatus = '3'
  118. and iac.orderstatus = '3'
  119. and io.licenseno is not null
  120. <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
  121. AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
  122. </if>
  123. <if test="vo.licenseno != null and vo.licenseno!='' ">
  124. AND io.licenseno =#{vo.licenseno}
  125. </if>
  126. <if test="vo.userId != null and vo.userId!='' ">
  127. AND io.userid =#{vo.userId}
  128. </if>
  129. <if test="vo.userName != null and vo.userName!='' ">
  130. AND su.name =#{vo.userName}
  131. </if>
  132. <if test="vo.mobile != null and vo.mobile!='' ">
  133. AND su.mobile =#{vo.mobile}
  134. </if>
  135. <if test="vo.frameno != null and vo.frameno!='' ">
  136. AND io.frameno =#{vo.frameno}
  137. </if>
  138. <if test="vo.deptId != null and vo.deptId!='' ">
  139. and io.deptid like concat('%', #{vo.deptId}, '%')
  140. </if>
  141. <if test="vo.year != null and vo.year!='' ">
  142. AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
  143. </if>
  144. <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
  145. AND io.deptid in
  146. <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
  147. #{item}
  148. </foreach>
  149. </if>
  150. <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
  151. AND io.userid in
  152. <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
  153. #{item}
  154. </foreach>
  155. </if>
  156. </where>
  157. </select>
  158. </mapper>