ebike-share/ebike-operate/src/main/java/com/cdzy/ebikeoperate/controller/EbikeSysExchangeDurationIncentiveController.java

85 lines
3.1 KiB
Java

package com.cdzy.ebikeoperate.controller;
import com.cdzy.common.model.JsonResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.cdzy.ebikeoperate.model.pojo.EbikeSysExchangeDurationIncentive;
import com.cdzy.ebikeoperate.service.EbikeSysExchangeDurationIncentiveService;
import java.util.List;
/**
* 区域换电时间激励 控制层。
*
* @author dingchao
* @since 2025-04-15
*/
@RestController
@RequestMapping("/ebikeSysExchangeDurationIncentive")
public class EbikeSysExchangeDurationIncentiveController {
@Autowired
private EbikeSysExchangeDurationIncentiveService ebikeSysExchangeDurationIncentiveService;
/**
* 添加区域换电时间激励。
*
* @param ebikeSysExchangeDurationIncentive 区域换电时间激励
* @return {@code true} 添加成功,{@code false} 添加失败
*/
@PostMapping("save")
public JsonResult<?> save(@RequestBody EbikeSysExchangeDurationIncentive ebikeSysExchangeDurationIncentive) {
boolean r = ebikeSysExchangeDurationIncentiveService.save(ebikeSysExchangeDurationIncentive);
return r? JsonResult.success() : JsonResult.failed("添加区域换电时间激励失败");
}
/**
* 根据主键删除区域换电时间激励。
*
* @param id 主键
* @return {@code true} 删除成功,{@code false} 删除失败
*/
@PostMapping("remove")
public JsonResult<?> remove(@RequestParam(name = "id") String id) {
boolean r = ebikeSysExchangeDurationIncentiveService.removeById(id);
return r? JsonResult.success() : JsonResult.failed("删除区域换电时间激励失败");
}
/**
* 根据主键更新区域换电时间激励。
*
* @param ebikeSysExchangeDurationIncentive 区域换电时间激励
* @return {@code true} 更新成功,{@code false} 更新失败
*/
@PostMapping("update")
public JsonResult<?> update(@RequestBody EbikeSysExchangeDurationIncentive ebikeSysExchangeDurationIncentive) {
boolean r = ebikeSysExchangeDurationIncentiveService.updateById(ebikeSysExchangeDurationIncentive);
return r? JsonResult.success() : JsonResult.failed("更新区域换电时间激励失败");
}
/**
* 查询所有区域换电时间激励。
*
* @return 所有数据
*/
@GetMapping("list")
public JsonResult<?> list(@RequestParam(name = "regionId") String regionId) {
List<EbikeSysExchangeDurationIncentive> list = ebikeSysExchangeDurationIncentiveService.getListByReginId(regionId);
return list==null?JsonResult.failed("没有查询到数据"):JsonResult.success(list);
}
/**
* 根据区域换电时间激励主键获取详细信息。
*
* @param id 区域换电时间激励主键
* @return 区域换电时间激励详情
*/
@GetMapping("getInfo")
public JsonResult<?> getInfo(@RequestParam(name = "id") String id) {
EbikeSysExchangeDurationIncentive r = ebikeSysExchangeDurationIncentiveService.getById(id);
return r==null?JsonResult.failed("没有查询到数据"):JsonResult.success(r);
}
}