package com.ruoyi.project.service.impl;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONArray;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.project.domain.GiApi;
|
import com.ruoyi.project.domain.dto.ApiDTO;
|
import com.ruoyi.project.mapper.ApiMapper;
|
import com.ruoyi.project.service.IApiService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service
|
public class ApiServiceImpl extends ServiceImpl<ApiMapper, GiApi> implements IApiService {
|
@Autowired
|
ApiMapper mapper;
|
/**
|
* 主键查询详细
|
* @param code
|
* @return
|
*/
|
public GiApi getCode(String code){
|
QueryWrapper <GiApi> wrapper=new QueryWrapper<>();
|
wrapper.eq("api_Code",code);
|
return mapper.selectOne(wrapper);
|
}
|
|
|
/**
|
* 查询数据列表
|
* @param DTO
|
* @return
|
*/
|
public List<Map<String,Object>> getListSql(String sql, ApiDTO DTO) {
|
if(DTO.getParams()!=null) {
|
for (String key : DTO.getParams().keySet()) {
|
sql = sql.replace("@" + key, DTO.getParams().get(key) + "");
|
}
|
}
|
return mapper.executeSql(sql);
|
}
|
|
/**
|
* 查询数据列表
|
* @param DTO
|
* @return
|
*/
|
public String getStringSql(String sql, ApiDTO DTO) {
|
if(DTO.getParams()!=null) {
|
for (String key : DTO.getParams().keySet()) {
|
sql = sql.replace("@" + key, DTO.getParams().get(key) + "");
|
}
|
}
|
return mapper.getClob(sql);
|
}
|
}
|