src/com/sxt/bus/service/impl/RentServiceImpl.java
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.sxt.bus.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sxt.bus.domain.Car;
import com.sxt.bus.domain.Rent;
import com.sxt.bus.mapper.CarMapper;
import com.sxt.bus.mapper.RentMapper;
import com.sxt.bus.service.RentService;
import com.sxt.bus.vo.RentVo;
import com.sxt.sys.constast.SysConstast;
import com.sxt.sys.utils.DataGridView;
@Service
public class RentServiceImpl implements RentService {
@Autowired
private RentMapper rentMapper;
@Autowired
private CarMapper carMapper;
@Override
public void addRent(RentVo rentVo) {
this.rentMapper.insertSelective(rentVo);
//更改车辆的出租状态
Car car=new Car();
car.setCarnumber(rentVo.getCarnumber());
car.setIsrenting(SysConstast.RENT_CAR_TRUE);
carMapper.updateByPrimaryKeySelective(car);
}
@Override
public DataGridView queryAllRent(RentVo rentVo) {
Page<Object> page=PageHelper.startPage(rentVo.getPage(), rentVo.getLimit());
List<Rent> data = this.rentMapper.queryAllRent(rentVo);
return new DataGridView(page.getTotal(), data);
}
@Override
public void updateRent(RentVo rentVo) {
this.rentMapper.updateByPrimaryKeySelective(rentVo);
}
@Override
public void deleteRent(String rentid) {
//更改汽车的状态
Rent rent=this.rentMapper.selectByPrimaryKey(rentid);
Car car=new Car();
car.setCarnumber(rent.getCarnumber());
car.setIsrenting(SysConstast.RENT_CAR_FALSE);
carMapper.updateByPrimaryKeySelective(car);
//删除出租单
this.rentMapper.deleteByPrimaryKey(rentid);
}
后面还有 7 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。