feat():添加查询车辆类型方法

dev
SuiXxx 2024-09-22 11:32:13 +08:00
parent cf7c7efddd
commit e48a7cf352
6 changed files with 55 additions and 0 deletions

View File

@ -2,12 +2,15 @@ package com.muyu.controller;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.domain.CarType; import com.muyu.domain.CarType;
import com.muyu.domain.resp.CarTypeResp;
import com.muyu.service.CarTypeService; import com.muyu.service.CarTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping("/carType") @RequestMapping("/carType")
@ -22,5 +25,10 @@ public class CarTypeController {
} }
@GetMapping("/selectCarTypeRespList")
public Result selectCarTypeRespList() {
return Result.success(carTypeService.selectCarTypeRespList());
}
} }

View File

@ -0,0 +1,19 @@
package com.muyu.domain.resp;
import com.muyu.common.core.annotation.Excel;
import com.muyu.domain.CarType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CarTypeResp extends CarType {
/** 报文模版id */
@Excel(name = "报文模版名称")
private String templateName;
}

View File

@ -2,8 +2,12 @@ package com.muyu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.CarType; import com.muyu.domain.CarType;
import com.muyu.domain.resp.CarTypeResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
public interface CarTypeMapper extends BaseMapper<CarType> { public interface CarTypeMapper extends BaseMapper<CarType> {
List<CarTypeResp> selectCarTypeRespList();
} }

View File

@ -2,6 +2,7 @@ package com.muyu.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.CarType; import com.muyu.domain.CarType;
import com.muyu.domain.resp.CarTypeResp;
import com.muyu.mapper.CarTypeMapper; import com.muyu.mapper.CarTypeMapper;
import java.util.List; import java.util.List;
@ -10,4 +11,6 @@ import java.util.List;
public interface CarTypeService extends IService<CarType> { public interface CarTypeService extends IService<CarType> {
List<CarType> selectCarTypeList(); List<CarType> selectCarTypeList();
List<CarTypeResp> selectCarTypeRespList();
} }

View File

@ -3,6 +3,7 @@ package com.muyu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.domain.CarType; import com.muyu.domain.CarType;
import com.muyu.domain.resp.CarTypeResp;
import com.muyu.mapper.CarTypeMapper; import com.muyu.mapper.CarTypeMapper;
import com.muyu.service.CarTypeService; import com.muyu.service.CarTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -19,4 +20,9 @@ private CarTypeMapper carTypeMapper;
QueryWrapper<CarType> carTypeQueryWrapper = new QueryWrapper<>(); QueryWrapper<CarType> carTypeQueryWrapper = new QueryWrapper<>();
return carTypeMapper.selectList(carTypeQueryWrapper); return carTypeMapper.selectList(carTypeQueryWrapper);
} }
@Override
public List<CarTypeResp> selectCarTypeRespList() {
return carTypeMapper.selectCarTypeRespList();
}
} }

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.mapper.CarTypeMapper">
<select id="selectCarTypeRespList" resultType="com.muyu.domain.resp.CarTypeResp">
SELECT
*,
t_template.template_name
FROM
car_type
LEFT JOIN t_template ON car_type.template_id = t_template.template_id
</select>
</mapper>