搜索数据添加导入,导出接口
This commit is contained in:
@@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.api.vo.SearchRequest;
|
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.modules.database.entity.SearchResult;
|
import org.jeecg.modules.database.entity.SearchResult;
|
||||||
import org.jeecg.modules.database.service.IComponentSearchService;
|
import org.jeecg.modules.database.service.IComponentSearchService;
|
||||||
@@ -17,6 +18,7 @@ import org.jeecg.modules.system.entity.SysUser;
|
|||||||
import org.jeecg.modules.system.service.ISysUserService;
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,7 +26,7 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/database/componentSearch")
|
@RequestMapping("/database/componentSearch")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ComponentSearchController {
|
public class ComponentSearchController extends JeecgController<SearchResult, IComponentSearchService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IComponentSearchService componentSearchService;
|
private IComponentSearchService componentSearchService;
|
||||||
|
|
||||||
@@ -55,10 +57,6 @@ public class ComponentSearchController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊搜索接口
|
* 模糊搜索接口
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param content
|
* @param content
|
||||||
* @return
|
* @return
|
||||||
@@ -133,7 +131,32 @@ public class ComponentSearchController {
|
|||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name = "id") String id) {
|
public Result<String> delete(@RequestParam(name = "id") String id) {
|
||||||
componentSearchService.removeById(id);
|
componentSearchService.removeById(id);
|
||||||
return Result.OK("删除!");
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, SearchResult result) {
|
||||||
|
return super.exportXls(request, result, SearchResult.class, "样品类型信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("database:experiment:add")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, SearchResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -60,6 +61,7 @@ public class SearchResult implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 搜索的内容
|
* 搜索的内容
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "内容", width = 15)
|
||||||
@Schema(description = "搜索内容")
|
@Schema(description = "搜索内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user