package com.pj.tb_collage_orders;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.pj.project4sp.SP;
import com.pj.tb_collage_orders.param.TbCollageOrdersParam;
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.RestController;

import java.util.List;


/**
 * Controller: tb_collage_orders -- 拼单订单表(app接口)
 * @author linbl
 */
@RestController
@RequestMapping("/app/TbCollageOrders/")
public class TbCollageOrdersAppController {

	/** 底层 Service 对象 */
	@Autowired
	TbCollageOrdersService tbCollageOrdersService;

	/** 增 */
	@RequestMapping("addByCooperative")
	public AjaxJson addByCooperative(TbCollageOrdersParam param){
		return AjaxJson.toAjax(tbCollageOrdersService.addByCooperative(param));
	}


	/** 改 */
	@RequestMapping("update")
	public AjaxJson update(TbCollageOrders t){
		tbCollageOrdersService.update(t);
		return AjaxJson.getSuccess();
	}

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

	/** 查集合 - 根据条件（参数为空时代表忽略指定条件） */
	@RequestMapping("getList")
	public AjaxJson getList() {
		SoMap so = SoMap.getRequestSoMap();
		List<TbCollageOrders> list = tbCollageOrdersService.getList(so.startPage());
		return AjaxJson.getPageData(so.getDataCount(), list);
	}



}
