springboot mybaits 使用原生sql查询 不返回实体类

helei 2022-10-2 747 10/2

mapper

package org.jeecg.modules.wenlv.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

public interface WenLvCommonMapper extends BaseMapper<HashMap<String,Object>> {
    @Select("${sql}")
    List<HashMap<String,Object>> getFleetCarNum(@Param("sql") String sql);
}

service

package org.jeecg.modules.wenlv.service;

import com.baomidou.mybatisplus.extension.service.IService;

import java.util.HashMap;
import java.util.List;

public interface WenLvCommonService extends IService<HashMap<String,Object>> {
    List<HashMap<String,Object>> getFleetCarNum(String sql);
}

serviceimpl

package org.jeecg.modules.wenlv.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.wenlv.mapper.WenLvCommonMapper;
import org.jeecg.modules.wenlv.service.WenLvCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class WenLvCommonServiceImpl  extends ServiceImpl<WenLvCommonMapper, HashMap<String,Object>> implements WenLvCommonService {
    @Autowired
    WenLvCommonMapper wenLvCommonMapper;

    @Override
    public List<HashMap<String, Object>> getFleetCarNum(String sql) {
        return wenLvCommonMapper.getFleetCarNum(sql);
    }
}
- THE END -

helei

10月02日14:50

最后修改:2022年10月2日
0