1.将MyBatis编写方式更改成MyBatisPlus

2.后台测试成功
更新时间09292247
dev.entOperation
微醺 2024-09-29 22:47:40 +08:00
parent a51f80aa00
commit a7b8987be4
27 changed files with 275 additions and 328 deletions

View File

@ -31,4 +31,5 @@ public class CarCompany {
*
*/
private String companyName;
}

View File

@ -29,20 +29,17 @@ public class CarConfig {
@TableId(value = "config_id",type = IdType.AUTO)
private Long configId;
/**
* 1. 2. 3.
*
*/
private String configName;
/**
*
* 1. 2. 3.
*/
private String energyType;
private Integer energyType;
/**
* 1. 2.
*/
private Integer gearType;
/**
* id
*/
private Integer companyId;
}

View File

@ -73,7 +73,7 @@ public class CarManage {
/**
* 线 1. 2. 3.
*/
private Integer carStayus;
private Integer carStatus;
/**
*
*/
@ -90,7 +90,7 @@ public class CarManage {
/**
*
*/
private String cardDrand;
private String carBrand;
/** 最后一次连线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -106,9 +106,6 @@ public class CarManage {
* id
*/
private Long companyId;
/**
* 1.轿 2. 3. 4. 5. 6.
*/
private Integer carType;
}

View File

@ -19,21 +19,17 @@ public class CarDTO {
* VIN
*/
private String carVin;
/**
*
*
*/
private String typeName;
private Long companyId;
/**
* 1. 2. 3.
*/
@TableField(exist = false)
private Integer energyType;
/**
* 1. 2.
*/
@TableField(exist = false)
private Integer gearType;
private Integer pageNum = 1;

View File

@ -31,7 +31,7 @@ public class CarVO {
/**
*
*/
private String carCoed;
private String carCode;
/**
* 1. 2.绿 3. 4. 5.
*/
@ -47,7 +47,7 @@ public class CarVO {
/**
*
*/
private Integer typeId;
private Long configId;
/**
*
*/
@ -96,14 +96,16 @@ public class CarVO {
/** 所属企业 */
private Long companyId;
/** 车辆车型(如客车,卡车,公交车等) */
private String carType;
// /** 车辆车型(如客车,卡车,公交车等) */
// private String carType;
/**
*
*
*/
@TableField(exist = false)
private String typeName;
private String configName;
/**
* 1. 2. 3.

View File

@ -18,7 +18,7 @@ import java.util.List;
* @Date 2024/9/28 16:52
*/
@RestController
@RequestMapping("/company")
@RequestMapping("/carCompany")
@Tag(name = "CarCompanyController", description = "企业表")
public class CarCompanyController extends BaseController {
@ -38,7 +38,7 @@ public class CarCompanyController extends BaseController {
*/
@PostMapping("selectCompanyByCompanyId")
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){
return Result.success(sysCarCompanyService.getById(companyId));
return Result.success(sysCarCompanyService.selectCompanyByCompanyId(companyId));
}
}

View File

@ -0,0 +1,44 @@
package com.muyu.enterprise.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* --
* @ClassName CarCompanyController
* @Description Controller
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
@RestController
@RequestMapping("/carConfig")
@Tag(name = "CarConfigController", description = "车辆配置")
public class CarConfigController extends BaseController {
@Autowired
private CarConfigService carConfigService;
/**
* configId
* @param configId
* @return
*/
@PostMapping("selectByConfigId")
public Result selectByConfigId(@RequestParam("configId") Long configId){
return Result.success(carConfigService.selectByConfigId(configId));
}
}

View File

@ -38,12 +38,22 @@ public class CarManageController extends BaseController {
/**
* 2
*
* @param carDTO
* @return
*/
@PostMapping("carListShow2")
public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
return Result.success(sysCarService.carListShow2(carDTO));
}
/**
*
* @param carDTO
* @return
*/
@PostMapping("CarListShow")
public Result<List<CarManage>> CarListShow(@RequestBody CarDTO carDTO){
public Result<List<CarVO>> CarListShow(@RequestBody CarDTO carDTO){
return Result.success(sysCarService.CarListShow(carDTO));
}
@ -57,18 +67,6 @@ public class CarManageController extends BaseController {
return Result.success(sysCarService.getById(carId));
}
// /**
// * 车辆列表1
// * @param carVO
// * @return
// */
// @PostMapping("CarList")
// @Operation(summary = "查询列表",description = "车辆管理列表")
// public Result<TableDataInfo<CarManage>> CarList(@RequestBody CarVO carVO){
// startPage();
// return getDataTable(sysCarService.carList(carVO));
// }
/**
*

View File

@ -41,8 +41,7 @@ public class CarMessageController extends BaseController {
*/
@GetMapping("/selectByTemplateId")
private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) {
return Result.success(sysCarMessageService.list
(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
return Result.success(sysCarMessageService.list(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
}
/**

View File

@ -32,21 +32,17 @@ public class CarMessageTypeController extends BaseController {
*/
@PostMapping("messageTypeList")
public Result messageTypeList(){
sysCarMessageTypeService.messageTypeList();
List<CarMessageType> list = sysCarMessageTypeService.list();
return Result.success(list);
}
/**
*
* @param carMessageType
* @return
*/
@PostMapping("inserMessageType")
public Result inserMessageType(@RequestBody CarMessageType carMessageType){
/** id 检验 */
if(carMessageType.getMessageTypeId()>0){
return Result.error("添加要什么id");
}
/** token 检验 */
if(SecurityUtils.getToken().isEmpty()){
return Result.error("token不为空");
}
/** 报文类型 */
if(StringUtils.isEmpty(carMessageType.getMessageType())){
return Result.error("报文类型不能为空");
@ -74,13 +70,21 @@ public class CarMessageTypeController extends BaseController {
*/
@PostMapping("updateMessageType")
public Result updateMessageType(@RequestBody CarMessageType carMessageType){
/** id */
if(carMessageType.getMessageTypeId() < 0 ){
return Result.error("修改需要id");
/** 报文类型 */
if(StringUtils.isEmpty(carMessageType.getMessageType())){
return Result.error("报文类型不能为空");
}
/** 报文编号 */
/** 报文 */
if(StringUtils.isEmpty(carMessageType.getMessageName())){
return Result.error("报文不能为空");
}
/** 报文编码 */
if(StringUtils.isEmpty(carMessageType.getMessageCode())){
return Result.error("");
return Result.error("报文编码不能为空");
}
/** 报文字段类型 */
if(StringUtils.isEmpty(carMessageType.getMessageClass())){
return Result.error("报文字段类型不能为空");
}
sysCarMessageTypeService.updateById(carMessageType);
return Result.success("修改成功");

View File

@ -0,0 +1,22 @@
package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.vo.CarVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* --
* @ClassName CarManageMapper
* @Description Mapper
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
public interface CarConfigMapper extends MPJBaseMapper<CarConfig> {
}

View File

@ -2,9 +2,12 @@ package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -16,26 +19,7 @@ import java.util.List;
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
@Mapper
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
public interface CarManageMapper extends BaseMapper<CarManage> {
/**
*
* @param queryWrapper
* @return
*/
List<CarVO> carList(LambdaQueryWrapper<CarVO> queryWrapper);
/**
* 2
* @param carDTO
* @return
*/
List<CarVO> CarListShow(CarDTO carDTO);
/**
* id
* @param carId
* @return
*/
List<CarVO> CarListShowByCarId(@Param("carId") Long carId);
}

View File

@ -14,10 +14,5 @@ import java.util.List;
*/
@Mapper
public interface CarMessageMapper extends BaseMapper<CarMessage> {
/**
*
* @param templateId
* @return
*/
List<CarMessage> selectMessageShow(Long templateId);
}

View File

@ -14,9 +14,5 @@ import java.util.List;
*/
@Mapper
public interface CarTemplateMapper extends BaseMapper<CarTemplate> {
/**
*
* @return
*/
List<CarTemplate> selectTemplateShow();
}

View File

@ -10,11 +10,13 @@ import com.muyu.enterprise.domain.CarCompany;
* @Date 2024/9/28 16:52
*/
public interface CarCompanyService extends IService<CarCompany> {
/**
*
*
* @param companyId
* @return
*/
//List<CarCompany> selectCompany();
CarCompany selectCompanyByCompanyId(Long companyId);
}

View File

@ -0,0 +1,25 @@
package com.muyu.enterprise.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import java.util.List;
/**
* --
* @ClassName CarConfigService
* @Description Service
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
public interface CarConfigService extends IService<CarConfig> {
/**
* configId
* @param configId
* @return
*/
CarConfig selectByConfigId(Long configId);
}

View File

@ -14,37 +14,22 @@ import java.util.List;
* @Date 2024/9/28 16:52
*/
public interface CarManageService extends IService<CarManage> {
// /**
// * 车辆列表
// * @param carVO
// * @return
// */
// List<CarManage> carList(CarVO carVO);
//
// /**
// * 车辆添加
// * @param carVO
// */
// void insertCar(CarVO carVO);
//
// /**
// * 车辆删除
// * @param ids
// */
// void deleteCar(List<Long> ids);
//
//
/**
* 2
* @param carDTO
* @return
*/
List<CarManage> CarListShow(CarDTO carDTO);
//
// /**
// * 通过id查询
// * @param carId
// * @return
// */
// List<CarVO> CarListShowByCarId(Long carId);
List<CarVO> carListShow2(CarDTO carDTO);
/**
*
* @param carDTO
* @return
*/
List<CarVO> CarListShow(CarDTO carDTO);
}

View File

@ -12,5 +12,5 @@ import java.util.List;
* @Date 2024/9/28 16:52
*/
public interface CarMessageTypeService extends IService<CarMessageType> {
List<CarMessageType> messageTypeList();
}

View File

@ -29,11 +29,17 @@ public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarComp
@Autowired
private RedisService redisService;
@Autowired
private CarCompanyMapper sysCarCompanyMapper;
private CarCompanyMapper carCompanyMapper;
/**
*
* @param companyId
* @return
*/
@Override
public CarCompany selectCompanyByCompanyId(Long companyId) {
return carCompanyMapper.selectById(companyId);
}
// @Override
// public List<CarCompany> selectCompany() {
// return sysCarCompanyMapper.;
// }
}

View File

@ -0,0 +1,45 @@
package com.muyu.enterprise.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.mapper.CarConfigMapper;
import com.muyu.enterprise.mapper.CarManageMapper;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import com.muyu.enterprise.service.CarManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* --
* @ClassName CarConfigServiceImpl
* @Description ServiceImpl
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
@Service
public class CarConfigServiceImpl extends ServiceImpl<CarConfigMapper, CarConfig>
implements CarConfigService {
@Autowired
private CarConfigMapper carConfigMapper;
/**
* configId
* @param configId
* @return
*/
@Override
public CarConfig selectByConfigId(Long configId) {
CarConfig carConfig = carConfigMapper.selectById(configId);
return carConfig;
}
}

View File

@ -2,21 +2,25 @@ package com.muyu.enterprise.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.controller.CarCompanyController;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.mapper.CarManageMapper;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import com.muyu.enterprise.service.CarManageService;
import com.muyu.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -30,122 +34,56 @@ import java.util.List;
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
implements CarManageService {
// @Autowired
// private RedisService redisService;
// @Autowired
// private CarManageMapper carMapper;
// // 企业 service
// @Autowired
// private CarCompanyService carCompanyService;
// /**
// * 车辆列表
// * @param carVO
// * @return
// */
// @Override
// public List<CarVO> carList(CarVO carVO) {
//
//// MPJLambdaWrapper<CarVO> queryWrapper = new MPJLambdaWrapper<>();
//// carMapper.selectJoinList(CarVO.class,
//// queryWrapper.selectAll(CarVO.class)// 主表查询所有
//// .select(Type::getTypeName)// 获取附表的字段
//// .select(Type::getEnergyType)
//// .select(Type::getGearType)
//// .leftJoin(Type.class,Type::getTypeId,Car::getTypeId)// 左链接
//// );
//// // vin码--精确
//// if(StringUtils.isNotEmpty(carVO.getCarVin())){
//// queryWrapper.eq(CarVO::getCarVin,carVO.getCarVin());
//// }
//// // 车辆型号
//// if(StringUtils.isNotEmpty(carVO.getTypeName())){
//// queryWrapper.like(CarVO::getTypeName,carVO.getTypeName());
//// }
//// // 能源类型 1.电动 2.纯油 3.混动
//// if(carVO.getEnergyType()>0){
//// queryWrapper.eq(CarVO::getEnergyType,carVO.getEnergyType());
//// }
//// // 档的类型 1.手动 2.自动
//// if(carVO.getGearType()>0){
//// queryWrapper.eq(CarVO::getGearType,carVO.getGearType());
//// }
//// // 自定义列表查询
////// @Select("")
////// this.list(queryWrapper);
//// // mybatis列表查询
//// //return carMapper.carList(queryWrapper);
//// // 单表的列表查询
//// this.list(
//// new LambdaQueryWrapper<CarVO>()
//// .eq(StringUtils.isNotEmpty(carVO.getCarVin()),CarVO::getCarVin,carVO.getCarVin())
//// .eq(carVO.getEnergyType()>0,CarVO::getEnergyType,carVO.getEnergyType())
//// .eq(carVO.getGearType()>0,CarVO::getGearType,carVO.getGearType())
//// .like(StringUtils.isNotEmpty(carVO.getTypeName()),CarVO::getTypeName,carVO.getTypeName())
//// );
//// return this.list(queryWrapper);
// return null;
// }
//
// /**
// * 车辆添加
// * @param carVO
// */
// @Override
// public void insertCar(CarVO carVO) {
// carMapper.insert(carVO);
// }
//
//// /**
//// * 车辆修改
//// * @param carVO
//// */
//// @Override
//// public void updataCar(CarVO carVO) {
//// carMapper.updateById(carVO);
//// }
//
@Autowired
private CarCompanyService carCompanyService;
@Autowired
private CarConfigService carConfigService;
@Autowired
private CarManageMapper carManageMapper;
/**
* 2
* @param carDTO
* @return
*/
@Override
public List<CarManage> CarListShow(CarDTO carDTO) {
// 获取 企业
// CarCompanyController carCompanyController = new CarCompanyController();
public List<CarVO> carListShow2(CarDTO carDTO) {
// 获取 企业
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
return lambdaQuery()
.eq(StringUtils.isNotEmpty(carManage.getCarVin()), CarManage::getCarVin, carManage.getCarVin())
.eq(carManage.getConfigId() > 0, CarManage::getCarVin, carManage.getConfigId())
List<CarManage> list = lambdaQuery()
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
.eq(carManage.getConfigId() > 0, CarManage::getConfigId, carManage.getConfigId())
.list();
// list.forEach(carManage1 -> {
// // 获取 企业 id
// carCompanyController.selectCompanyByCompanyId(carManage1.getCompanyId());
// });
//
// List<CarCompany> data = carCompanyController.selectCompany().getData();
// getById()
// List<CarManage> list = list();
// 把 查询出来的车辆数据 copy 到 CarVO
List<CarVO> carVOS = BeanUtil.copyToList(list, CarVO.class);
// 遍历赋值
carVOS.forEach(carVO -> {
// 查询出对象,用于赋值
CarConfig carConfig = carConfigService.selectByConfigId(carVO.getConfigId());
carVO.setConfigName(carConfig.getConfigName());
carVO.setEnergyType(carConfig.getEnergyType());
carVO.setGearType(carConfig.getGearType());
// 查询出对象,用于赋值
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getCompanyId());
carVO.setCompanyName(carCompany.getCompanyName());
});
return carVOS;
}
@Override
public List<CarVO> CarListShow(CarDTO carDTO) {
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
.selectAll(CarManage.class) // 查询所有车辆表
.select(CarCompany::getCompanyName)
.select(CarConfig::getConfigName)
.select(CarConfig::getGearType)
.select(CarConfig::getEnergyType)
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
.leftJoin(CarCompany.class, CarCompany::getCompanyId, CarManage::getCompanyId)
);
}
//
// /**
// * 通过id查询
// * @param carId
// * @return
// */
// @Override
// public CarManage CarListShowByCarId(Long carId) {
// return carMapper.CarListShowByCarId(carId);
// }
//
//
// /**
// * 车辆删除
// * @param ids
// */
// @Override
// public void deleteCar(List<Long> ids) {
// carMapper.deleteBatchIds(ids);
// }
}

View File

@ -1,5 +1,6 @@
package com.muyu.enterprise.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.enterprise.domain.CarMessage;
import com.muyu.enterprise.mapper.CarMessageMapper;
@ -7,6 +8,7 @@ import com.muyu.enterprise.service.CarMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* --
@ -27,7 +29,8 @@ public class CarMessageServiceImpl extends ServiceImpl<CarMessageMapper, CarMess
*/
@Override
public List<CarMessage> selectMessageShow(Long templateId) {
return sysCarMessageMapper.selectMessageShow(templateId);
return list(new LambdaQueryWrapper<CarMessage>()
.eq(CarMessage::getTemplateId,templateId));
}
/**

View File

@ -18,8 +18,5 @@ import java.util.List;
@Service
public class CarMessageTypeServiceImpl extends ServiceImpl<CarMessageTypeMapper, CarMessageType> implements CarMessageTypeService {
@Override
public List<CarMessageType> messageTypeList() {
return null;
}
}

View File

@ -26,7 +26,7 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
*/
@Override
public List<CarTemplate> selectTemplateShow() {
return sysCarTemplateMapper.selectTemplateShow();
return list();
}
/**

View File

@ -4,75 +4,5 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarManageMapper">
<!-- 车辆列表 -->
<select id="carList" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
cman.*,
cc.config_name,
cc.energy_type,
cc.gear_type
FROM
`car_manage` cman
LEFT JOIN `car_config` cc ON cman.config_id = cc.config_id
<where>
<if test="carVin != null and carVin != ''">
and cman.car_vin = #{carVin}
</if>
<if test="typeName != null and typeName != ''">
and cc.config_name like concat('%',#{typeName},'%')
</if>
<if test="energyType != null and energyType > 0 ">
and cc.energy_type = #{energyType}
</if>
<if test="gearType != null and gearType > 0 ">
and cc.gear_type = #{gearType}
</if>
</where>
</select>
<select id="CarListShow" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
tc.*,
tt.energy_type,
tt.gear_type,
tt.type_name
FROM
`t_car` tc
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
<where>
<if test="carVin != null and carVin != ''">
and tc.car_vin = #{carVin}
</if>
<if test="carLastJoinTime != null and carLastJoinTime != ''">
and tc.car_last_join_time = #{carLastJoinTime}
</if>
<if test="carLastOfflineTime != null and carLastOfflineTime != ''">
and tc.car_last_offline_time = #{carVin}
</if>
<if test="typeName != null and typeName != ''">
and tt.type_name like concat('%',#{typeName},'%')
</if>
<if test="energyType != null and energyType > 0 ">
and tt.energy_type = #{energyType}
</if>
<if test="gearType != null and gearType > 0 ">
and tt.gear_type = #{gearType}
</if>
</where>
</select>
<!-- 通过id查询 -->
<select id="CarListShowByCarId" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
tc.*,
tt.energy_type,
tt.gear_type,
tt.type_name
FROM
`t_car` tc
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
where tc.car_id = #{carId}
</select>
</mapper>

View File

@ -4,17 +4,4 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper">
<!-- 查询所有报文信息 -->
<!-- 查询所有报文信息 -->
<select id="selectMessageShow" resultType="com.muyu.enterprise.domain.CarMessage">
SELECT
tcm.*
FROM
`t_car_message` tcm
WHERE
tcm.template_id = #{templateId}
</select>
</mapper>

View File

@ -4,10 +4,4 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper">
<!-- 查询所有报文信息 -->
<select id="selectTemplateShow" resultType="com.muyu.enterprise.domain.CarTemplate">
select * from `t_template`
</select>
</mapper>