package com.mortals.xhx.module.window.web;

import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.service.WindowOwnerDetailService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* 窗口负责人详细
*
* @author zxfei
* @date 2023-07-12
*/
@RestController
@RequestMapping("window/owner/detail")
public class WindowOwnerDetailController extends BaseCRUDJsonBodyMappingController<WindowOwnerDetailService,WindowOwnerDetailEntity,Long> {

    public WindowOwnerDetailController(){
        super.setModuleDesc( "窗口负责人详细");
    }

    @Override
    protected void init(Map<String, Object> model, Context context) {
        super.init(model, context);
    }


    @PostMapping({"subWindowList"})
    public Rest<Object> subWindowList(@RequestBody WindowPdu query) {
        Rest<Object> ret = new Rest();
        Map<String, Object> model = new HashMap();
        Context context = this.getContext();
        String busiDesc = "查询待分配的窗口列表";

        int code = 1;
        try {
            List<WindowPdu> result = this.getService().subWindowPduList(query);
            model.put("data", result);
            model.put("message_info", busiDesc + "成功");
            this.recordSysLog(this.request, busiDesc + " 【成功】");
        } catch (Exception var9) {
            code = -1;
            this.doException(this.request, busiDesc, model, var9);
        }

        this.init(model, context);
        ret.setCode(code);
        ret.setData(model);
        ret.setDict(model.get("dict"));
        ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
        return ret;
    }
}