package com.yihu.wlyy.web.common.url;

import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by lyr-pc on 2017/1/17.
 */
@RestController
@RequestMapping(value = "/common/cud_url")
@Api("增删改路径查询")
public class CudUrlController extends BaseController {

    @Autowired
    JdbcTemplate jdbcTemplate;

    /**
     * 查询增删改路径
     *
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    @ApiOperation(value = "查询增删改路径")
    public String getCudUrl() {
        try {
            String sql = "select * from wlyy_cud_url";
            List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);

            return write(200,"查询成功","data",result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }

}
