package com.xcong.excoin.modules.agent.controller; import com.xcong.excoin.common.controller.BaseController; import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.agent.pojo.AgentUser; import com.xcong.excoin.modules.agent.service.IAgentService; import com.xcong.excoin.system.entity.User; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.Map; /** * @author wzy * @date 2020-06-11 **/ @Slf4j @Validated @RestController @RequiredArgsConstructor @RequestMapping("/agent") public class AgentController extends BaseController { private final IAgentService agentService; @GetMapping("getList") @RequiresPermissions("agent:view") public FebsResponse getList(AgentUser agentUser, QueryRequest queryRequest) { Map map = getDataTable(agentService.findAgentList(agentUser, queryRequest)); return new FebsResponse().success().data(map); } @PostMapping("add") @RequiresPermissions("agent:add") public FebsResponse add(@Valid AgentUser agentUser) { User user = getCurrentUser(); agentService.addAgent(agentUser, user); return new FebsResponse().success(); } }