便利查询--指定用户有权限直接获取当前数据库部分数据
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.DesignMapper;
|
||||
import com.ai.da.mapper.TrialOrderMapper;
|
||||
import com.ai.da.mapper.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.UserDesignStatisticDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "便利查询")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/inquiry")
|
||||
public class ConvenientInquiryController {
|
||||
|
||||
@Resource
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@ApiOperation("获取当前所有试用用户")
|
||||
@GetMapping("/getTrial")
|
||||
public Response<List<TrialOrder>> getTrial(){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)){
|
||||
List<TrialOrder> trialOrders = trialOrderMapper.selectList(null);
|
||||
return Response.success(trialOrders);
|
||||
}else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime,@RequestParam String endTime){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)){
|
||||
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime);
|
||||
return Response.success(designStatistic);
|
||||
}else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user