package com.sa.ibiz.demo.demo.rest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sa.ibiz.demo.demo.domain.OrgUser;
import com.sa.ibiz.demo.demo.service.OrgUserService;
import com.sa.ibiz.demo.demo.service.dto.OrgUserSearchFilter;
import com.sa.ibiz.demo.ibizutil.errors.BadRequestAlertException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigInteger;
import java.util.List;

@RestController
@RequestMapping("/demo/orguser")
public class OrgUserResource
{
	@Autowired
	private OrgUserService service;


	@PostMapping(value = "/remove")
	public ResponseEntity<OrgUser> remove(@Validated @RequestBody OrgUser data){
		boolean bRt=service.remove(data);
		if(!bRt)
			throw new BadRequestAlertException("组织人员[remove]操作发生错误","OrgUser",data.getOrguserid().toString());
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/checkKey")
	public ResponseEntity<OrgUser> checkKey(@Validated @RequestBody OrgUser data){
		boolean bRt=service.checkKey(data);
		if(!bRt)
			throw new BadRequestAlertException("组织人员[checkKey]操作发生错误","OrgUser",data.getOrguserid().toString());
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/getDraft")
	public ResponseEntity<OrgUser> getDraft(@Validated @RequestBody OrgUser data){
		boolean bRt=service.getDraft(data);
		if(!bRt)
			throw new BadRequestAlertException("组织人员[getDraft]操作发生错误","OrgUser","");
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/update")
	public ResponseEntity<OrgUser> update(@Validated @RequestBody OrgUser data){
		boolean bRt=service.update(data);
		if(!bRt)
			throw new BadRequestAlertException("组织人员[update]操作发生错误","OrgUser",data.getOrguserid().toString());
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/updateCurUser")
	public ResponseEntity<OrgUser> updateCurUser(@Validated @RequestBody OrgUser data){
		service.updateCurUser(data);
		return ResponseEntity.ok().body(data);
	}
	@GetMapping(value = "/{id}")
	public ResponseEntity<OrgUser> get(@Validated @PathVariable String id){
		OrgUser data=new OrgUser();
		data.setOrguserid(id);;
		data=service.get(data);
		if(data==null)
			throw new BadRequestAlertException("组织人员[get]操作发生错误","OrgUser",id.toString());
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/create")
	public ResponseEntity<OrgUser> create(@Validated @RequestBody OrgUser data){
		boolean bRt=service.create(data);
		if(!bRt)
			throw new BadRequestAlertException("组织人员[create]操作发生错误","OrgUser",data.getOrguserid().toString());
		return ResponseEntity.ok().body(data);
	}
	@PostMapping(value = "/getCurUser")
	public ResponseEntity<OrgUser> getCurUser(@Validated @RequestBody OrgUser data){
		service.getCurUser(data);
		return ResponseEntity.ok().body(data);
	}
    @PostMapping(value="/searchcurorgsector")
	public ResponseEntity<Page<OrgUser>> searchCurOrgSectorPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchCurOrgSector(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listcurorgsector")
	public ResponseEntity<List<OrgUser>> listCurOrgSector(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listCurOrgSector(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchcurorgsectorbizleader")
	public ResponseEntity<Page<OrgUser>> searchCurOrgSectorBIZLeaderPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchCurOrgSectorBIZLeader(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listcurorgsectorbizleader")
	public ResponseEntity<List<OrgUser>> listCurOrgSectorBIZLeader(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listCurOrgSectorBIZLeader(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchdefault")
	public ResponseEntity<Page<OrgUser>> searchDefaultPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchDefault(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listdefault")
	public ResponseEntity<List<OrgUser>> listDefault(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listDefault(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchcurorg")
	public ResponseEntity<Page<OrgUser>> searchCurOrgPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchCurOrg(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listcurorg")
	public ResponseEntity<List<OrgUser>> listCurOrg(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listCurOrg(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchuserorgsector")
	public ResponseEntity<Page<OrgUser>> searchUserOrgSectorPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchUserOrgSector(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listuserorgsector")
	public ResponseEntity<List<OrgUser>> listUserOrgSector(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listUserOrgSector(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchcurorguser")
	public ResponseEntity<Page<OrgUser>> searchCurOrgUserPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchCurOrgUser(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listcurorguser")
	public ResponseEntity<List<OrgUser>> listCurOrgUser(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listCurOrgUser(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchuserorg")
	public ResponseEntity<Page<OrgUser>> searchUserOrgPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchUserOrg(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listuserorg")
	public ResponseEntity<List<OrgUser>> listUserOrg(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listUserOrg(filter);
		return ResponseEntity.ok().body(searchResult);
	}
    @PostMapping(value="/searchcurorgsectorleader")
	public ResponseEntity<Page<OrgUser>> searchCurOrgSectorLeaderPage(@Validated @RequestBody OrgUserSearchFilter filter){
		Page<OrgUser> searchResult = service.searchCurOrgSectorLeader(filter);
		return ResponseEntity.ok().body(searchResult);
	}

	@PostMapping(value="/listcurorgsectorleader")
	public ResponseEntity<List<OrgUser>> listCurOrgSectorLeader(@Validated @RequestBody OrgUserSearchFilter filter){
		List<OrgUser> searchResult = service.listCurOrgSectorLeader(filter);
		return ResponseEntity.ok().body(searchResult);
	}
}
