ChannelView.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.cyksj.model.views;
  2. import com.ejlchina.searcher.bean.DbField;
  3. import com.ejlchina.searcher.bean.SearchBean;
  4. import lombok.Getter;
  5. import lombok.Setter;
  6. import java.math.BigDecimal;
  7. import java.util.Date;
  8. /**
  9. * @author chan
  10. * @date 2022/12/13 2:54 PM
  11. */
  12. @Getter
  13. @Setter
  14. @SearchBean(tables = "channel c " +
  15. " LEFT JOIN channel_popularize cp on c.id = cp.channel_id " +
  16. " LEFT JOIN order_don o on cp.id = o.popularize_id :time: " +
  17. " LEFT JOIN order_don o1 on o.id = o1.id and o1.`status` != 'close' " +
  18. " LEFT JOIN order_don o2 on o.id = o2.id and o2.`status` = 'refund' "
  19. ,groupBy = " c.id,c.`name`,c.wx_shop_id,c.host,c.zfb_shop_id,c.created_time,c.update_time"
  20. ,distinct = true
  21. )
  22. public class ChannelView {
  23. @DbField("c.id")
  24. private Long id;
  25. @DbField("c.name")
  26. private String name;
  27. /**
  28. * 域名
  29. */
  30. @DbField("c.host")
  31. private String host;
  32. /**
  33. * 链接数
  34. */
  35. @DbField("count(DISTINCT(cp.id))")
  36. private Integer popularizeCount;
  37. @DbField("c.wx_shop_id")
  38. private String wxShopId;
  39. @DbField("c.zfb_shop_id")
  40. private String zfbShopId;
  41. /**
  42. * 浏览数
  43. */
  44. @DbField("select count(v.id) from channel_popularize_visit v,channel_popularize cp where v.popularize_id = cp.id and cp.id = c.id ")
  45. private Integer visit;
  46. /**
  47. * 订单数
  48. */
  49. @DbField("count(o1.id)")
  50. private Integer orderCount;
  51. /**
  52. * 订单金额
  53. */
  54. @DbField("IFNULL(sum(o1.money),0)")
  55. private BigDecimal orderMoney;
  56. /**
  57. * 退款订单数
  58. */
  59. @DbField("count(o2.id)")
  60. private Integer refundCount;
  61. /**
  62. * 退款金额
  63. */
  64. @DbField("IFNULL(sum(o2.money),0)")
  65. private BigDecimal refundMoney;
  66. @DbField("c.remark")
  67. private String remark;
  68. @DbField("c.created_time")
  69. private Date createdTime;
  70. @DbField("c.update_time")
  71. private Date updateTime;
  72. }