From f219296d33db04d0edcc129baaa31ad178cbd05d Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 2 Nov 2023 16:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=80=E8=84=89=E5=88=9D=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/PointController.java | 45 +++++++++++++++++++ .../modules/book/entity/PointEntity.java | 2 + .../book/service/PointCategoryService.java | 3 ++ .../modules/book/service/PointService.java | 7 +++ .../impl/PointCategoryServiceImpl.java | 4 +- .../book/service/impl/PointServiceImpl.java | 42 +++++++++++++++++ src/main/resources/weChatConfig.properties | 12 ++--- 7 files changed, 108 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/PointController.java b/src/main/java/com/peanut/modules/book/controller/PointController.java index e50335e4..2bd826f3 100644 --- a/src/main/java/com/peanut/modules/book/controller/PointController.java +++ b/src/main/java/com/peanut/modules/book/controller/PointController.java @@ -1,7 +1,9 @@ package com.peanut.modules.book.controller; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.peanut.common.utils.R; import com.peanut.modules.book.entity.PointCategoryEntity; +import com.peanut.modules.book.entity.PointEntity; import com.peanut.modules.book.service.PointCategoryService; import com.peanut.modules.book.service.PointService; import org.springframework.beans.factory.annotation.Autowired; @@ -61,4 +63,47 @@ public class PointController { pointCategoryService.updateById(p); return R.ok(); } + + /** + * 获取脉穴文章列表 + * @return + */ + @RequestMapping("/getPointList") + public R getPointList(@RequestBody Map map){ + Page pointList = pointService.getPointList(map); + return R.ok().put("page",pointList); + } + + /** + * 添加脉穴文章 + * @return + */ + @RequestMapping("/addPoint") + public R addPoint(@RequestBody PointEntity pointEntity){ + pointService.save(pointEntity); + return R.ok(); + } + + /** + * 删除脉穴文章 + * @param map + * @return + */ + @RequestMapping("/delPoint") + public R delPoint(@RequestBody Map map){ + Integer pointId = Integer.valueOf(map.get("pointId").toString()); + pointService.removeById(pointId); + return R.ok(); + } + + /** + * 修改脉穴文章 + * @param pointEntity + * @return + */ + @RequestMapping("/editPoint") + public R editPoint(@RequestBody PointEntity pointEntity){ + pointService.updateById(pointEntity); + return R.ok(); + } } diff --git a/src/main/java/com/peanut/modules/book/entity/PointEntity.java b/src/main/java/com/peanut/modules/book/entity/PointEntity.java index 828000fb..853779d3 100644 --- a/src/main/java/com/peanut/modules/book/entity/PointEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/PointEntity.java @@ -16,6 +16,8 @@ public class PointEntity implements Serializable { @TableId(type = IdType.AUTO) private Integer id; + private String title; + private Integer pointCategoryId; private String alias; diff --git a/src/main/java/com/peanut/modules/book/service/PointCategoryService.java b/src/main/java/com/peanut/modules/book/service/PointCategoryService.java index 8c58d090..1931db9e 100644 --- a/src/main/java/com/peanut/modules/book/service/PointCategoryService.java +++ b/src/main/java/com/peanut/modules/book/service/PointCategoryService.java @@ -2,10 +2,13 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.modules.book.entity.PointCategoryEntity; +import com.peanut.modules.book.entity.PointEntity; import java.util.List; +import java.util.Map; public interface PointCategoryService extends IService { List getCategoryList(); + } diff --git a/src/main/java/com/peanut/modules/book/service/PointService.java b/src/main/java/com/peanut/modules/book/service/PointService.java index 4f723940..f1c43e4c 100644 --- a/src/main/java/com/peanut/modules/book/service/PointService.java +++ b/src/main/java/com/peanut/modules/book/service/PointService.java @@ -1,7 +1,14 @@ package com.peanut.modules.book.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.modules.book.entity.PointEntity; +import java.util.List; +import java.util.Map; + public interface PointService extends IService { + + + Page getPointList(Map map); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/PointCategoryServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/PointCategoryServiceImpl.java index 93eab6a6..2a781fb3 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/PointCategoryServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/PointCategoryServiceImpl.java @@ -1,13 +1,16 @@ package com.peanut.modules.book.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.modules.book.dao.PointCategoryDao; import com.peanut.modules.book.entity.PointCategoryEntity; +import com.peanut.modules.book.entity.PointEntity; import com.peanut.modules.book.service.PointCategoryService; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service("pointCategoryService") public class PointCategoryServiceImpl extends ServiceImpl implements PointCategoryService { @@ -29,5 +32,4 @@ public class PointCategoryServiceImpl extends ServiceImpl implements PointService { + + @Autowired + private PointCategoryDao pointCategoryDao; + + + @Override + public Page getPointList(Map map) { + Integer limit = Integer.valueOf(map.get("limit").toString()); + Integer page = Integer.valueOf(map.get("page").toString()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if(map.containsKey("pointCategoryId")&& StringUtils.isNotBlank(map.get("pointCategoryId").toString())){ + Integer id = Integer.valueOf(map.get("pointCategoryId").toString()); + List ids = new ArrayList<>(); + createIds(id,ids); + wrapper.in(PointEntity::getPointCategoryId,ids); + } + wrapper.orderByDesc(PointEntity::getSort); + Page pointEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper); + return pointEntityPage; + } + + + + private void createIds(Integer id,List list){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointCategoryEntity::getPid,id); + List pointCategoryEntities = pointCategoryDao.selectList(wrapper); + for (PointCategoryEntity p :pointCategoryEntities){ + createIds(p.getId(),list); + } + list.add(id); + } } diff --git a/src/main/resources/weChatConfig.properties b/src/main/resources/weChatConfig.properties index c95caf68..4b45ba81 100644 --- a/src/main/resources/weChatConfig.properties +++ b/src/main/resources/weChatConfig.properties @@ -9,18 +9,18 @@ wxpay.notifyUrl:https://testapi.nuttyreading.com/pay/payNotify # ?? url wxpay.refundNotifyUrl:http://pjm6m9.natappfree.cc/pay/refundNotify # key pem -#wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem #wxpay.keyPemPath:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem -wxpay.keyPemPath:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem +#wxpay.keyPemPath:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem # ??? wxpay.serialNo:679AECB2F7AC4183033F713828892BA640E4EEE3 # API v3 key wxpay.apiV3Key:4aYFklzaULeGlr7oJPZ6rHWKcxjihZUF # ???? -#wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem +wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem #wxpay.wechatPayCertificateUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem - wxpay.wechatPayCertificateUrl:D:/hs/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem +# wxpay.wechatPayCertificateUrl:D:/hs/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem # ?? url -#wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem #wxpay.privateKeyUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem -wxpay.privateKeyUrl:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem \ No newline at end of file +#wxpay.privateKeyUrl:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem \ No newline at end of file