feat(foundations):新增查询服务详情的内部接口
This commit is contained in:
parent
de68066d84
commit
c2d0d9b647
@ -4,14 +4,16 @@ import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 内部接口 - 服务相关接口
|
||||
* @author JIAN
|
||||
*/
|
||||
@FeignClient(contextId = "jzo2o-foundations", value = "jzo2o-foundations", path = "/foundations/inner/serve")
|
||||
public interface ServeApi {
|
||||
|
||||
/**
|
||||
* 根据服务id获取服务信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
ServeAggregationResDTO findById(@PathVariable("id") Long id);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.jzo2o.foundations.controller.inner;
|
||||
|
||||
import com.jzo2o.api.foundations.ServeApi;
|
||||
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||
import com.jzo2o.foundations.service.IServeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author JIAN
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inner/serve")
|
||||
@Api(tags = "内部接口 - 服务相关接口")
|
||||
public class InnerServeController implements ServeApi {
|
||||
@Resource
|
||||
private IServeService serveService;
|
||||
|
||||
/**
|
||||
* 根据服务id获取服务信息
|
||||
*/
|
||||
@Override
|
||||
@GetMapping("/{id}")
|
||||
public ServeAggregationResDTO findById(@PathVariable Long id) {
|
||||
return serveService.getServeAggregationById(id);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.jzo2o.foundations.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||
import com.jzo2o.foundations.model.domain.Serve;
|
||||
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
|
||||
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
|
||||
@ -34,4 +35,9 @@ public interface ServeMapper extends BaseMapper<Serve> {
|
||||
* @param regionId 区域id
|
||||
*/
|
||||
List<ServeAggregationSimpleResDTO> queryHotServeListByRegionId(Long regionId);
|
||||
|
||||
/**
|
||||
* 查询指定id的服务信息
|
||||
*/
|
||||
ServeAggregationResDTO getServeAggregationById(Long id);
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.jzo2o.foundations.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||
import com.jzo2o.common.model.PageResult;
|
||||
import com.jzo2o.foundations.model.domain.Serve;
|
||||
import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
|
||||
@ -86,4 +87,9 @@ public interface IServeService extends IService<Serve> {
|
||||
* 查询指定区域的服务
|
||||
*/
|
||||
List<ServeSimpleResDTO> findServeList(String cityCode, Long serveTypeId, String keyword);
|
||||
|
||||
/**
|
||||
* 获取指定id的服务
|
||||
*/
|
||||
ServeAggregationResDTO getServeAggregationById(Long id);
|
||||
}
|
||||
@ -5,6 +5,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
|
||||
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||
import com.jzo2o.common.expcetions.CommonException;
|
||||
import com.jzo2o.common.expcetions.ForbiddenOperationException;
|
||||
import com.jzo2o.common.model.PageResult;
|
||||
@ -380,6 +381,11 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServeAggregationResDTO getServeAggregationById(Long id) {
|
||||
return baseMapper.getServeAggregationById(id);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private IRegionService regionService;
|
||||
@Resource
|
||||
|
||||
@ -71,4 +71,30 @@
|
||||
AND serve.is_hot = 1 # 保证热门状态
|
||||
ORDER BY item.sort_num
|
||||
</select>
|
||||
|
||||
<select id="getServeAggregationById" resultType="com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO"
|
||||
parameterType="java.lang.Long">
|
||||
SELECT serve_type_id,
|
||||
type.name serve_type_name,
|
||||
type.serve_type_icon,
|
||||
type.img serve_type_img,
|
||||
type.sort_num serve_type_sort_num,
|
||||
serve_item_id,
|
||||
item.name serve_item_name,
|
||||
item.serve_item_icon,
|
||||
item.img serve_item_img,
|
||||
item.detail_img,
|
||||
item.sort_num serve_item_sort_num,
|
||||
item.unit,
|
||||
serve.id,
|
||||
serve.sale_status,
|
||||
serve.city_code,
|
||||
serve.price,
|
||||
serve.is_hot,
|
||||
serve.hot_time_stamp
|
||||
FROM serve
|
||||
JOIN serve_item item ON serve.serve_item_id = item.id
|
||||
JOIN serve_type type ON item.serve_type_id = type.id
|
||||
WHERE serve.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user