更改返回结果集

master
shaowenhao 2023-11-21 22:14:07 +08:00
parent 2ebe1810d5
commit e707cc73d7
4 changed files with 17 additions and 160 deletions

View File

@ -2,11 +2,12 @@ package com.god.base.server.controller;
import com.god.base.server.common.domain.Car;
import com.god.base.server.common.domain.request.CarRequest;
import com.god.base.server.service.CarService;
import com.ruoyi.common.core.domain.R;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.god.common.core.domain.Result;
import java.util.List;
@ -25,11 +26,11 @@ public class CarController {
*
*/
@GetMapping("carList/{userId}")
public R<?> carList(@PathVariable String userId){
public Result<?> carList(@PathVariable String userId){
log.info("请求参数" + userId);
R<List<Car>> carList = carService.carList(userId);
Result<List<Car>> carList = carService.carList(userId);
log.info("响应参数" + carList);
return R.ok(carList);
return Result.success(carList);
}
@ -37,39 +38,39 @@ public class CarController {
*
*/
@PostMapping("/addCar")
public R<String> addCarP(@RequestBody @Validated CarRequest carRequest){
public Result<String> addCarP(@RequestBody @Validated CarRequest carRequest){
log.info("请求参数" + carRequest);
boolean save = carService.save(Car.addReqBuild(carRequest));
log.info("响应参数" + save);
return R.ok();
return Result.success();
}
/**
*
*/
@PostMapping("/updCar/{vinId}")
public R updCat(@PathVariable @Validated String vinId){
public Result updCat(@PathVariable @Validated String vinId){
log.info("请求参数" + vinId);
carService.updateById(vinId);
log.info("响应参数" + vinId);
return R.ok();
return Result.success();
}
/**
*
*/
@PostMapping("/delCar/{vinId}")
public R delCar(@PathVariable String vinId){
public Result delCar(@PathVariable String vinId){
log.info("请求参数" + vinId);
boolean b = carService.removeById(vinId);
log.info("响应参数" + b);
return R.ok();
return Result.success();
}
/**
*
*/
@PostMapping
public R sSgj(){
public Result sSgj(){
return null;
}

View File

@ -3,7 +3,7 @@ package com.god.base.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.god.base.server.common.domain.Car;
import com.ruoyi.common.core.domain.R;
import com.god.common.core.domain.Result;
import org.apache.ibatis.annotations.Param;
@ -15,7 +15,7 @@ import java.util.List;
public interface CarService extends IService<Car> {
R<List<Car>> carList(@Param("userId") String userId);
Result<List<Car>> carList(@Param("userId") String userId);
void updateById(@Param("vinId") String vinId);
}

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.server.common.domain.Car;
import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService;
import com.ruoyi.common.core.domain.R;
import com.god.common.core.domain.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -22,14 +22,14 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
private CarMapper carMapper;
@Override
public R<List<Car>> carList(String userId) {
public Result<List<Car>> carList(String userId) {
// Long userId1 = SecurityUtils.getUserId();
// if (null == userId1){
// throw new SecurityException("请先登录");
// }
int userId1 = 1;
List<Car> carList = carMapper.getList(userId1);
return R.ok(carList);
return Result.success(carList);
}

View File

@ -1,144 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<el-button type="primay" class="sub-btn" @click="handleStart">开始搭建围栏</el-button>
<div class="map-paint-box2" v-show="clockBox">
<button class="btn" onclick="startWrite">开始绘制</button>
<button class="btn" onclick="clearWrite()">清除</button>
<button class="btn" onclick="finishWrite">完成绘制</button>
<button class="btn" onclick="polyEditor.close()">结束编辑</button>
centers: ["116.400274 , 39.9322"],
</div>
<script>
var map = new AMap.Map("contatiner",{
center:[116.400274 , 39.905812],
zoom: 14,
viewMode: '2D',
});
//初始化地图
function initMap() {
throw AMapLoader.load({
key: "",//申请好的web端开发者key , 首次调用load时必填
version: "2.0",//指定要加载的JSAPI 的版本 , 缺省是默认
AMapUI: {
version: '1.1',
plugins: ['control/BasicControl']
}
}).then((AMap)=> {
new AMap.Map("container", {
resizeRnable: true,
zoom: 16,
center: [104.560921999, 31.45646]
});
}
//初始化围栏信息
function handleAStart(){
allPloy = []
//现从后端获取已经建立的围栏,展示在地图上存到curr
clickBox.value - true // z展示操作按钮
AMapLoader.load({
key:"",
version:"2.2",
plugins
})
});
//直接在地图建立新的围栏
let ployEditor;
ployEditor.on('add' , function (){
polyEditor.addAdsorbpolygons = function (polygon) {
};
polyEditor.addAdsorbpolygons(polygon);
var ployOverlays = []
ployOverlays.push(polygon)
allPloy.push(polygon)
var currentPoly = polygon
polygon.constructor('dblclick',()=>{
var polyOverlays = []
var currentPoly = polygon
polyEditor.setTarget = function (polygon) {
};
polyEditor.setTarget(polygon);
polyOverlays.push(polygon)
polyEditor.open();
}).cath(e=>{
console.log(e)
})
},
}
function clearWrite(){
allpoy.somee((one,index)=>{
if (one==currentPoly){
allPloy.push()
}
};
}
//多边形样式;
mouseTool.poltgon({
strokeColor:"#1E9FFF",
strokeWeight:2,
strokeStyle:'dashed',
strokeOpacity:1,
fillOpacity:1,
fillColor:'#1E9FFF',
zIndex:50,
});
//清除覆盖物
document.getElementsByName('func');
document.getElementById('clear').onclick=function ({
map.remove(overlays)
overlays = [];
})
</script>
</body>
</html>
<meta http-equiv="Accept">
<meta name="viewport" content="initial-scale=1.0">
<style>
#container{
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="5.html">
<script src="Test2.html"></script>
<div id="container">
<button class="btn" onclick="clearWrite()"></button>
<button class="btn" onclick="polyEditor()"></button>
</div>
<script>
var map =new map.AMapUI
center:21;
viewMode:'3D';
var path = [
[1241,134513];
[13451,13451],
[23q45,1234],
]
var polygon1 = new AMap.Polygon({
path:path1,
strokeColor:"green",
stroleWeight:6
,
strokeOpacity:0.2,
fillOpacity: 0.4,
fillColorL20,
bubble:true,
})
map.addAdsorbpolygons([path,polygon1])
// ..缩放地图到合适的视野级别
ployEditor.addAdsorbpolygons(polygon1)
polyEditor.open();
</script>