[feat] 策略增删改查相关接口
Showing
9 changed files
with
190 additions
and
13 deletions
| 1 | package com.ql.backend.ploycenter.application; | 1 | package com.ql.backend.ploycenter.application; |
| 2 | 2 | ||
| 3 | import com.ql.backend.core.interfaces.vo.ApiResponse; | 3 | import com.ql.backend.core.interfaces.vo.ApiResponse; |
| 4 | import com.ql.backend.core.interfaces.vo.PageVO; | ||
| 5 | import com.ql.backend.ploycenter.domain.condition.PloyCondition; | ||
| 4 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; | 6 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; |
| 7 | import com.ql.backend.ploycenter.interfaces.request.PloyUpdateRequest; | ||
| 8 | import com.ql.backend.ploycenter.interfaces.vo.PloyVO; | ||
| 5 | import com.ql.backend.taskmanager.common.dto.TaskDTO; | 9 | import com.ql.backend.taskmanager.common.dto.TaskDTO; |
| 6 | 10 | ||
| 7 | /** | 11 | /** |
| ... | @@ -10,7 +14,25 @@ import com.ql.backend.taskmanager.common.dto.TaskDTO; | ... | @@ -10,7 +14,25 @@ import com.ql.backend.taskmanager.common.dto.TaskDTO; |
| 10 | */ | 14 | */ |
| 11 | public interface PloyService { | 15 | public interface PloyService { |
| 12 | 16 | ||
| 17 | /** | ||
| 18 | * 创建策略 | ||
| 19 | */ | ||
| 13 | String createPloy(PloyCreateRequest request); | 20 | String createPloy(PloyCreateRequest request); |
| 14 | 21 | ||
| 22 | /** | ||
| 23 | * 更新策略 | ||
| 24 | */ | ||
| 25 | void updatePloy(String ployId, PloyUpdateRequest request); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * 查询策略列表 | ||
| 29 | */ | ||
| 30 | PageVO<PloyVO> findPloy(PloyCondition condition); | ||
| 31 | |||
| 32 | /** | ||
| 33 | * 查询策略详情 | ||
| 34 | */ | ||
| 35 | PloyVO getPloy(String ployId); | ||
| 36 | |||
| 15 | ApiResponse<String> fire(TaskDTO taskDTO); | 37 | ApiResponse<String> fire(TaskDTO taskDTO); |
| 16 | } | 38 | } | ... | ... |
ql-backend-ploycenter/src/main/java/com/ql/backend/ploycenter/application/ShopService.java
0 → 100644
| 1 | package com.ql.backend.ploycenter.application; | ||
| 2 | |||
| 3 | import com.ql.backend.core.interfaces.vo.PageVO; | ||
| 4 | import com.ql.backend.ploycenter.domain.condition.ShopCondition; | ||
| 5 | import com.ql.backend.ploycenter.interfaces.request.ShopCreateRequest; | ||
| 6 | import com.ql.backend.ploycenter.interfaces.request.ShopUpdateRequest; | ||
| 7 | import com.ql.backend.ploycenter.interfaces.vo.ShopVO; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author lirenhao | ||
| 11 | * date: 2022/9/14 12:04 | ||
| 12 | */ | ||
| 13 | public interface ShopService { | ||
| 14 | |||
| 15 | /** | ||
| 16 | * 创建店铺 | ||
| 17 | */ | ||
| 18 | String createShop(ShopCreateRequest request); | ||
| 19 | |||
| 20 | /** | ||
| 21 | * 更新店铺信息 | ||
| 22 | */ | ||
| 23 | void updateShop(String id, ShopUpdateRequest request); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * 查询店铺列表 | ||
| 27 | */ | ||
| 28 | PageVO<ShopVO> findShop(ShopCondition condition); | ||
| 29 | |||
| 30 | /** | ||
| 31 | * 查询店铺详情 | ||
| 32 | */ | ||
| 33 | ShopVO getShop(String id); | ||
| 34 | } |
| ... | @@ -2,19 +2,26 @@ package com.ql.backend.ploycenter.application.impl; | ... | @@ -2,19 +2,26 @@ package com.ql.backend.ploycenter.application.impl; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.ql.backend.core.interfaces.vo.ApiResponse; | 4 | import com.ql.backend.core.interfaces.vo.ApiResponse; |
| 5 | import com.ql.backend.core.interfaces.vo.PageVO; | ||
| 5 | import com.ql.backend.ploycenter.application.PloyService; | 6 | import com.ql.backend.ploycenter.application.PloyService; |
| 7 | import com.ql.backend.ploycenter.domain.condition.PloyCondition; | ||
| 6 | import com.ql.backend.ploycenter.domain.po.PloyPO; | 8 | import com.ql.backend.ploycenter.domain.po.PloyPO; |
| 7 | import com.ql.backend.ploycenter.infrastructure.adapter.ControlCenterAdapter; | 9 | import com.ql.backend.ploycenter.infrastructure.adapter.ControlCenterAdapter; |
| 8 | import com.ql.backend.ploycenter.infrastructure.converter.mapper.PloyConverter; | 10 | import com.ql.backend.ploycenter.infrastructure.converter.mapper.PloyConverter; |
| 9 | import com.ql.backend.ploycenter.infrastructure.persistence.dao.PloyDao; | 11 | import com.ql.backend.ploycenter.infrastructure.persistence.dao.PloyDao; |
| 10 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; | 12 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; |
| 13 | import com.ql.backend.ploycenter.interfaces.request.PloyUpdateRequest; | ||
| 14 | import com.ql.backend.ploycenter.interfaces.vo.PloyVO; | ||
| 11 | import com.ql.backend.taskmanager.common.dto.TaskDTO; | 15 | import com.ql.backend.taskmanager.common.dto.TaskDTO; |
| 12 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 18 | import org.springframework.transaction.annotation.Transactional; | ||
| 19 | import org.springframework.util.CollectionUtils; | ||
| 14 | import org.springframework.util.ObjectUtils; | 20 | import org.springframework.util.ObjectUtils; |
| 15 | 21 | ||
| 16 | import javax.annotation.Resource; | 22 | import javax.annotation.Resource; |
| 17 | import java.util.Date; | 23 | import java.util.Date; |
| 24 | import java.util.List; | ||
| 18 | import java.util.UUID; | 25 | import java.util.UUID; |
| 19 | 26 | ||
| 20 | /** | 27 | /** |
| ... | @@ -32,6 +39,7 @@ public class PloyServiceImpl implements PloyService { | ... | @@ -32,6 +39,7 @@ public class PloyServiceImpl implements PloyService { |
| 32 | private PloyDao ployDao; | 39 | private PloyDao ployDao; |
| 33 | 40 | ||
| 34 | @Override | 41 | @Override |
| 42 | @Transactional | ||
| 35 | public String createPloy(PloyCreateRequest request) { | 43 | public String createPloy(PloyCreateRequest request) { |
| 36 | PloyPO po = PloyConverter.INSTANCE.convertRequest2Po(request); | 44 | PloyPO po = PloyConverter.INSTANCE.convertRequest2Po(request); |
| 37 | po.setPloyId(UUID.randomUUID().toString()); | 45 | po.setPloyId(UUID.randomUUID().toString()); |
| ... | @@ -39,10 +47,48 @@ public class PloyServiceImpl implements PloyService { | ... | @@ -39,10 +47,48 @@ public class PloyServiceImpl implements PloyService { |
| 39 | po.setGmtModified(new Date()); | 47 | po.setGmtModified(new Date()); |
| 40 | po.setIsDeleted(Boolean.FALSE); | 48 | po.setIsDeleted(Boolean.FALSE); |
| 41 | ployDao.save(po); | 49 | ployDao.save(po); |
| 50 | |||
| 51 | if (!CollectionUtils.isEmpty(request.getBindShopIds())) { | ||
| 52 | /* todo 绑定店铺 */ | ||
| 53 | } | ||
| 54 | |||
| 42 | return po.getPloyId(); | 55 | return po.getPloyId(); |
| 43 | } | 56 | } |
| 44 | 57 | ||
| 45 | @Override | 58 | @Override |
| 59 | @Transactional | ||
| 60 | public void updatePloy(String ployId, PloyUpdateRequest request) { | ||
| 61 | PloyPO po = PloyConverter.INSTANCE.convertRequest2Po(request); | ||
| 62 | po.setPloyId(ployId); | ||
| 63 | po.setGmtModified(new Date()); | ||
| 64 | ployDao.updateById(po); | ||
| 65 | |||
| 66 | if (!CollectionUtils.isEmpty(request.getBindShopIds())) { | ||
| 67 | /* todo 绑定店铺 */ | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | @Override | ||
| 72 | public PageVO<PloyVO> findPloy(PloyCondition condition) { | ||
| 73 | long total = ployDao.countByCondition(condition); | ||
| 74 | List<PloyPO> list = ployDao.listByCondition(condition); | ||
| 75 | return PageVO.<PloyVO>builder() | ||
| 76 | .page(condition.getPage()) | ||
| 77 | .size(condition.getSize()) | ||
| 78 | .total(total) | ||
| 79 | .list(PloyConverter.INSTANCE.convertPo2Vo(list)) | ||
| 80 | .build(); | ||
| 81 | } | ||
| 82 | |||
| 83 | @Override | ||
| 84 | public PloyVO getPloy(String ployId) { | ||
| 85 | PloyPO po = ployDao.getPloyById(ployId); | ||
| 86 | PloyVO vo = PloyConverter.INSTANCE.convertPo2Vo(po); | ||
| 87 | /* todo 查询策略详情, 并查询绑定的店铺信息 */ | ||
| 88 | return vo; | ||
| 89 | } | ||
| 90 | |||
| 91 | @Override | ||
| 46 | public ApiResponse<String> fire(TaskDTO taskDTO) { | 92 | public ApiResponse<String> fire(TaskDTO taskDTO) { |
| 47 | /* 执行策略, 创建任务 */ | 93 | /* 执行策略, 创建任务 */ |
| 48 | if (!ObjectUtils.isEmpty(taskDTO.getPloyId())) { | 94 | if (!ObjectUtils.isEmpty(taskDTO.getPloyId())) { | ... | ... |
ql-backend-ploycenter/src/main/java/com/ql/backend/ploycenter/application/impl/ShopServiceImpl.java
0 → 100644
| 1 | package com.ql.backend.ploycenter.application.impl; | ||
| 2 | |||
| 3 | import com.ql.backend.core.interfaces.vo.PageVO; | ||
| 4 | import com.ql.backend.ploycenter.application.ShopService; | ||
| 5 | import com.ql.backend.ploycenter.domain.condition.ShopCondition; | ||
| 6 | import com.ql.backend.ploycenter.interfaces.request.ShopCreateRequest; | ||
| 7 | import com.ql.backend.ploycenter.interfaces.request.ShopUpdateRequest; | ||
| 8 | import com.ql.backend.ploycenter.interfaces.vo.ShopVO; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | ||
| 10 | import org.springframework.stereotype.Service; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author lirenhao | ||
| 14 | * date: 2022/9/14 12:07 | ||
| 15 | */ | ||
| 16 | @Slf4j | ||
| 17 | @Service | ||
| 18 | public class ShopServiceImpl implements ShopService { | ||
| 19 | |||
| 20 | @Override | ||
| 21 | public String createShop(ShopCreateRequest request) { | ||
| 22 | /* todo 创建店铺 */ | ||
| 23 | return null; | ||
| 24 | } | ||
| 25 | |||
| 26 | @Override | ||
| 27 | public void updateShop(String id, ShopUpdateRequest request) { | ||
| 28 | /* todo 更新店铺信息 */ | ||
| 29 | } | ||
| 30 | |||
| 31 | @Override | ||
| 32 | public PageVO<ShopVO> findShop(ShopCondition condition) { | ||
| 33 | /* todo 查询店铺列表 */ | ||
| 34 | return null; | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public ShopVO getShop(String id) { | ||
| 39 | /* todo 查询店铺详情 */ | ||
| 40 | return null; | ||
| 41 | } | ||
| 42 | } |
| ... | @@ -3,6 +3,7 @@ package com.ql.backend.ploycenter.infrastructure.converter.mapper; | ... | @@ -3,6 +3,7 @@ package com.ql.backend.ploycenter.infrastructure.converter.mapper; |
| 3 | import com.ql.backend.ploycenter.common.dto.PloyDTO; | 3 | import com.ql.backend.ploycenter.common.dto.PloyDTO; |
| 4 | import com.ql.backend.ploycenter.domain.po.PloyPO; | 4 | import com.ql.backend.ploycenter.domain.po.PloyPO; |
| 5 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; | 5 | import com.ql.backend.ploycenter.interfaces.request.PloyCreateRequest; |
| 6 | import com.ql.backend.ploycenter.interfaces.request.PloyUpdateRequest; | ||
| 6 | import com.ql.backend.ploycenter.interfaces.vo.PloyVO; | 7 | import com.ql.backend.ploycenter.interfaces.vo.PloyVO; |
| 7 | import org.mapstruct.Mapper; | 8 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.NullValueCheckStrategy; | 9 | import org.mapstruct.NullValueCheckStrategy; |
| ... | @@ -10,6 +11,8 @@ import org.mapstruct.NullValuePropertyMappingStrategy; | ... | @@ -10,6 +11,8 @@ import org.mapstruct.NullValuePropertyMappingStrategy; |
| 10 | import org.mapstruct.ReportingPolicy; | 11 | import org.mapstruct.ReportingPolicy; |
| 11 | import org.mapstruct.factory.Mappers; | 12 | import org.mapstruct.factory.Mappers; |
| 12 | 13 | ||
| 14 | import java.util.List; | ||
| 15 | |||
| 13 | /** | 16 | /** |
| 14 | * @author lirenhao | 17 | * @author lirenhao |
| 15 | * date: 2022/9/5 17:45 | 18 | * date: 2022/9/5 17:45 |
| ... | @@ -22,4 +25,10 @@ public interface PloyConverter extends CommonConverter<PloyPO, PloyDTO, PloyVO> | ... | @@ -22,4 +25,10 @@ public interface PloyConverter extends CommonConverter<PloyPO, PloyDTO, PloyVO> |
| 22 | PloyConverter INSTANCE = Mappers.getMapper(PloyConverter.class); | 25 | PloyConverter INSTANCE = Mappers.getMapper(PloyConverter.class); |
| 23 | 26 | ||
| 24 | PloyPO convertRequest2Po(PloyCreateRequest request); | 27 | PloyPO convertRequest2Po(PloyCreateRequest request); |
| 28 | |||
| 29 | PloyPO convertRequest2Po(PloyUpdateRequest request); | ||
| 30 | |||
| 31 | PloyVO convertPo2Vo(PloyPO po); | ||
| 32 | |||
| 33 | List<PloyVO> convertPo2Vo(List<PloyPO> pos); | ||
| 25 | } | 34 | } | ... | ... |
| 1 | package com.ql.backend.ploycenter.infrastructure.persistence.dao; | 1 | package com.ql.backend.ploycenter.infrastructure.persistence.dao; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.extension.service.IService; | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | import com.ql.backend.ploycenter.domain.condition.PloyCondition; | ||
| 4 | import com.ql.backend.ploycenter.domain.po.PloyPO; | 5 | import com.ql.backend.ploycenter.domain.po.PloyPO; |
| 5 | 6 | ||
| 7 | import java.util.List; | ||
| 8 | |||
| 6 | /** | 9 | /** |
| 7 | * @author lirenhao | 10 | * @author lirenhao |
| 8 | * date: 2022/9/5 16:41 | 11 | * date: 2022/9/5 16:41 |
| ... | @@ -10,4 +13,8 @@ import com.ql.backend.ploycenter.domain.po.PloyPO; | ... | @@ -10,4 +13,8 @@ import com.ql.backend.ploycenter.domain.po.PloyPO; |
| 10 | public interface PloyDao extends IService<PloyPO> { | 13 | public interface PloyDao extends IService<PloyPO> { |
| 11 | 14 | ||
| 12 | PloyPO getPloyById(String ployId); | 15 | PloyPO getPloyById(String ployId); |
| 16 | |||
| 17 | long countByCondition(PloyCondition condition); | ||
| 18 | |||
| 19 | List<PloyPO> listByCondition(PloyCondition condition); | ||
| 13 | } | 20 | } | ... | ... |
| ... | @@ -2,11 +2,14 @@ package com.ql.backend.ploycenter.infrastructure.persistence.dao.impl; | ... | @@ -2,11 +2,14 @@ package com.ql.backend.ploycenter.infrastructure.persistence.dao.impl; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 5 | import com.ql.backend.ploycenter.domain.condition.PloyCondition; | ||
| 5 | import com.ql.backend.ploycenter.domain.po.PloyPO; | 6 | import com.ql.backend.ploycenter.domain.po.PloyPO; |
| 6 | import com.ql.backend.ploycenter.infrastructure.persistence.dao.PloyDao; | 7 | import com.ql.backend.ploycenter.infrastructure.persistence.dao.PloyDao; |
| 7 | import com.ql.backend.ploycenter.infrastructure.persistence.mapper.PloyMapper; | 8 | import com.ql.backend.ploycenter.infrastructure.persistence.mapper.PloyMapper; |
| 8 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 9 | 10 | ||
| 11 | import java.util.List; | ||
| 12 | |||
| 10 | /** | 13 | /** |
| 11 | * @author lirenhao | 14 | * @author lirenhao |
| 12 | * date: 2022/9/5 16:41 | 15 | * date: 2022/9/5 16:41 |
| ... | @@ -20,4 +23,17 @@ public class PloyDaoImpl extends ServiceImpl<PloyMapper, PloyPO> implements Ploy | ... | @@ -20,4 +23,17 @@ public class PloyDaoImpl extends ServiceImpl<PloyMapper, PloyPO> implements Ploy |
| 20 | wrapper.eq(PloyPO::getPloyId, ployId); | 23 | wrapper.eq(PloyPO::getPloyId, ployId); |
| 21 | return this.baseMapper.selectOne(wrapper); | 24 | return this.baseMapper.selectOne(wrapper); |
| 22 | } | 25 | } |
| 26 | |||
| 27 | @Override | ||
| 28 | public long countByCondition(PloyCondition condition) { | ||
| 29 | LambdaQueryWrapper<PloyPO> wrapper = new LambdaQueryWrapper<>(); | ||
| 30 | return count(wrapper); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Override | ||
| 34 | public List<PloyPO> listByCondition(PloyCondition condition) { | ||
| 35 | LambdaQueryWrapper<PloyPO> wrapper = new LambdaQueryWrapper<>(); | ||
| 36 | wrapper.last("LIMIT " + (condition.getPage() * condition.getSize()) + ", " + condition.getSize()); | ||
| 37 | return this.list(wrapper); | ||
| 38 | } | ||
| 23 | } | 39 | } | ... | ... |
| ... | @@ -37,7 +37,7 @@ public class PloyFacade { | ... | @@ -37,7 +37,7 @@ public class PloyFacade { |
| 37 | */ | 37 | */ |
| 38 | @PutMapping("/{id}") | 38 | @PutMapping("/{id}") |
| 39 | public ApiResponse<Void> updatePloy(@PathVariable("id") String id, @RequestBody PloyUpdateRequest request) { | 39 | public ApiResponse<Void> updatePloy(@PathVariable("id") String id, @RequestBody PloyUpdateRequest request) { |
| 40 | /* todo 更新策略 */ | 40 | ployService.updatePloy(id, request); |
| 41 | return ApiResponse.ok(); | 41 | return ApiResponse.ok(); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| ... | @@ -46,8 +46,7 @@ public class PloyFacade { | ... | @@ -46,8 +46,7 @@ public class PloyFacade { |
| 46 | */ | 46 | */ |
| 47 | @GetMapping | 47 | @GetMapping |
| 48 | public ApiResponse<PageVO<PloyVO>> findPloy(PloyCondition condition) { | 48 | public ApiResponse<PageVO<PloyVO>> findPloy(PloyCondition condition) { |
| 49 | /* todo 查询策略列表 */ | 49 | return ApiResponse.ok(ployService.findPloy(condition)); |
| 50 | return ApiResponse.ok(); | ||
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | /** | 52 | /** |
| ... | @@ -55,7 +54,6 @@ public class PloyFacade { | ... | @@ -55,7 +54,6 @@ public class PloyFacade { |
| 55 | */ | 54 | */ |
| 56 | @GetMapping("/{id}") | 55 | @GetMapping("/{id}") |
| 57 | public ApiResponse<PloyVO> getPloy(@PathVariable("id") String id) { | 56 | public ApiResponse<PloyVO> getPloy(@PathVariable("id") String id) { |
| 58 | /* todo 查询策略详情 */ | 57 | return ApiResponse.ok(ployService.getPloy(id)); |
| 59 | return ApiResponse.ok(); | ||
| 60 | } | 58 | } |
| 61 | } | 59 | } | ... | ... |
| ... | @@ -2,12 +2,15 @@ package com.ql.backend.ploycenter.interfaces.facade; | ... | @@ -2,12 +2,15 @@ package com.ql.backend.ploycenter.interfaces.facade; |
| 2 | 2 | ||
| 3 | import com.ql.backend.core.interfaces.vo.ApiResponse; | 3 | import com.ql.backend.core.interfaces.vo.ApiResponse; |
| 4 | import com.ql.backend.core.interfaces.vo.PageVO; | 4 | import com.ql.backend.core.interfaces.vo.PageVO; |
| 5 | import com.ql.backend.ploycenter.application.ShopService; | ||
| 5 | import com.ql.backend.ploycenter.domain.condition.ShopCondition; | 6 | import com.ql.backend.ploycenter.domain.condition.ShopCondition; |
| 6 | import com.ql.backend.ploycenter.interfaces.request.ShopCreateRequest; | 7 | import com.ql.backend.ploycenter.interfaces.request.ShopCreateRequest; |
| 7 | import com.ql.backend.ploycenter.interfaces.request.ShopUpdateRequest; | 8 | import com.ql.backend.ploycenter.interfaces.request.ShopUpdateRequest; |
| 8 | import com.ql.backend.ploycenter.interfaces.vo.ShopVO; | 9 | import com.ql.backend.ploycenter.interfaces.vo.ShopVO; |
| 9 | import org.springframework.web.bind.annotation.*; | 10 | import org.springframework.web.bind.annotation.*; |
| 10 | 11 | ||
| 12 | import javax.annotation.Resource; | ||
| 13 | |||
| 11 | /** | 14 | /** |
| 12 | * @author lirenhao | 15 | * @author lirenhao |
| 13 | * date: 2022/9/5 15:56 | 16 | * date: 2022/9/5 15:56 |
| ... | @@ -16,16 +19,18 @@ import org.springframework.web.bind.annotation.*; | ... | @@ -16,16 +19,18 @@ import org.springframework.web.bind.annotation.*; |
| 16 | @RequestMapping("/ploy-center/v1/shops") | 19 | @RequestMapping("/ploy-center/v1/shops") |
| 17 | public class ShopFacade { | 20 | public class ShopFacade { |
| 18 | 21 | ||
| 22 | @Resource | ||
| 23 | private ShopService shopService; | ||
| 24 | |||
| 19 | @PostMapping | 25 | @PostMapping |
| 20 | public ApiResponse<String> createShop(@RequestBody ShopCreateRequest request) { | 26 | public ApiResponse<String> createShop(@RequestBody ShopCreateRequest request) { |
| 21 | /* todo 创建店铺 */ | 27 | return ApiResponse.ok(shopService.createShop(request)); |
| 22 | return ApiResponse.ok(); | ||
| 23 | } | 28 | } |
| 24 | 29 | ||
| 25 | 30 | ||
| 26 | @PutMapping("/{id}") | 31 | @PutMapping("/{id}") |
| 27 | public ApiResponse<String> updateShop(@PathVariable("id") String id, @RequestBody ShopUpdateRequest request) { | 32 | public ApiResponse<Void> updateShop(@PathVariable("id") String id, @RequestBody ShopUpdateRequest request) { |
| 28 | /* todo 更新店铺信息 */ | 33 | shopService.updateShop(id,request); |
| 29 | return ApiResponse.ok(); | 34 | return ApiResponse.ok(); |
| 30 | } | 35 | } |
| 31 | 36 | ||
| ... | @@ -34,8 +39,7 @@ public class ShopFacade { | ... | @@ -34,8 +39,7 @@ public class ShopFacade { |
| 34 | */ | 39 | */ |
| 35 | @GetMapping | 40 | @GetMapping |
| 36 | public ApiResponse<PageVO<ShopVO>> findShop(ShopCondition condition) { | 41 | public ApiResponse<PageVO<ShopVO>> findShop(ShopCondition condition) { |
| 37 | /* todo 查询店铺列表 */ | 42 | return ApiResponse.ok(shopService.findShop(condition)); |
| 38 | return ApiResponse.ok(); | ||
| 39 | } | 43 | } |
| 40 | 44 | ||
| 41 | /** | 45 | /** |
| ... | @@ -43,7 +47,6 @@ public class ShopFacade { | ... | @@ -43,7 +47,6 @@ public class ShopFacade { |
| 43 | */ | 47 | */ |
| 44 | @GetMapping("/{id}") | 48 | @GetMapping("/{id}") |
| 45 | public ApiResponse<ShopVO> getShop(@PathVariable("id") String id) { | 49 | public ApiResponse<ShopVO> getShop(@PathVariable("id") String id) { |
| 46 | /* todo 查询店铺详情 */ | 50 | return ApiResponse.ok(shopService.getShop(id)); |
| 47 | return ApiResponse.ok(); | ||
| 48 | } | 51 | } |
| 49 | } | 52 | } | ... | ... |
-
Please register or sign in to post a comment