package com.gear.admin.controller.swx;
|
|
import java.util.List;
|
import javax.servlet.http.HttpServletResponse;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.gear.common.builder.WhereBuilder;
|
import com.gear.common.vo.Result;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import com.gear.common.annotation.Log;
|
import com.gear.common.core.controller.BaseController;
|
import com.gear.common.enums.BusinessType;
|
import com.gear.swx.domain.SwxSmartRecord;
|
import com.gear.swx.service.ISwxSmartRecordService;
|
import com.gear.common.utils.poi.ExcelUtil;
|
|
/**
|
* 智能交易记录Controller
|
*
|
* @author czx
|
* @date 2023-11-18
|
*/
|
@RestController
|
@RequestMapping("/swx/smartRecord")
|
public class SwxSmartRecordController extends BaseController
|
{
|
@Autowired
|
private ISwxSmartRecordService swxSmartRecordService;
|
|
/**
|
* 查询智能交易记录列表
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:list')")
|
@GetMapping("/list")
|
public Result<IPage<SwxSmartRecord>> list(SwxSmartRecord swxSmartRecord,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
|
QueryWrapper<SwxSmartRecord> queryWrapper = WhereBuilder.build(swxSmartRecord);
|
Page<SwxSmartRecord> page = new Page<SwxSmartRecord>(pageNo, pageSize);
|
IPage<SwxSmartRecord> pageList = swxSmartRecordService.page(page, queryWrapper);
|
return Result.OK(pageList);
|
}
|
|
/**
|
* 导出智能交易记录列表
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:export')")
|
@Log(title = "智能交易记录", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, SwxSmartRecord swxSmartRecord){
|
QueryWrapper<SwxSmartRecord> queryWrapper = WhereBuilder.build(swxSmartRecord);
|
List<SwxSmartRecord> list = swxSmartRecordService.list(queryWrapper);
|
ExcelUtil<SwxSmartRecord> util = new ExcelUtil<SwxSmartRecord>(SwxSmartRecord.class);
|
util.exportExcel(response, list, "智能交易记录数据");
|
}
|
|
/**
|
* 获取智能交易记录详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:query')")
|
@GetMapping(value = "/{id}")
|
public Result<SwxSmartRecord> getInfo(@PathVariable("id") String id){
|
SwxSmartRecord swxSmartRecord = swxSmartRecordService.getById(id);
|
if(swxSmartRecord==null) {
|
return Result.error("未找到对应数据");
|
}
|
return Result.OK(swxSmartRecord);
|
}
|
|
/**
|
* 新增智能交易记录
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:add')")
|
@Log(title = "智能交易记录", businessType = BusinessType.INSERT)
|
@PostMapping
|
public Result<String> add(@RequestBody SwxSmartRecord swxSmartRecord){
|
swxSmartRecordService.save(swxSmartRecord);
|
return Result.ok("添加成功!");
|
}
|
|
/**
|
* 修改智能交易记录
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:edit')")
|
@Log(title = "智能交易记录", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public Result<String> edit(@RequestBody SwxSmartRecord swxSmartRecord){
|
swxSmartRecordService.updateById(swxSmartRecord);
|
return Result.ok("编辑成功!");
|
}
|
|
/**
|
* 删除智能交易记录
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:smartRecord:remove')")
|
@Log(title = "智能交易记录", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public Result<String> remove(@PathVariable List<String> ids){
|
swxSmartRecordService.removeBatchByIds(ids);
|
return Result.ok("删除成功!");
|
}
|
}
|