package com.pj.tb_trade_area;

import cn.dev33.satoken.annotation.SaCheckPermission;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;


/**
 * Controller: tb_trade_area -- 贸易区域(app接口)
 * @author lbl
 */
@RestController
@RequestMapping("/app/TbTradeArea/")
public class TbTradeAreaAppController {

	/** 底层 Service 对象 */
	@Autowired
	TbTradeAreaService tbTradeAreaService;



	/** 查 - 根据id */
	@RequestMapping("getById")
//		@SaCheckPermission(TbTradeArea.PERMISSION_CODE)
	public AjaxJson getById(String id){
		TbTradeArea t = tbTradeAreaService.getById(id);
		return AjaxJson.getSuccessData(t);
	}

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

}
