TestApiController.java 1.55 KB
package com.yoho.search.consumer.test;

import com.yoho.search.consumer.service.utils.BrandRelationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
public class TestApiController {

    @Autowired
    private BrandRelationUtils brandRelationUtils;

    @RequestMapping(value = "/test")
    public Map<String, Object> test() {
        Map<String, Object> testResult = new HashMap<String, Object>();
        testResult.put("data", null);
        testResult.put("code", 200);
        testResult.put("message", "success");
        return testResult;
    }

    @RequestMapping(value = "/buildBrandRelation")
    public Map<String, Object> buildBrandRelation() {
        Map<String, Object> testResult = new HashMap<>();
        if (brandRelationUtils.buildBrandRelation()) {
            testResult.put("code", 200);
            testResult.put("message", "success");
        } else {
            testResult.put("code", 500);
            testResult.put("message", "fail");
        }
        return testResult;
    }

    @RequestMapping(value = "/showTblRelationResult")
    public Map<String, Object> brandRelationUtils() {
        Map<String, Object> testResult = new HashMap<>();
        testResult.put("data", brandRelationUtils.showTblRelationResult());
        testResult.put("code", 200);
        testResult.put("message", "success");
        return testResult;
    }

}