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.EbikeCarrierConfiguration; import com.cdzy.operations.service.EbikeCarrierConfigurationService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; 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.EbikeCarrierConfigurationTableDef.EBIKE_CARRIER_CONFIGURATION; /** * 运营商配置 控制层 * * @author yanglei * @since 2026-01-08 17:08 */ @RestController @RequestMapping("/ebikeCarrierConfiguration") public class EbikeCarrierConfigurationController { @Resource private EbikeCarrierConfigurationService carrierConfigurationService; /** * 添加更新 * * @param dto 配置实体类 * @return 主键id */ @PostMapping("saveOrUpdate") public JsonResult save(@RequestBody @Validated EbikeSaveConfigurationDto dto) { carrierConfigurationService.saveConfiguration(dto); return JsonResult.success(); } /** * 根据运营商id查询配置信息 * * @param operatorId 运营商id * @return 配置信息 */ @GetMapping("getByOperatorId") public JsonResult getByOperatorId(@RequestParam("operatorId") Long operatorId) { EbikeCarrierConfiguration result = carrierConfigurationService.getConfigurationByOperationId(operatorId); return JsonResult.success(result); } /** * 分页查询 * * @param page 分页参数 * @return 配置信息 */ @GetMapping("page") public JsonResult page(PageParam page) { QueryWrapper queryWrapper = QueryWrapper.create() .select(EBIKE_CARRIER_CONFIGURATION.ALL_COLUMNS); Page orderPage = carrierConfigurationService.pageAs(page.getPage(), queryWrapper, EbikeCarrierConfiguration.class); return JsonResult.success(orderPage); } /** * 根据运营商id查询电话 * * @param operatorId 运营商id * @return 运营商电话 */ @GetMapping("getPhoneByOperatorId") public JsonResult getPhoneByOperatorId(@RequestParam("operatorId") Long operatorId) { String operatorPhone = carrierConfigurationService.getPhoneByOperatorId(operatorId); return JsonResult.success(operatorPhone); } /** * 根据车辆编码查询电话 * * @param bikeCode 车辆编码 * @return 运营商电话 */ @GetMapping("/api/getPhoneByBikeCode") public JsonResult getPhoneByBikeCode(@RequestParam("bikeCode") String bikeCode) { String operatorPhone = carrierConfigurationService.getPhoneByBikeCode(bikeCode); return JsonResult.success((Object) operatorPhone); } }