|
@@ -6,17 +6,22 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.dliyun.oap.framework.annotation.ServiceMethod;
|
|
import com.dliyun.oap.framework.annotation.ServiceMethod;
|
|
|
import com.dliyun.oap.framework.annotation.ServiceMethodBean;
|
|
import com.dliyun.oap.framework.annotation.ServiceMethodBean;
|
|
|
import com.dliyun.oap.framework.response.OapResponse;
|
|
import com.dliyun.oap.framework.response.OapResponse;
|
|
|
|
|
+import com.zhiqiyun.open.annotation.Permission;
|
|
|
import com.zhiqiyun.open.core.models.category.CategoryOccupation;
|
|
import com.zhiqiyun.open.core.models.category.CategoryOccupation;
|
|
|
import com.zhiqiyun.open.core.models.place.PlaceBaseInfo;
|
|
import com.zhiqiyun.open.core.models.place.PlaceBaseInfo;
|
|
|
import com.zhiqiyun.open.core.models.place.PlaceCategory;
|
|
import com.zhiqiyun.open.core.models.place.PlaceCategory;
|
|
|
import com.zhiqiyun.open.core.service.PlaceBaseInfoService;
|
|
import com.zhiqiyun.open.core.service.PlaceBaseInfoService;
|
|
|
import com.zhiqiyun.open.core.service.PlaceCategoryService;
|
|
import com.zhiqiyun.open.core.service.PlaceCategoryService;
|
|
|
|
|
+import com.zhiqiyun.open.mvc.Result;
|
|
|
|
|
+import com.zhiqiyun.open.mvc.params.place.QueryPlaceCategoryParam;
|
|
|
import com.zhiqiyun.open.router.request.category.CategoryOccupationRequest;
|
|
import com.zhiqiyun.open.router.request.category.CategoryOccupationRequest;
|
|
|
import com.zhiqiyun.open.router.request.place.CategoryRequest;
|
|
import com.zhiqiyun.open.router.request.place.CategoryRequest;
|
|
|
import com.zhiqiyun.open.router.request.place.PlaceInfoRequest;
|
|
import com.zhiqiyun.open.router.request.place.PlaceInfoRequest;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -24,47 +29,62 @@ import java.util.List;
|
|
|
@ServiceMethodBean
|
|
@ServiceMethodBean
|
|
|
public class PlaceApi {
|
|
public class PlaceApi {
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private PlaceCategoryService placeCategoryService;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private PlaceBaseInfoService placeBaseInfoService;
|
|
|
|
|
-
|
|
|
|
|
- @ServiceMethod(method = "list.place.category", title = "查询文旅场所分类")
|
|
|
|
|
- public OapResponse listPlaceCategory(CategoryRequest request) {
|
|
|
|
|
- QueryWrapper<PlaceCategory> wrapper = new QueryWrapper<>();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
- wrapper.like("name", request.getName());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- wrapper.orderByDesc("sort_number");
|
|
|
|
|
- wrapper.orderByDesc("id");
|
|
|
|
|
-
|
|
|
|
|
- List<PlaceCategory> listData = this.placeCategoryService.list(wrapper);
|
|
|
|
|
-
|
|
|
|
|
- return OapResponse.success().setBody(listData);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ServiceMethod(method = "list.place.info.page", title = "查询文旅场所")
|
|
|
|
|
- public OapResponse listPlaceInfoPage(PlaceInfoRequest request) {
|
|
|
|
|
- QueryWrapper<PlaceBaseInfo> wrapper = new QueryWrapper<>();
|
|
|
|
|
-
|
|
|
|
|
- if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
- wrapper.like("name", request.getName());
|
|
|
|
|
- }
|
|
|
|
|
- Page<PlaceBaseInfo> page = new Page<>(request.getCurrent(), request.getPageSize());
|
|
|
|
|
-
|
|
|
|
|
- page.addOrder(OrderItem.desc("id"));
|
|
|
|
|
-
|
|
|
|
|
- Page<PlaceBaseInfo> resultData = this.placeBaseInfoService.page(page, wrapper);
|
|
|
|
|
-
|
|
|
|
|
- for (PlaceBaseInfo baseInfo : resultData.getRecords()) {
|
|
|
|
|
- PlaceCategory category = this.placeCategoryService.getById(baseInfo.getCategoryId());
|
|
|
|
|
- baseInfo.setCategory(category);
|
|
|
|
|
- }
|
|
|
|
|
- return OapResponse.success().setBody(resultData);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PlaceCategoryService placeCategoryService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PlaceBaseInfoService placeBaseInfoService;
|
|
|
|
|
+
|
|
|
|
|
+ @ServiceMethod(method = "list.place.category", title = "查询文旅场所分类")
|
|
|
|
|
+ public OapResponse listPlaceCategory(CategoryRequest request) {
|
|
|
|
|
+ QueryWrapper<PlaceCategory> wrapper = new QueryWrapper<>();
|
|
|
|
|
+ if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
+ wrapper.like("name", request.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (request.getIsShow() != null) {
|
|
|
|
|
+ wrapper.eq("is_show", request.getIsShow());
|
|
|
|
|
+ }
|
|
|
|
|
+ wrapper.orderByDesc("sort_number");
|
|
|
|
|
+ wrapper.orderByDesc("id");
|
|
|
|
|
+ List<PlaceCategory> listData = this.placeCategoryService.list(wrapper);
|
|
|
|
|
+ return OapResponse.success().setBody(listData);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ServiceMethod(method = "list.place.category.page", title = "查询文旅场所分类分页")
|
|
|
|
|
+ public Result listPlaceCategoryPage(@RequestBody CategoryRequest request) {
|
|
|
|
|
+ QueryWrapper<PlaceCategory> wrapper = new QueryWrapper<>();
|
|
|
|
|
+ if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
+ wrapper.like("name", request.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (request.getIsShow() != null) {
|
|
|
|
|
+ wrapper.eq("is_show", request.getIsShow());
|
|
|
|
|
+ }
|
|
|
|
|
+ Page<PlaceCategory> page = new Page<>(request.getCurrent(), request.getPageSize());
|
|
|
|
|
+ page.addOrder(OrderItem.asc("sort_number"));
|
|
|
|
|
+ page.addOrder(OrderItem.desc("id"));
|
|
|
|
|
+ Page<PlaceCategory> resultData = this.placeCategoryService.page(page, wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ return Result.instance(Result.Code.SUCCESS).setData(resultData);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ServiceMethod(method = "list.place.info.page", title = "查询文旅场所")
|
|
|
|
|
+ public OapResponse listPlaceInfoPage(PlaceInfoRequest request) {
|
|
|
|
|
+ QueryWrapper<PlaceBaseInfo> wrapper = new QueryWrapper<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isNotBlank(request.getName())) {
|
|
|
|
|
+ wrapper.like("name", request.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ Page<PlaceBaseInfo> page = new Page<>(request.getCurrent(), request.getPageSize());
|
|
|
|
|
+
|
|
|
|
|
+ page.addOrder(OrderItem.desc("id"));
|
|
|
|
|
+
|
|
|
|
|
+ Page<PlaceBaseInfo> resultData = this.placeBaseInfoService.page(page, wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ for (PlaceBaseInfo baseInfo : resultData.getRecords()) {
|
|
|
|
|
+ PlaceCategory category = this.placeCategoryService.getById(baseInfo.getCategoryId());
|
|
|
|
|
+ baseInfo.setCategory(category);
|
|
|
|
|
+ }
|
|
|
|
|
+ return OapResponse.success().setBody(resultData);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|