package com.pj.project.tb_car_record;

import com.pj.project4sp.SP;
import com.pj.utils.sg.AjaxJson;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * app: tb_car_record -- 商户司机叫车记录表
 * @author yzs 
 */
@RestController
@RequestMapping("/app/TbCarRecord/")
public class AppCarRecordController {

	/** 底层 Service 对象 */
	@Autowired
	TbCarRecordService tbCarRecordService;

	/** 删 */  
	@RequestMapping("delete")
	public AjaxJson delete(Long id){
		 tbCarRecordService.delete(id);
		return AjaxJson.getSuccess();
	}
	
	/** 删 - 根据id列表 */  
	@RequestMapping("deleteByIds")
	public AjaxJson deleteByIds(){
		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
		int line = SP.publicMapper.deleteByIds(TbCarRecord.TABLE_NAME, ids);
		return AjaxJson.getByLine(line);
	}

	/** app:查 - 根据id */
	@RequestMapping("getById")
	public AjaxJson getById(Long id){
		TbCarRecord t = tbCarRecordService.getById(id);
		return AjaxJson.getSuccessData(t);
	}

	/** app:查集合 - 根据条件（参数为空时代表忽略指定条件） */
	@RequestMapping("getAppList")
	public AjaxJson getAppList(@RequestParam(value = "driverResult",required = false) Integer driverResult) {
		SoMap so = SoMap.getRequestSoMap();
		List<TbCarRecord> list = tbCarRecordService.getAppList(so.startPage(),driverResult);
		return AjaxJson.getPageData(so.getDataCount(), list);
	}
	
	
	
	

	
	
	

}
