parent
d1785b5dbb
commit
e0aba138ac
@ -0,0 +1,35 @@
|
||||
package com.taxi.servicedriveruser.controller;
|
||||
|
||||
|
||||
import com.internal.dto.DriverUserWorkStatus;
|
||||
import com.internal.dto.ResponseResult;
|
||||
import com.taxi.servicedriveruser.service.DriverUserWorkStatusService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2023-05-05
|
||||
*/
|
||||
@RestController
|
||||
public class DriverUserWorkStatusController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DriverUserWorkStatusService driverUserWorkStatusService;
|
||||
|
||||
@RequestMapping("/driver-user-work-status")
|
||||
public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus){
|
||||
Long driverId = driverUserWorkStatus.getDriverId();
|
||||
Integer workStatus = driverUserWorkStatus.getWorkStatus();
|
||||
return driverUserWorkStatusService.changeWorkStatus(driverId,workStatus);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.taxi.servicedriveruser.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.internal.dto.DriverUserWorkStatus;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2023-05-05
|
||||
*/
|
||||
@Repository
|
||||
public interface DriverUserWorkStatusMapper extends BaseMapper<DriverUserWorkStatus> {
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.taxi.servicedriveruser.service;
|
||||
|
||||
import com.internal.dto.DriverUserWorkStatus;
|
||||
import com.internal.dto.ResponseResult;
|
||||
import com.taxi.servicedriveruser.mapper.DriverUserWorkStatusMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2023-05-05
|
||||
*/
|
||||
@Service
|
||||
public class DriverUserWorkStatusService {
|
||||
|
||||
@Autowired
|
||||
private DriverUserWorkStatusMapper driverUserWorkStatusMapper;
|
||||
|
||||
public ResponseResult changeWorkStatus(Long driverId,Integer workStatus){
|
||||
|
||||
Map<String,Object> selectMap = new HashMap<>();
|
||||
selectMap.put("driver_id",driverId);
|
||||
List<DriverUserWorkStatus> list = driverUserWorkStatusMapper.selectByMap(selectMap);
|
||||
|
||||
DriverUserWorkStatus driverUserWorkStatus = list.get(0);
|
||||
|
||||
driverUserWorkStatus.setWorkStatus(workStatus);
|
||||
driverUserWorkStatusMapper.updateById(driverUserWorkStatus);
|
||||
|
||||
return ResponseResult.success();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue