Merge remote-tracking branch 'origin/master'

master
fst1996 2023-12-06 13:24:10 +08:00
commit 07f68c6f37
7 changed files with 34 additions and 34 deletions

View File

@ -55,7 +55,7 @@ public class CarController extends BaseController {
/** /**
* *
*/ */
@GetMapping("carList/{userId}") @GetMapping("/carList/{userId}")
public Result<?> carList(@PathVariable String userId){ public Result<?> carList(@PathVariable String userId){
log.info("功能介绍车辆信息列表查看,请求方式:{},请求路径:{},请求参数:{}", log.info("功能介绍车辆信息列表查看,请求方式:{},请求路径:{},请求参数:{}",
@ -71,7 +71,7 @@ public class CarController extends BaseController {
request.getRequestURL(), request.getRequestURL(),
JSONObject.toJSONString(carList)); JSONObject.toJSONString(carList));
return Result.success(carList); return carList;
} }
@ -136,7 +136,7 @@ public class CarController extends BaseController {
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response , Car car , CarRequest carRequest) public void export(HttpServletResponse response , Car car , CarRequest carRequest)
{ {
List<Car> list = carMapper.getList((int) car.getUserId()); List<Car> list = carMapper.getList(String.valueOf(car.getUserId()));
ExcelUtil<Car> util = new ExcelUtil<>(Car.class); ExcelUtil<Car> util = new ExcelUtil<>(Car.class);
//对list数据源将其里面的数据导入到excel表单 //对list数据源将其里面的数据导入到excel表单
util.exportExcel(response,list,"车辆信息管理"); util.exportExcel(response,list,"车辆信息管理");

View File

@ -1,18 +1,18 @@
package com.god.base.server.controller; package com.god.base.server.controller;
import com.god.base.domain.request.GetTopicReq; import com.god.base.domain.request.GetTopicReq;
import com.god.base.server.service.TopLineService;
import com.god.base.server.service.impl.TopLineServiceImpl; import com.god.base.server.service.impl.TopLineServiceImpl;
import com.god.common.core.domain.Result; import com.god.common.core.domain.Result;
import com.god.common.log.annotation.Log; import com.god.common.log.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 线 * @description: 线
* @Author fst * @Author fst
* @date 2023/11/28 23:38 * @date 2023/11/28 23:38
*/ */
@ -27,17 +27,10 @@ public class TopLineController {
* *
* @return * @return
*/ */
@PostMapping("getTopic") @PostMapping("/getTopic")
@Log(title = "获取主题") @Log(title = "获取主题")
public Result<String> getTopic(@RequestBody GetTopicReq getTopicReq){ public Result<String> getTopic(@RequestBody GetTopicReq getTopicReq){
String topic = topLineService.getTopic(getTopicReq); String topic = topLineService.getTopic(getTopicReq);
return Result.success(topic); return Result.success(topic);
} }
@GetMapping("getCarVinList")
@Log(title = "获取车辆vin列表")
public Result<List<String>> getCarVinList(){
List<String> carVinList = topLineService.getCarVinList();
return Result.success();
}
} }

View File

@ -19,21 +19,8 @@ import java.util.List;
@Mapper @Mapper
public interface CarMapper extends BaseMapper<Car> { public interface CarMapper extends BaseMapper<Car> {
@Select("SELECT\n" +
"t_car.car_vin_id ,\n" + List<Car> getList(@Param("userId") String userId);
"t_car_type.car_type_name , \n" +
"t_fence.fence_name , \n" +
"t_car.battery_manufacturer ,\n" +
"t_car.motor_manufacturer ,\n" +
"t_car.motor_number , \n" +
"t_car.battery_number ,\n" +
"t_car.status \n" +
"\n" +
"FROM\n" +
"\tt_car\n" +
"\tJOIN t_fence ON t_car.fence_id = t_fence.fence_id\n" +
"\tJOIN t_car_type ON t_car.car_type_id = t_car_type.id where t_car.user_id = #{userId1}")
List<Car> getList(@Param("userId1") int userId);
// @Select("select * from t_car where 1=1 " + // @Select("select * from t_car where 1=1 " +
// "<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" + // "<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" +

View File

@ -44,8 +44,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarSe
// if (null == userId1){ // if (null == userId1){
// throw new SecurityException("请先登录"); // throw new SecurityException("请先登录");
// } // }
int userId1 = 1; List<Car> carList = carMapper.getList(userId);
List<Car> carList = carMapper.getList(userId1);
return Result.success(carList); return Result.success(carList);
} }

View File

@ -7,7 +7,6 @@ import com.god.base.domain.Car;
import com.god.base.domain.HisPath; import com.god.base.domain.HisPath;
import com.god.base.domain.TopicCar; import com.god.base.domain.TopicCar;
import com.god.base.domain.request.GetTopicReq; import com.god.base.domain.request.GetTopicReq;
import com.god.base.server.mapper.CarMapper;
import com.god.base.server.mapper.TopicCarMapper; import com.god.base.server.mapper.TopicCarMapper;
import com.god.base.server.service.TopLineService; import com.god.base.server.service.TopLineService;
import com.god.common.core.exception.ServiceException; import com.god.common.core.exception.ServiceException;

View File

@ -29,11 +29,12 @@ import java.util.Set;
@Log4j2 @Log4j2
public class CarFenceMonitor { public class CarFenceMonitor {
@Autowired @Autowired
private CarService carService; private CarService carService;
@Autowired @Autowired
private FenceService fenceService; private FenceService fenceService;
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@ -43,7 +44,7 @@ public class CarFenceMonitor {
log.info("开始获取车辆围栏信息"); log.info("开始获取车辆围栏信息");
//获取车辆信息 //获取车辆信息
Result<List<Car>> listResult = carService.carList(String.valueOf(SecurityUtils.getUserId())); Result<List<Car>> listResult = carService.carList(null);
List<Car> dataCar = listResult.getData(); List<Car> dataCar = listResult.getData();
if (dataCar.size() <= 0) { if (dataCar.size() <= 0) {

View File

@ -68,4 +68,25 @@
<select id="carTypeId" resultType="com.god.base.domain.CarType"> <select id="carTypeId" resultType="com.god.base.domain.CarType">
select * from t_car_type select * from t_car_type
</select> </select>
<select id="getList" resultType="com.god.base.domain.Car">
SELECt
t_car.car_vin_id ,
t_car_type.car_type_name ,
t_fence.fence_name ,
t_car.battery_manufacturer ,
t_car.motor_manufacturer ,
t_car.motor_number ,
t_car.battery_number ,
t_car.status
FROM
t_car
JOIN t_fence ON t_car.fence_id = t_fence.fence_id
JOIN t_car_type ON t_car.car_type_id = t_car_type.id
<where>
<if test="userId != null">
and t_car.user_id = #{userId}
</if>
</where>
</select>
</mapper> </mapper>