From ffcc8d93730298841cdd11462f743979febd132c Mon Sep 17 00:00:00 2001 From: ky <592468495@qq.com> Date: Tue, 26 May 2020 11:45:18 +0800 Subject: [PATCH] p --- .../java/com/gszc/controller/BannerController.java | 5 +++-- .../gszc/controller/InvoiceCategoryController.java | 5 +++-- .../com/gszc/controller/PcIndustryController.java | 5 +++-- .../java/com/gszc/controller/QuestionController.java | 5 +++-- .../java/com/gszc/service/impl/BannerServiceImpl.java | 10 ++++++++-- .../com/gszc/service/impl/IndustryServiceImpl.java | 10 ++++++++-- .../gszc/service/impl/InvoiceCategoryServiceImpl.java | 11 +++++++++-- .../com/gszc/service/impl/QuestionServiceImpl.java | 10 ++++++++-- 8 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/gszc/controller/BannerController.java b/src/main/java/com/gszc/controller/BannerController.java index 4d5a10b..94dc451 100644 --- a/src/main/java/com/gszc/controller/BannerController.java +++ b/src/main/java/com/gszc/controller/BannerController.java @@ -1,5 +1,6 @@ package com.gszc.controller; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.gszc.build.Result; @@ -66,7 +67,7 @@ public class BannerController { }) @ResponseBody public Result queryBanner(Integer pageNum,Integer pageSize) { - List banners = bannerService.queryBanner(pageNum, pageSize); - return ResultBuilder.withPayload(banners).build(); + JSONObject result = bannerService.queryBanner(pageNum, pageSize); + return ResultBuilder.withPayload(result).build(); } } diff --git a/src/main/java/com/gszc/controller/InvoiceCategoryController.java b/src/main/java/com/gszc/controller/InvoiceCategoryController.java index 387521a..3958c7f 100644 --- a/src/main/java/com/gszc/controller/InvoiceCategoryController.java +++ b/src/main/java/com/gszc/controller/InvoiceCategoryController.java @@ -1,5 +1,6 @@ package com.gszc.controller; +import com.alibaba.fastjson.JSONObject; import com.gszc.build.Result; import com.gszc.build.ResultBuilder; import com.gszc.entity.InvoiceCategory; @@ -62,7 +63,7 @@ public class InvoiceCategoryController { }) @ResponseBody public Result queryInvoiceCategory(Integer pageNum,Integer pageSize) { - List invoiceCategorys = invoiceCategoryService.queryInvoiceCategory(pageNum, pageSize); - return ResultBuilder.withPayload(invoiceCategorys).build(); + JSONObject result = invoiceCategoryService.queryInvoiceCategory(pageNum, pageSize); + return ResultBuilder.withPayload(result).build(); } } diff --git a/src/main/java/com/gszc/controller/PcIndustryController.java b/src/main/java/com/gszc/controller/PcIndustryController.java index 1c02245..8c5e61a 100644 --- a/src/main/java/com/gszc/controller/PcIndustryController.java +++ b/src/main/java/com/gszc/controller/PcIndustryController.java @@ -1,6 +1,7 @@ package com.gszc.controller; +import com.alibaba.fastjson.JSONObject; import com.gszc.build.Result; import com.gszc.build.ResultBuilder; import com.gszc.entity.InvoiceCategory; @@ -67,8 +68,8 @@ public class PcIndustryController { }) @ResponseBody public Result queryIndustry(Integer pageNum,Integer pageSize) { - List industrys = industryService.queryIndustry(pageNum, pageSize); - return ResultBuilder.withPayload(industrys).build(); + JSONObject result = industryService.queryIndustry(pageNum, pageSize); + return ResultBuilder.withPayload(result).build(); } } diff --git a/src/main/java/com/gszc/controller/QuestionController.java b/src/main/java/com/gszc/controller/QuestionController.java index 87a5100..036b5f6 100644 --- a/src/main/java/com/gszc/controller/QuestionController.java +++ b/src/main/java/com/gszc/controller/QuestionController.java @@ -1,5 +1,6 @@ package com.gszc.controller; +import com.alibaba.fastjson.JSONObject; import com.gszc.build.Result; import com.gszc.build.ResultBuilder; import com.gszc.entity.Banner; @@ -64,7 +65,7 @@ public class QuestionController { }) @ResponseBody public Result queryQuestion(Integer pageNum,Integer pageSize) { - List questions = questionService.queryQuestion(pageNum, pageSize); - return ResultBuilder.withPayload(questions).build(); + JSONObject result = questionService.queryQuestion(pageNum, pageSize); + return ResultBuilder.withPayload(result).build(); } } diff --git a/src/main/java/com/gszc/service/impl/BannerServiceImpl.java b/src/main/java/com/gszc/service/impl/BannerServiceImpl.java index 3b28166..40413d8 100644 --- a/src/main/java/com/gszc/service/impl/BannerServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/BannerServiceImpl.java @@ -1,8 +1,10 @@ package com.gszc.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.gszc.entity.Banner; +import com.gszc.entity.Banner; import com.gszc.mapper.BannerMapper; import com.gszc.service.IBannerService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; @@ -46,10 +48,14 @@ public class BannerServiceImpl extends ServiceImpl impleme bannerMapper.updateById(banner); } - public List queryBanner(Integer pageNum,Integer pageSize){ + public JSONObject queryBanner(Integer pageNum, Integer pageSize){ + Integer count = bannerMapper.selectCount(new EntityWrapper()); List result = bannerMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("1", "1").orderBy("ix", true)); - return result; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("data",result); + return jsonObject; } } diff --git a/src/main/java/com/gszc/service/impl/IndustryServiceImpl.java b/src/main/java/com/gszc/service/impl/IndustryServiceImpl.java index b7c1538..3066175 100644 --- a/src/main/java/com/gszc/service/impl/IndustryServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/IndustryServiceImpl.java @@ -1,9 +1,11 @@ package com.gszc.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.gszc.entity.Industry; import com.gszc.entity.Industry; +import com.gszc.entity.Industry; import com.gszc.mapper.IndustryMapper; import com.gszc.mapper.IndustryMapper; import com.gszc.service.IIndustryService; @@ -44,9 +46,13 @@ public class IndustryServiceImpl extends ServiceImpl i industryMapper.updateById(industry); } - public List queryIndustry(Integer pageNum, Integer pageSize){ + public JSONObject queryIndustry(Integer pageNum, Integer pageSize){ + Integer count = industryMapper.selectCount(new EntityWrapper()); List result = industryMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("1", "1").orderBy("create_date", false)); - return result; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("data",result); + return jsonObject; } } diff --git a/src/main/java/com/gszc/service/impl/InvoiceCategoryServiceImpl.java b/src/main/java/com/gszc/service/impl/InvoiceCategoryServiceImpl.java index 4e6cb55..0c79408 100644 --- a/src/main/java/com/gszc/service/impl/InvoiceCategoryServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/InvoiceCategoryServiceImpl.java @@ -1,13 +1,16 @@ package com.gszc.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; +import com.gszc.entity.Invoice; import com.gszc.entity.InvoiceCategory; import com.gszc.entity.InvoiceCategory; import com.gszc.mapper.InvoiceCategoryMapper; import com.gszc.mapper.InvoiceCategoryMapper; import com.gszc.service.IInvoiceCategoryService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.apache.ibatis.session.RowBounds; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,9 +46,13 @@ public class InvoiceCategoryServiceImpl extends ServiceImpl queryInvoiceCategory(Integer pageNum, Integer pageSize){ + public JSONObject queryInvoiceCategory(Integer pageNum, Integer pageSize){ + Integer count = invoiceCategoryMapper.selectCount(new EntityWrapper()); List result = invoiceCategoryMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("1", "1").orderBy("id", true)); - return result; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("data",result); + return jsonObject; } } diff --git a/src/main/java/com/gszc/service/impl/QuestionServiceImpl.java b/src/main/java/com/gszc/service/impl/QuestionServiceImpl.java index 74df2fb..8def06b 100644 --- a/src/main/java/com/gszc/service/impl/QuestionServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/QuestionServiceImpl.java @@ -1,9 +1,11 @@ package com.gszc.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.gszc.entity.Question; import com.gszc.entity.Question; +import com.gszc.entity.Question; import com.gszc.mapper.QuestionMapper; import com.gszc.service.IQuestionService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; @@ -46,9 +48,13 @@ public class QuestionServiceImpl extends ServiceImpl i questionMapper.updateById(question); } - public List queryQuestion(Integer pageNum, Integer pageSize){ + public JSONObject queryQuestion(Integer pageNum, Integer pageSize){ + Integer count = questionMapper.selectCount(new EntityWrapper()); List result = questionMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper().eq("1", "1").orderBy("ix", true)); - return result; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("count",count); + jsonObject.put("data",result); + return jsonObject; } }