package cn.com.countrygarden.bi.main.controller.experience;

import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.dto.experience.TygGzhInfoManageDto;
import cn.com.countrygarden.bi.main.dto.experience.TygGzhUserInfoDto;
import cn.com.countrygarden.bi.main.model.experience.TygGzhInfoManage;
import cn.com.countrygarden.bi.main.service.experience.TygGzhInfoManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/api/tyg/gzh")
public class TygGzhInfoManageController {
    @Autowired
    private TygGzhInfoManageService tygGzhInfoManageService;

    @PostMapping("/add")
    @ResponseBody
    public Result add(@RequestBody TygGzhInfoManage tygGzhInfoManage, HttpServletRequest req){
        return tygGzhInfoManageService.add(tygGzhInfoManage,req);
    }
    @PostMapping("/list")
    @ResponseBody
    public Result list(@RequestBody TygGzhInfoManageDto tygGzhInfoManage){
        return tygGzhInfoManageService.list(tygGzhInfoManage);
    }
    @PostMapping("/one")
    @ResponseBody
    public Result one(String id){
        return tygGzhInfoManageService.one(id);
    }
    @PostMapping("/del")
    @ResponseBody
    public Result del(String id){
        return tygGzhInfoManageService.del(id);
    }
    @PostMapping("/chooseUser")
    @ResponseBody
    public Result chooseUser(@RequestParam(name="id",required = false) String id,
                             @RequestParam(name="page",defaultValue = "1") int page,
                             @RequestParam(name="id",defaultValue = "10") int size,
                             @RequestParam(name="userId",required = false) String userId){
        return tygGzhInfoManageService.chooseUser(id,page,size,userId);
    }
    @PostMapping("/selectUser")
    @ResponseBody
    public Result selectUser(@RequestBody TygGzhUserInfoDto tygGzhUserInfoDto){
        return tygGzhInfoManageService.selectUser(tygGzhUserInfoDto);
    }
    @PostMapping("/sendMessage")
    @ResponseBody
    public Result sendMessage(String id){
        return tygGzhInfoManageService.sendMessage(id);
    }
    @PostMapping("/delselectUser")
    @ResponseBody
    public Result delselectUser(@RequestParam(value="id",required = false) String id,@RequestParam(value="userIds",required = false) String userIds){
        return tygGzhInfoManageService.delselectUser(id,userIds);
    }
    @PostMapping("/tag")
    @ResponseBody
    public Result tag(@RequestParam(value = "id",required = false) String id){
        return tygGzhInfoManageService.tag(id);
    }
}
