package com.moral.api.controller; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.moral.api.entity.BenchmarkWindConfig; import com.moral.api.pojo.dto.account.AccountDTO; import com.moral.api.pojo.dto.account.AccountQueryDTO; import com.moral.api.pojo.dto.accountRole.AccountRoleDTO; import com.moral.api.pojo.form.account.AccountDeleteForm; import com.moral.api.pojo.form.account.AccountInsertForm; import com.moral.api.pojo.form.account.AccountQueryForm; import com.moral.api.pojo.form.account.AccountUpdateForm; import com.moral.api.pojo.form.accountRole.AccountRoleUpdateForm; import com.moral.api.pojo.vo.account.AccountQueryVO; import com.moral.api.service.BenchmarkWindConfigService; import com.moral.api.service.ManageAccountRoleService; import com.moral.api.service.ManageAccountService; import com.moral.constant.ResponseCodeEnum; import com.moral.constant.ResultMessage; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; @Slf4j @Api(tags = {"风场模型基准信息"}) @RestController @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping("/benchmarkWindConfig") public class BenchmarkWindConfigController { @Resource private BenchmarkWindConfigService benchmarkWindConfigService; @PostMapping("insert") public ResultMessage insert(@RequestBody Map map) { if (ObjectUtils.isEmpty(map.get("name")) || ObjectUtils.isEmpty(map.get("benchmark")) || ObjectUtils.isEmpty(map.get("preservation")) || ObjectUtils.isEmpty(map.get("destinationTab")) || ObjectUtils.isEmpty(map.get("organizationId")) || ObjectUtils.isEmpty(map.get("regionCode"))){ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); } BenchmarkWindConfig benchmarkWindConfig = new BenchmarkWindConfig(); benchmarkWindConfig.setName(map.get("name").toString()); benchmarkWindConfig.setBenchmark(map.get("benchmark").toString()); benchmarkWindConfig.setPreservation(map.get("preservation").toString()); benchmarkWindConfig.setDestinationTab(map.get("destinationTab").toString()); benchmarkWindConfig.setOrganizationId(Integer.parseInt(map.get("organizationId").toString())); benchmarkWindConfig.setRegionCode(map.get("regionCode").toString()); Map resultMap = benchmarkWindConfigService.insert(benchmarkWindConfig); return ResultMessage.ok(); } }