重构项目-接入数据库的列表
parent
4bc4f9a9b2
commit
178789b3e6
|
@ -1,11 +1,68 @@
|
|||
package com.muyu.etl.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据接入 BasicConfigInfoController
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
public class BasicConfigInfoController {
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class BasicConfigInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BasicConfigInfoService service;
|
||||
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo){
|
||||
startPage();;
|
||||
List<BasicConfigInfo> list = service.selectBasicConfigInfoList(basicConfigInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:export")
|
||||
@Log(title = "基础信息",businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response,BasicConfigInfo basicConfigInfo){
|
||||
List<BasicConfigInfo> list = service.selectBasicConfigInfoList(basicConfigInfo);
|
||||
ExcelUtil<BasicConfigInfo> util = new ExcelUtil<>(BasicConfigInfo.class);
|
||||
util.exportExcel(response,list,"基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id){
|
||||
return success(service.selectBasicConfigInfoById(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,32 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据接入mapper层 BasicConfigInfoMapper
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
@Mapper
|
||||
public interface BasicConfigInfoMapper {
|
||||
|
||||
public interface BasicConfigInfoMapper extends BaseMapper<BasicConfigInfo> {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String selectBasicConfigInfoById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据接入的service层 BasicConfigInfoService
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
public interface BasicConfigInfoService extends IService<BasicConfigInfo> {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
String selectBasicConfigInfoById(Long id);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
/**
|
||||
* 数据接入的service层 BasicConfigService
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
public interface BasicConfigService {
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据接入 BasicConfigInfoServiceImpl
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapper, BasicConfigInfo> implements BasicConfigInfoService {
|
||||
|
||||
@Autowired
|
||||
private BasicConfigInfoMapper basicConfigInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo) {
|
||||
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String selectBasicConfigInfoById(Long id) {
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoById(id);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.muyu.etl.service.BasicConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据接入 BasicConfigServiceImpl
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/9
|
||||
*/
|
||||
@Service
|
||||
public class BasicConfigServiceImpl implements BasicConfigService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?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.etl.mapper.BasicConfigInfoMapper">
|
||||
|
||||
|
||||
<sql id="selectBasicConfigInfoVo">
|
||||
select id, data_resource_name,username,password, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times,connection_params, remark from basic_config_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBasicConfigInfoList" parameterType="com.muyu.etl.domain.BasicConfigInfo" resultMap="BasicConfigInfoResult">
|
||||
<include refid="selectBasicConfigInfoVo"/>
|
||||
<where>
|
||||
<if test="dataResourceName != null and dataResourceName != ''"> and data_resource_name like concat('%', #{dataResourceName}, '%')</if>
|
||||
<if test="dataSourcesSystemName != null and dataSourcesSystemName != ''"> and data_sources_system_name like concat('%', #{dataSourcesSystemName}, '%')</if>
|
||||
<if test="host != null and host != ''"> and host = #{host}</if>
|
||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
||||
<if test="databaseType != null and databaseType != ''"> and database_type = #{databaseType}</if>
|
||||
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
||||
<if test="username != null "> and username = #{username}</if>
|
||||
<if test="password != null "> and password = #{password}</if>
|
||||
<if test="initLinkNum != null "> and init_link_num = #{initLinkNum}</if>
|
||||
<if test="maxLinkNum != null "> and max_link_num = #{maxLinkNum}</if>
|
||||
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
|
||||
<if test="maxWaitTimes != null "> and max_wait_times = #{maxWaitTimes}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBasicConfigInfoById" parameterType="Long" resultMap="BasicConfigInfoResult">
|
||||
<include refid="selectBasicConfigInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue