车辆列表更新

master
one 2023-12-05 20:40:45 +08:00
parent 4fbc46febb
commit ca1338c939
7 changed files with 27 additions and 20 deletions

View File

@ -136,7 +136,7 @@ public class CarController extends BaseController {
@PostMapping("/export")
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);
//对list数据源将其里面的数据导入到excel表单
util.exportExcel(response,list,"车辆信息管理");

View File

@ -27,7 +27,7 @@ public class TopLineController {
*
* @return
*/
@PostMapping("getTopic")
@PostMapping("/getTopic")
@Log(title = "获取主题")
public Result<String> getTopic(@RequestBody GetTopicReq getTopicReq){
String topic = topLineService.getTopic(getTopicReq);

View File

@ -19,21 +19,8 @@ import java.util.List;
@Mapper
public interface CarMapper extends BaseMapper<Car> {
@Select("SELECT\n" +
"t_car.car_vin_id ,\n" +
"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 = #{userId}")
List<Car> getList(@Param("userId") int userId);
List<Car> getList(@Param("userId") String userId);
// @Select("select * from t_car where 1=1 " +
// "<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" +

View File

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

View File

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.domain.Car;
import com.god.base.domain.TopicCar;
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.service.TopLineService;
import com.god.common.core.exception.ServiceException;

View File

@ -44,7 +44,7 @@ public class CarFenceMonitor {
log.info("开始获取车辆围栏信息");
//获取车辆信息
Result<List<Car>> listResult = carService.carList(String.valueOf(SecurityUtils.getUserId()));
Result<List<Car>> listResult = carService.carList(null);
List<Car> dataCar = listResult.getData();
if (dataCar.size() <= 0) {

View File

@ -68,4 +68,25 @@
<select id="carTypeId" resultType="com.god.base.domain.CarType">
select * from t_car_type
</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>