package com.weaver.seconddev.chapanda.hrm.controller;

import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import com.weaver.seconddev.chapanda.hrm.service.HrmTableFieldService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/api/secondev/chapanda/hrm/form")
public class HrmTableFieldController {
    private final Logger log = LoggerFactory.getLogger(HrmTableFieldController.class);

    @Autowired
    private HrmTableFieldService hrmTableFieldService;

    @WeaPermission(publicPermission = true)
    @GetMapping("/getdetailfield")
    public WeaResult<Object> getDetailField(HttpServletRequest request, HttpServletResponse response){
        String tablename = String.valueOf(request.getParameter("tablename"));
        log.error("tablename:{}",tablename);
        String detailname = String.valueOf(request.getParameter("detailname"));
        log.error("detailname:{}",detailname);
        List<Map<String,Object>> dataList = hrmTableFieldService.queryTableDetailFieldByTableName(tablename,detailname);
        return WeaResult.success(dataList);
    }
}
