Search in sources :

Example 1 with AuthResourceSort

use of com.besscroft.aurora.mall.common.entity.AuthResourceSort in project aurora-mall by besscroft.

the class ResourceSortServiceTest method updateResourceSort.

@Test
void updateResourceSort() {
    AuthResourceSort authResourceSort = AuthResourceSort.builder().id(1000L).createTime(LocalDateTime.now()).categoryName("单元测试类别").description("单元测试类别描述").sort(10L).build();
    boolean b = resourceSortService.updateResourceSort(authResourceSort);
    assertTrue(b, "更新资源类别失败!");
}
Also used : AuthResourceSort(com.besscroft.aurora.mall.common.entity.AuthResourceSort) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with AuthResourceSort

use of com.besscroft.aurora.mall.common.entity.AuthResourceSort in project aurora-mall by besscroft.

the class ResourceSortServiceTest method addResourceSort.

@Test
void addResourceSort() {
    AuthResourceSort authResourceSort = AuthResourceSort.builder().createTime(LocalDateTime.now()).categoryName("单元测试类别").description("单元测试类别描述").sort(10L).build();
    boolean b = resourceSortService.addResourceSort(authResourceSort);
    assertTrue(b, "新增资源类别失败!");
}
Also used : AuthResourceSort(com.besscroft.aurora.mall.common.entity.AuthResourceSort) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with AuthResourceSort

use of com.besscroft.aurora.mall.common.entity.AuthResourceSort in project aurora-mall by besscroft.

the class ResourceServiceImpl method getAllResourceTree.

@Override
public List<ResourceParam> getAllResourceTree() {
    List<ResourceParam> list = new ArrayList<>();
    List<AuthResourceSort> resourceSorts = authResourceSortMapper.selectList(new QueryWrapper<>());
    resourceSorts.forEach(r -> {
        ResourceParam resourceParam = new ResourceParam();
        QueryWrapper<AuthResource> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("category_id", r.getId());
        List<AuthResource> resources = this.baseMapper.selectList(queryWrapper);
        resourceParam.setName(r.getCategoryName());
        resourceParam.setDisabled(true);
        resourceParam.setChildren(resources);
        list.add(resourceParam);
    });
    return list;
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) AuthResourceSort(com.besscroft.aurora.mall.common.entity.AuthResourceSort) ResourceParam(com.besscroft.aurora.mall.admin.domain.param.ResourceParam) AuthResource(com.besscroft.aurora.mall.common.entity.AuthResource)

Example 4 with AuthResourceSort

use of com.besscroft.aurora.mall.common.entity.AuthResourceSort in project aurora-mall by besscroft.

the class ResourceSortServiceTest method getResourceSortById.

@Test
void getResourceSortById() throws JsonProcessingException {
    Long resourceSortId = 1L;
    AuthResourceSort resourceSort = resourceSortService.getResourceSortById(resourceSortId);
    assertNotNull(resourceSort, "获取资源类别详情失败!");
    LOGGER.info("资源类别详情:{}", objectMapper.writeValueAsString(resourceSort));
}
Also used : AuthResourceSort(com.besscroft.aurora.mall.common.entity.AuthResourceSort) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

AuthResourceSort (com.besscroft.aurora.mall.common.entity.AuthResourceSort)4 Test (org.junit.jupiter.api.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)1 ResourceParam (com.besscroft.aurora.mall.admin.domain.param.ResourceParam)1 AuthResource (com.besscroft.aurora.mall.common.entity.AuthResource)1