|
@@ -0,0 +1,114 @@
|
|
|
+package com.museum.web.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.museum.common.util.Result;
|
|
|
+import com.museum.domain.entity.StructureEntity;
|
|
|
+import com.museum.domain.request.NavRequest;
|
|
|
+import com.museum.domain.request.StructurePageRequest;
|
|
|
+import com.museum.domain.request.StructureRequest;
|
|
|
+import com.museum.domain.response.RoamResponse;
|
|
|
+import com.museum.service.StructureService;
|
|
|
+import com.museum.web.aop.WebControllerLog;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by owen on 2020/5/9 0018 12:17
|
|
|
+ */
|
|
|
+@Log4j2
|
|
|
+@Api(tags = "结构模型管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("manage/structure")
|
|
|
+@Transactional
|
|
|
+public class StructureController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public StructureService structureService;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("列表/条件筛选")
|
|
|
+ @PostMapping("list")
|
|
|
+ public Result<StructureEntity> list(@Valid @RequestBody StructurePageRequest param) {
|
|
|
+ startPage(param);
|
|
|
+ PageInfo<StructureEntity> page = new PageInfo<>(structureService.findBySearch(param));
|
|
|
+ return Result.success(page);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @WebControllerLog(description = "结构模型管理-新增/修改")
|
|
|
+ @ApiOperation("新增/修改")
|
|
|
+ @PostMapping("save")
|
|
|
+ public Result save(@Valid @RequestBody StructureRequest param) {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 墙立面类型,displayModel:0
|
|
|
+ * 漫游, displayModel:2
|
|
|
+ *
|
|
|
+ * 墙立面展示:模型URL
|
|
|
+ * 场景漫游:四维看看场景URL
|
|
|
+ */
|
|
|
+
|
|
|
+ StructureEntity entity = null;
|
|
|
+ Long id = param.getId();
|
|
|
+ if (id == null) {
|
|
|
+ entity = new StructureEntity();
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
+ structureService.save(entity);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ entity = structureService.findById(id);
|
|
|
+ if (entity == null) {
|
|
|
+ log.error("对象不存在: {}", id);
|
|
|
+ return Result.failure("对象不存在");
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
+ structureService.update(entity);
|
|
|
+
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("详情")
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
+ public Result<RoamResponse> detail(@PathVariable Long id) {
|
|
|
+ StructureEntity entity = structureService.findById(id);
|
|
|
+
|
|
|
+ if (entity == null) {
|
|
|
+ log.error("对象不存在: {}", id);
|
|
|
+ return Result.failure("对象不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.success(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @WebControllerLog(description = "结构模型管理-删除")
|
|
|
+ @ApiOperation("删除")
|
|
|
+ @GetMapping("removes/{ids}")
|
|
|
+ public Result removes(@PathVariable String ids){
|
|
|
+ if (StringUtils.isNotBlank(ids)) {
|
|
|
+ structureService.deleteByIds(ids);
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|