|
@@ -0,0 +1,76 @@
|
|
|
+package com.huaxu.controller;
|
|
|
+
|
|
|
+import com.huaxu.entity.MapSetting;
|
|
|
+import com.huaxu.model.AjaxMessage;
|
|
|
+import com.huaxu.model.LoginUser;
|
|
|
+import com.huaxu.model.ResultStatus;
|
|
|
+import com.huaxu.service.MapSettingService;
|
|
|
+import com.huaxu.util.UserUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 地图设置控制层
|
|
|
+ *
|
|
|
+ * @author yjy
|
|
|
+ * @since 2020-12-4
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mapSetting")
|
|
|
+@Api(tags = "地图设置")
|
|
|
+public class MapSettingController {
|
|
|
+ /**
|
|
|
+ * 服务对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private MapSettingService mapSettingService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据机构查询地图设置数据
|
|
|
+ *
|
|
|
+ * @param sceneTypeName 一级场景类型名称
|
|
|
+ * @return 单条数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "selectMap", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "查询用户单条地图配置数据")
|
|
|
+ public AjaxMessage<MapSetting> selectMap(
|
|
|
+ @ApiParam(value = "一级场景类型名称", required = true) @RequestParam String sceneTypeName) {
|
|
|
+ if(sceneTypeName==null) {
|
|
|
+ return new AjaxMessage<>(ResultStatus.PARAM_ERROR);
|
|
|
+ }
|
|
|
+ LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
+ Integer userId=currentUser.getId();
|
|
|
+ MapSetting result = mapSettingService.selectMap(sceneTypeName,userId);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 保存地图配置数据
|
|
|
+ *
|
|
|
+ * @param mapSetting 地图设置信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "saveSystem", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "保存单条地图配置数据")
|
|
|
+ public AjaxMessage<Boolean> saveSystem(
|
|
|
+ @ApiParam(value = "地图设置信息", required = true) @RequestBody MapSetting mapSetting) {
|
|
|
+ LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
+ MapSetting idSetting= mapSettingService.selectMap(mapSetting.getSceneTypeName(),currentUser.getId());
|
|
|
+ Integer mapId=idSetting != null?idSetting.getId():null;
|
|
|
+ Integer id = mapSetting.getId() != null?mapSetting.getId():mapId;
|
|
|
+ mapSetting.setUserId(currentUser.getId());
|
|
|
+ if(id==null){//没有查询到数据则新增
|
|
|
+ mapSetting.setCreateBy(currentUser.getUsername());
|
|
|
+ }else {//修改
|
|
|
+ mapSetting.setId(id);
|
|
|
+ mapSetting.setUpdateBy(currentUser.getUsername());
|
|
|
+ }
|
|
|
+ mapSetting.setStatus(1);
|
|
|
+ boolean result = mapSettingService.saveMap(mapSetting);
|
|
|
+
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|