TblRelationController.java 1.84 KB
package com.yoho.search.consumer.restapi;

import com.yoho.search.consumer.service.logic.tbl.TblBrandRelationLogicService;
import com.yoho.search.consumer.service.logic.tbl.TblSortRelationLogicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wangnan on 2017/3/7.
 */
@Controller
public class TblRelationController {

    @Autowired
    private TblSortRelationLogicService tblSortRelationLogicService;
    @Autowired
    private TblBrandRelationLogicService tblBrandRelationLogicService;

    @RequestMapping(value = "/tblSortRelation")
    @ResponseBody
    public Map<String, Object> loadSortRelationData() {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            tblSortRelationLogicService.loadSortRelationData();
            result.put("code", 200);
            result.put("message", "success");
        } catch (Exception e) {
            e.printStackTrace();
            result.put("code", 400);
            result.put("message", e.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/tblBrandRelation")
    @ResponseBody
    public Map<String, Object> loadBrandRelationData() {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            tblBrandRelationLogicService.loadBrandRelationData();
            result.put("data", "");
            result.put("code", 200);
            result.put("message", "success");
        } catch (Exception e) {
            e.printStackTrace();
            result.put("code", 400);
            result.put("message", e.getMessage());
        }
        return result;
    }
}