CuisineOrderMapper.java 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package com.sky.ioc.mapper;
  2. import com.sky.ioc.entity.domain.canteen.Order;
  3. import com.sky.ioc.entity.params.IocParam;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Param;
  6. import org.apache.ibatis.annotations.Select;
  7. import java.util.List;
  8. import java.util.Map;
  9. @Mapper
  10. public interface CuisineOrderMapper {
  11. @Select("<script> " +
  12. "SELECT count(DISTINCT user_id) FROM cuisine_order where 1=1 " +
  13. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  14. " and department_id=#{iocParam.deptId} " +
  15. "</if>"+
  16. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  17. " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
  18. "</if>" +
  19. "</script>")
  20. Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
  21. @Select("<script>" +
  22. "SELECT sum(order_price) FROM cuisine_order where 1=1 " +
  23. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  24. " and department_id=#{iocParam.deptId} " +
  25. "</if>"+
  26. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  27. " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
  28. "</if>"+
  29. "<if test='payType!=null '>" +
  30. " and paytype=#{payType} " +
  31. "</if>"+
  32. "</script>")
  33. Double getTotalPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam,@Param("payType")Integer payType);
  34. @Select("<script>" +
  35. "SELECT avg(order_price) FROM cuisine_order where 1=1 " +
  36. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  37. " and department_id=#{iocParam.deptId} " +
  38. "</if>"+
  39. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  40. " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
  41. "</if>"+
  42. "</script>")
  43. Double getAvgPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
  44. @Select("<script>" +
  45. "SELECT count(1) FROM cuisine_order where 1=1 " +
  46. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  47. " and department_id=#{iocParam.deptId} " +
  48. "</if>"+
  49. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  50. " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
  51. "</if>"+
  52. "</script>")
  53. Integer getTotalOrderByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
  54. @Select("<script>" +
  55. "SELECT count(item.p_name) as total,c.cuisine_name as p_name,item.p_id,c.price,c.cuisine_img from cuisine c " +
  56. "LEFT JOIN cuisine_order_item item on c.id= item.p_id " +
  57. "LEFT JOIN cuisine_order a on a.order_id = item.order_num where 1=1 " +
  58. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  59. " and a.department_id=#{iocParam.deptId} " +
  60. "</if>"+
  61. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  62. " and a.order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
  63. "</if>"+
  64. "GROUP BY item.p_id,c.price,c.cuisine_img,c.cuisine_name ORDER BY total desc limit #{iocParam.limit} " +
  65. "</script>")
  66. List<Map<String,String>> getTopListByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
  67. @Select("<script>" +
  68. "SELECT order_price as orderPrice,order_time as orderTime,paytype as payType from cuisine_order a where 1=1" +
  69. "<if test='iocParam!=null and iocParam.deptId != null '>" +
  70. " and a.department_id=#{iocParam.deptId} " +
  71. "</if>"+
  72. "<if test='iocParam!=null and iocParam.timeRange != null '>" +
  73. "<![CDATA[ and a.order_time >= #{iocParam.timeRange.startDate} AND a.order_time <= #{iocParam.timeRange.endDate} ]]> " +
  74. "</if>"+
  75. "</script>")
  76. List<Order> getListByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
  77. }