From 2996a1bbc7a0f797d0396cbad7bb0753839453eb Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 2 Nov 2023 13:24:19 +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 | 64 +++++++++++++++++++ .../book/entity/PointCategoryEntity.java | 10 ++- .../modules/book/entity/PointEntity.java | 2 + .../book/service/PointCategoryService.java | 4 ++ .../impl/PointCategoryServiceImpl.java | 22 +++++++ src/main/resources/application.yml | 2 +- src/main/resources/weChatConfig.properties | 14 ++-- 7 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/peanut/modules/book/controller/PointController.java diff --git a/src/main/java/com/peanut/modules/book/controller/PointController.java b/src/main/java/com/peanut/modules/book/controller/PointController.java new file mode 100644 index 00000000..e50335e4 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/controller/PointController.java @@ -0,0 +1,64 @@ +package com.peanut.modules.book.controller; + +import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.PointCategoryEntity; +import com.peanut.modules.book.service.PointCategoryService; +import com.peanut.modules.book.service.PointService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("book/point") +public class PointController { + @Autowired + private PointService pointService; + @Autowired + private PointCategoryService pointCategoryService; + + /** + * 获取脉穴分类列表-树形结构 + * @return + */ + @RequestMapping("/getPointCategoryList") + public R getPointCategoryList(){ + List categoryList = pointCategoryService.getCategoryList(); + return R.ok().put("categorys",categoryList); + } + + /** + * 添加脉穴分类 + * @return + */ + @RequestMapping("/addPointCategory") + public R addPointCategory(@RequestBody PointCategoryEntity p){ + pointCategoryService.save(p); + return R.ok(); + } + + /** + * 删除脉穴分类 + * @return + */ + @RequestMapping("/delPointCategory") + public R delPointCategory(@RequestBody Map map){ + Integer id = Integer.valueOf(map.get("pointCategoryId").toString()); + pointCategoryService.removeById(id); + return R.ok(); + } + + /** + * 修改脉穴分类 + * @param p + * @return + */ + @RequestMapping("/editPointCategory") + public R editPointCategory(@RequestBody PointCategoryEntity p){ + pointCategoryService.updateById(p); + return R.ok(); + } +} diff --git a/src/main/java/com/peanut/modules/book/entity/PointCategoryEntity.java b/src/main/java/com/peanut/modules/book/entity/PointCategoryEntity.java index 16761cb2..5e017918 100644 --- a/src/main/java/com/peanut/modules/book/entity/PointCategoryEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/PointCategoryEntity.java @@ -1,12 +1,11 @@ package com.peanut.modules.book.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import java.io.Serializable; import java.util.Date; +import java.util.List; @Data @TableName("point_category") @@ -23,5 +22,10 @@ public class PointCategoryEntity implements Serializable { private Date createTime; + @TableLogic private Integer delFlag; + + @TableField(exist = false) + private List children; + } 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 7156a8b0..828000fb 100644 --- a/src/main/java/com/peanut/modules/book/entity/PointEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/PointEntity.java @@ -2,6 +2,7 @@ package com.peanut.modules.book.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -35,5 +36,6 @@ public class PointEntity implements Serializable { private Date createTime; + @TableLogic private Integer delFlag; } 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 b867c72c..8c58d090 100644 --- a/src/main/java/com/peanut/modules/book/service/PointCategoryService.java +++ b/src/main/java/com/peanut/modules/book/service/PointCategoryService.java @@ -3,5 +3,9 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.modules.book.entity.PointCategoryEntity; +import java.util.List; + public interface PointCategoryService extends IService { + + List getCategoryList(); } 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 964e8436..93eab6a6 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,11 +1,33 @@ package com.peanut.modules.book.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.service.PointCategoryService; import org.springframework.stereotype.Service; +import java.util.List; + @Service("pointCategoryService") public class PointCategoryServiceImpl extends ServiceImpl implements PointCategoryService { + + + @Override + public List getCategoryList() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointCategoryEntity::getPid,0); + wrapper.orderByDesc(PointCategoryEntity::getSort); + List list = list(wrapper); + for (PointCategoryEntity p : list){ + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(PointCategoryEntity::getPid,p.getId()); + wrapper1.orderByDesc(PointCategoryEntity::getSort); + List list1 = list(wrapper1); + p.setChildren(list1); + } + return list; + } + + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ad28466c..4b7d7a8c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ connection-timeout: 6000000ms spring: # 环境 dev|test|prod profiles: - active: prod + active: dev # jackson时间格式化 jackson: time-zone: GMT+8 diff --git a/src/main/resources/weChatConfig.properties b/src/main/resources/weChatConfig.properties index a24fe685..c95caf68 100644 --- a/src/main/resources/weChatConfig.properties +++ b/src/main/resources/weChatConfig.properties @@ -5,22 +5,22 @@ wxpay.mchId:1612860909 # ?? URL wxpay.payUrl:https://api.mch.weixin.qq.com/v3/pay/transactions/app # ???? -wxpay.notifyUrl:https://api.nuttyreading.com/pay/payNotify +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