金币系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.4 KiB

5 months ago
5 months ago
5 months ago
  1. package com.example.demo.serviceImpl;
  2. import com.example.demo.domain.entity.DetailY;
  3. import com.example.demo.domain.entity.UserDetailExport;
  4. import com.example.demo.domain.vo.DetailExport;
  5. import com.example.demo.domain.vo.DetailYgold;
  6. import com.example.demo.domain.vo.SumDetailY;
  7. import com.example.demo.mapper.DetailYMapper;
  8. import com.example.demo.sevice.DetailYService;
  9. import com.github.pagehelper.PageHelper;
  10. import com.github.pagehelper.PageInfo;
  11. import lombok.RequiredArgsConstructor;
  12. import org.springframework.cache.annotation.CacheConfig;
  13. import org.springframework.cache.annotation.Cacheable;
  14. import org.springframework.stereotype.Service;
  15. import org.springframework.transaction.annotation.Transactional;
  16. import java.util.List;
  17. @Service
  18. @Transactional
  19. @RequiredArgsConstructor
  20. @CacheConfig(cacheNames = "detailY")
  21. public class DetailYServiceImpl implements DetailYService {
  22. private final DetailYMapper detailYMapper;
  23. @Override
  24. public int add(DetailY detailY) {
  25. return detailYMapper.add(detailY);
  26. }
  27. @Cacheable(key = "#root.method.name + ':' + #detailY.hashCode()")
  28. @Override
  29. public DetailY getCount(DetailY detailY) {
  30. return detailYMapper.getCount(detailY);
  31. }
  32. @Override
  33. public DetailYgold getgold(DetailYgold detailYgold) {
  34. return (DetailYgold) detailYMapper.selectgold(detailYgold);
  35. }
  36. @Cacheable(key = "#root.method.name + ':' + #pageNum + '-' + #pageSize + '-' + #detailYgold.hashCode()")
  37. @Override
  38. public PageInfo<DetailYgold> selectgold(int pageNum, int pageSize, DetailYgold detailYgold) {
  39. PageHelper.startPage(pageNum, pageSize);
  40. List<DetailYgold> list = detailYMapper.selectgold(detailYgold);
  41. return new PageInfo<>(list);
  42. }
  43. @Cacheable(key = "#root.method.name + ':' + #pageNum + '-' + #pageSize + '-' + #detailY.hashCode()")
  44. @Override
  45. public PageInfo<DetailY> getDetailByPage(int pageNum, int pageSize, DetailY detailY) {
  46. if(detailY.getNum()!=null) {
  47. if (detailY.getNum().equals("1")) {
  48. PageHelper.startPage(pageNum, pageSize);
  49. List<DetailY> list = detailYMapper.select(detailY);
  50. return new PageInfo<>(list);
  51. } else if (detailY.getNum().equals("2")) {
  52. PageHelper.startPage(pageNum, pageSize);
  53. List<DetailY> list = detailYMapper.select1(detailY);
  54. return new PageInfo<>(list);
  55. }
  56. }
  57. else if (detailY.getNum() == null) {
  58. PageHelper.startPage(pageNum, pageSize);
  59. List<DetailY> list = detailYMapper.select(detailY);
  60. return new PageInfo<>(list);
  61. }
  62. return null;
  63. }
  64. @Override
  65. public List<UserDetailExport> searchAll(DetailExport detailExport) {
  66. return detailYMapper.searchAll(detailExport);
  67. }
  68. @Override
  69. public List<SumDetailY> getDetailY(SumDetailY sumdetailY) {
  70. System.out.println("------------------------------------------------------------------");
  71. System.out.println(detailYMapper.getDetailY(sumdetailY));
  72. System.out.println("------------------------------------------------------------------");
  73. return detailYMapper.getDetailY(sumdetailY);
  74. }
  75. @Override
  76. public List<String> getarea() {
  77. return detailYMapper.getarea();
  78. }
  79. // @Override
  80. // public List<UserDetailExport> searchAll(UserDetailExport userDetailExport) {
  81. // return detailYMapper.searchExport();
  82. // }
  83. }