OrderBaseCMapper.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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="com.gree.mall.miniapp.commonmapper.workorder.OrderBaseCMapper">
  4. <select id="countOrderStatus" resultType="com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean">
  5. select
  6. count(DISTINCT if((is_import_excel = false and a.order_status='DJD') or (is_import_excel = true and a.is_meet =
  7. false) ,a.id,null)) 'djd',
  8. count(DISTINCT if(a.order_status in
  9. ('FWZ','GCSZT','BFWG','DSM','YZP','XSBH','TJXSBH','ZBBH','FZXBH','WDBH'),a.id,null)) 'fwz',
  10. count(DISTINCT if(a.is_exception=1,a.id,null)) 'ycd',
  11. count(DISTINCT if(a.order_status='DQD',a.id,null)) 'dqd',
  12. count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG') ,a.id,null)) 'ywg',
  13. count(DISTINCT if(a.over_time between CONCAT(CURDATE(), ' 00:00:00') and CONCAT(CURDATE(), '
  14. 23:59:59'),a.id,null)) 'jrwg',
  15. count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG') and a.over_time >
  16. CONCAT(DATE_SUB(CURDATE(), INTERVAL 6 MONTH) , ' 00:00:00') ,a.id,null)) 'jbnwg',
  17. count(DISTINCT if(a.order_status not in ('YWG','YJS','GCSZX','YWGO','WDWG','DQD'),a.id,null)) 'WWG',
  18. COUNT(DISTINCT a.id) AS 'all'
  19. from pg_order_base a
  20. left join pg_order_worker b on a.id = b.order_base_id
  21. where ((b.worker_id=#{workerId} or b.worker_number=#{workerNumber}) or a.order_status = 'DQD') and
  22. a.order_status not in ('YQX','FWQX','FL','FWZT','YCGB')
  23. and b.websit_id = a.websit_id
  24. <if test="isYb != null and isYb == true">
  25. and a.pg_incre_order_id != ''
  26. </if>
  27. <if test="isWb != null and isWb == true">
  28. and a.rp_project_repair_id !=''
  29. </if>
  30. <if test="pgIncreOrderId != null and pgIncreOrderId !=''">
  31. and a.pg_incre_order_id = #{pgIncreOrderId}
  32. </if>
  33. and a.company_wechat_id = #{companyWechatId}
  34. </select>
  35. <select id="countPartsApply" resultType="com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean">
  36. SELECT
  37. SUM(IF(a.status = 'ING', 1, 0)) AS 'ping',
  38. SUM(IF(a.status = 'END' AND b.order_status IN ('FWZ','YCD'), 1, 0)) AS 'pend'
  39. FROM
  40. websit_parts_apply a JOIN pg_order_base b
  41. WHERE
  42. a.create_by_id = #{userId}
  43. AND a.status IN ('ING', 'END')
  44. </select>
  45. <select id="list" resultType="com.gree.mall.miniapp.bean.apply.WorkerInvolveApplyVO">
  46. SELECT
  47. a.order_base_id,
  48. a.maintenance_price_pass,
  49. b.link_name,
  50. b.user_mobile,
  51. a.create_time,
  52. b.province,
  53. b.province_id,
  54. b.city,
  55. b.city_id,
  56. b.area,
  57. b.area_id,
  58. b.street,
  59. b.street_id,
  60. b.address
  61. FROM
  62. worker_involve_apply a
  63. JOIN pg_order_base b ON a.order_base_id = b.id
  64. where 1=1
  65. <if test="status != null and status.size > 0">
  66. AND a.status IN
  67. <foreach item="item" index="index" collection="status" open="(" separator="," close=")">
  68. #{item}
  69. </foreach>
  70. </if>
  71. <if test="userId != null and userId !=''">
  72. and a.user_id = #{userId}
  73. </if>
  74. <if test="value != null and value !=''">
  75. and (b.user_name like concat('%',#{value},'%') or a.order_base_id like concat('%',#{value},'%') or a.address like concat('%',#{address},'%'))
  76. </if>
  77. </select>
  78. </mapper>