整理代码
This commit is contained in:
@@ -2,9 +2,9 @@ package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestApiListQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -18,7 +18,6 @@ import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestApi;
|
||||
import com.test.test.service.ITestApiService;
|
||||
import com.test.common.utils.poi.ExcelUtil;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
@@ -36,29 +35,18 @@ public class TestApiController extends BaseController {
|
||||
* 查询接口列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@Validated TestApiListQO testApi) {
|
||||
public TableDataInfo list(@Validated TestApiListQO qo) {
|
||||
startPage();
|
||||
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
||||
List<TestApi> list = testApiService.selectTestApiList(qo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出接口列表
|
||||
*/
|
||||
@Log(title = "接口", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TestApiListQO testApi) {
|
||||
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
||||
ExcelUtil<TestApi> util = new ExcelUtil<TestApi>(TestApi.class);
|
||||
util.exportExcel(response, list, "接口数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接口详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(testApiService.selectTestApiById(id));
|
||||
@PostMapping(value = "/detail")
|
||||
public AjaxResult getInfo(@RequestBody IDQO qo) {
|
||||
return success(testApiService.selectTestApiById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,8 +71,8 @@ public class TestApiController extends BaseController {
|
||||
* 删除接口
|
||||
*/
|
||||
@Log(title = "接口", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(testApiService.deleteTestApiByIds(ids));
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testApiService.deleteTestApiById(qo.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -58,8 +59,8 @@ public class TestApiGroupController extends BaseController {
|
||||
* 删除接口节点
|
||||
*/
|
||||
@Log(title = "接口节点", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id) {
|
||||
return toAjax(testApiGroupService.deleteTestApiGroupById(id));
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testApiGroupService.deleteTestApiGroupById(qo.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IDQO {
|
||||
private Long id;
|
||||
}
|
||||
@@ -22,10 +22,10 @@ public interface TestApiMapper {
|
||||
/**
|
||||
* 查询接口列表
|
||||
*
|
||||
* @param testApi 接口
|
||||
* @param qo 接口
|
||||
* @return 接口集合
|
||||
*/
|
||||
public List<TestApi> selectTestApiList(TestApiListQO testApi);
|
||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
|
||||
/**
|
||||
* 新增接口
|
||||
|
||||
@@ -22,10 +22,10 @@ public interface ITestApiService {
|
||||
/**
|
||||
* 查询接口列表
|
||||
*
|
||||
* @param testApi 接口
|
||||
* @param qo 接口
|
||||
* @return 接口集合
|
||||
*/
|
||||
public List<TestApi> selectTestApiList(TestApiListQO testApi);
|
||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
|
||||
/**
|
||||
* 新增接口
|
||||
|
||||
@@ -34,12 +34,12 @@ public class TestApiServiceImpl implements ITestApiService {
|
||||
/**
|
||||
* 查询接口列表
|
||||
*
|
||||
* @param testApi 接口
|
||||
* @param qo 接口
|
||||
* @return 接口
|
||||
*/
|
||||
@Override
|
||||
public List<TestApi> selectTestApiList(TestApiListQO testApi) {
|
||||
return testApiMapper.selectTestApiList(testApi);
|
||||
public List<TestApi> selectTestApiList(TestApiListQO qo) {
|
||||
return testApiMapper.selectTestApiList(qo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,16 +24,13 @@
|
||||
select id, group_id, name, method, uri, header, param, body, del_flag, create_by, create_time, update_by, update_time from test_api
|
||||
</sql>
|
||||
|
||||
<select id="selectTestApiList" parameterType="TestApi" resultMap="TestApiResult">
|
||||
<select id="selectTestApiList" parameterType="TestApiListQO" resultMap="TestApiResult">
|
||||
<include refid="selectTestApiVo"/>
|
||||
<where>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="method != null and method != ''"> and method = #{method}</if>
|
||||
<if test="uri != null and uri != ''"> and uri like concat('%', #{uri}, '%')</if>
|
||||
<if test="header != null and header != ''"> and header = #{header}</if>
|
||||
<if test="param != null and param != ''"> and param = #{param}</if>
|
||||
<if test="body != null and body != ''"> and body = #{body}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user