5.22

package com.cxk.baseframe.project.systemmanage.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;

import com.cxk.baseframe.config.common.annotation.Log;
import com.cxk.baseframe.config.common.entity.common.domain.AjaxResult;
import com.cxk.baseframe.config.common.entity.common.domain.page.TableDataInfo;
import com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway;
import com.cxk.baseframe.config.common.enums.BusinessType;
import com.cxk.baseframe.config.common.response.BaseController;
import com.cxk.baseframe.config.common.utils.MapUtil;
import com.cxk.baseframe.config.common.utils.poi.ExcelUtil;
import com.cxk.baseframe.project.systemmanage.service.IABeijingsubwayService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
* 起点—终点查询Controller
*
* @author cxk
* @date 2024-04-14
*/
@Api(tags={"起点—终点查询管理"})
@RestController
@RequestMapping("/system-manage-service/system/beijingsubway")
public class ABeijingsubwayController extends BaseController
{
@Resource
private IABeijingsubwayService aBeijingsubwayService;

/**
* 查询起点—终点查询列表
*/
@ApiOperation(value="查询起点—终点查询列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "aBeijingsubway", value = "起点—终点查询实体", dataType = "ABeijingsubway", required = false),
@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", defaultValue = "1", required = false),
@ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", defaultValue = "10", required = false)
})
@GetMapping("/list")
public TableDataInfo list(ABeijingsubway aBeijingsubway)
{
startPage();
List<ABeijingsubway> list = aBeijingsubwayService.selectABeijingsubwayList(aBeijingsubway);
return getDataTable(list);
}

/**
* 导出起点—终点查询列表
*/
@ApiOperation(value="导出起点—终点查询列表")
@ApiImplicitParam(name = "aBeijingsubway", value = "起点—终点查询实体", dataType = "ABeijingsubway", required = false)
@Log(title = "起点—终点查询", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ABeijingsubway aBeijingsubway)
{
List<ABeijingsubway> list = aBeijingsubwayService.selectABeijingsubwayList(aBeijingsubway);
ExcelUtil<ABeijingsubway> util = new ExcelUtil<ABeijingsubway>(ABeijingsubway.class);
util.exportExcel(response, list, "起点—终点查询数据");
}

/**
* 获取起点—终点查询详细信息
*/
@ApiOperation(value="获取起点—终点查询详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "起点—终点查询Id", dataType = "Long", paramType = "query", required = true)
})
@GetMapping(value = "/getInfo")
public AjaxResult getInfo(@RequestParam Long id)
{
return success(aBeijingsubwayService.selectABeijingsubwayById(id));
}

/**
* 新增起点—终点查询
*/
@ApiOperation(value="新增起点—终点查询")
@ApiImplicitParam(name = "aBeijingsubway", value = "起点—终点查询实体", dataType = "ABeijingsubway", required = true)
@Log(title = "起点—终点查询", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ABeijingsubway aBeijingsubway)
{
return toAjax(aBeijingsubwayService.insertABeijingsubway(aBeijingsubway));
}

/**
* 修改起点—终点查询
*/
@ApiOperation(value="修改起点—终点查询")
@ApiImplicitParam(name = "aBeijingsubway", value = "起点—终点查询实体", dataType = "ABeijingsubway", required = true)
@Log(title = "起点—终点查询", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@RequestBody ABeijingsubway aBeijingsubway)
{
return toAjax(aBeijingsubwayService.updateABeijingsubway(aBeijingsubway));
}

/**
* 删除起点—终点查询
*/
@ApiOperation(value="删除起点—终点查询")
@ApiImplicitParam(name = "ids", value = "起点—终点查询数组", dataType = "Long[]", required = true)
@Log(title = "起点—终点查询", businessType = BusinessType.DELETE)
@PostMapping("/remove")
public AjaxResult remove(@RequestParam Long[] ids)
{
return toAjax(aBeijingsubwayService.deleteABeijingsubwayByIds(ids));
}

/**
* uniapp端删除起点—终点查询
*/
@ApiOperation(value="uniapp端删除起点—终点查询")
@ApiImplicitParam(name = "ids", value = "起点—终点查询id(多个以逗号分隔)", dataType = "String", required = true)
@Log(title = "起点—终点查询", businessType = BusinessType.DELETE)
@PostMapping("/delete")
public AjaxResult delete(@RequestBody Map<String,String> map)
{
if(MapUtil.checkContains(map,"ids")){
String[] ids = map.get("ids").split(",");
Long[] idArr = new Long[ids.length];
for (int i = 0; i < ids.length; i++) {
idArr[i] = Long.parseLong(ids[i]);
}
return toAjax(aBeijingsubwayService.deleteABeijingsubwayByIds(idArr));
}
return AjaxResult.error("请先选择起点—终点查询!");
}
}
posted @ 2024-06-06 22:19  chrisrmas、  阅读(4)  评论(0编辑  收藏  举报