96 lines
3.2 KiB
Java
96 lines
3.2 KiB
Java
|
|
package com.cdzy.operations.controller;
|
|||
|
|
|
|||
|
|
import com.cdzy.common.model.request.PageParam;
|
|||
|
|
import com.cdzy.common.model.response.JsonResult;
|
|||
|
|
import com.cdzy.operations.model.dto.EbikeSaveConfigurationDto;
|
|||
|
|
import com.cdzy.operations.model.dto.EbikeUpdateConfigurationDto;
|
|||
|
|
import com.cdzy.operations.model.entity.EbikeDispatchConfiguration;
|
|||
|
|
import com.cdzy.operations.service.EbikeDispatchConfigurationService;
|
|||
|
|
import com.mybatisflex.core.paginate.Page;
|
|||
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|||
|
|
import jakarta.annotation.Resource;
|
|||
|
|
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.RequestParam;
|
|||
|
|
import org.springframework.web.bind.annotation.RestController;
|
|||
|
|
|
|||
|
|
import static com.cdzy.operations.model.entity.table.EbikeDispatchConfigurationTableDef.EBIKE_DISPATCH_CONFIGURATION;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 调度配置 控制层
|
|||
|
|
*
|
|||
|
|
* @author yanglei
|
|||
|
|
* @since 2026-01-08 17:08
|
|||
|
|
*/
|
|||
|
|
@RestController
|
|||
|
|
@RequestMapping("/ebikeDispatchConfiguration")
|
|||
|
|
public class EbikeDispatchConfigurationController {
|
|||
|
|
|
|||
|
|
@Resource
|
|||
|
|
private EbikeDispatchConfigurationService dispatchConfigurationService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 添加。
|
|||
|
|
*
|
|||
|
|
* @param dto 配置实体类
|
|||
|
|
* @return 主键id
|
|||
|
|
*/
|
|||
|
|
@PostMapping("save")
|
|||
|
|
public JsonResult<?> save(@RequestBody EbikeSaveConfigurationDto dto) {
|
|||
|
|
dispatchConfigurationService.saveConfiguration(dto);
|
|||
|
|
return JsonResult.success();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据主键删除。
|
|||
|
|
*
|
|||
|
|
* @param configurationId 主键
|
|||
|
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
|||
|
|
*/
|
|||
|
|
@GetMapping("remove")
|
|||
|
|
public JsonResult<?> remove(@RequestParam("configurationId") Long configurationId) {
|
|||
|
|
dispatchConfigurationService.removeById(configurationId);
|
|||
|
|
return JsonResult.success();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据主键更新。
|
|||
|
|
*
|
|||
|
|
* @param dto 配置实体类信息
|
|||
|
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
|||
|
|
*/
|
|||
|
|
@PostMapping("update")
|
|||
|
|
public JsonResult<?> update(@RequestBody EbikeUpdateConfigurationDto dto) {
|
|||
|
|
dispatchConfigurationService.updateConfiguration(dto);
|
|||
|
|
return JsonResult.success();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 根据主键id查询
|
|||
|
|
*
|
|||
|
|
* @param configurationId 主键id
|
|||
|
|
* @return 配置信息
|
|||
|
|
*/
|
|||
|
|
@GetMapping("getById")
|
|||
|
|
public JsonResult<?> getById(@RequestParam("configurationId") Long configurationId) {
|
|||
|
|
EbikeDispatchConfiguration result = dispatchConfigurationService.getById(configurationId);
|
|||
|
|
return JsonResult.success(result);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 分页查询
|
|||
|
|
*
|
|||
|
|
* @param page 分页参数
|
|||
|
|
* @return 配置信息
|
|||
|
|
*/
|
|||
|
|
@GetMapping("page")
|
|||
|
|
public JsonResult<?> page(PageParam page) {
|
|||
|
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
|||
|
|
.select(EBIKE_DISPATCH_CONFIGURATION.ALL_COLUMNS);
|
|||
|
|
Page<EbikeDispatchConfiguration> orderPage = dispatchConfigurationService.pageAs(page.getPage(), queryWrapper, EbikeDispatchConfiguration.class);
|
|||
|
|
return JsonResult.success(orderPage);
|
|||
|
|
}
|
|||
|
|
}
|