xiangpei
2025-05-09 641b4a3b1572f3a75ce0bd7d645e34252237cf9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cn.lili.controller.permission;
 
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.StoreRole;
import cn.lili.modules.member.service.StoreRoleService;
import cn.lili.modules.permission.entity.dos.Role;
import cn.lili.modules.permission.service.RoleService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
 
/**
 * 店铺端,角色管理接口
 *
 * @author Chopper
 * @since 2020/11/20 18:50
 */
@RestController
@Api(tags = "店铺端,店铺角色管理接口")
@RequestMapping("/store/role")
public class StoreRoleController {
    @Autowired
    private StoreRoleService storeRoleService;
 
    @PostMapping
    @ApiOperation(value = "添加角色")
    public ResultMessage<StoreRole> add(StoreRole storeRole) {
        storeRoleService.saveStoreRole(storeRole);
        return ResultUtil.data(storeRole);
    }
 
    @GetMapping
    @ApiOperation(value = "查询店铺角色")
    public ResultMessage<Page> page(PageVO pageVo, StoreRole storeRole) {
        storeRole.setStoreId(UserContext.getCurrentUser().getStoreId());
        Page page = storeRoleService.page(PageUtil.initPage(pageVo), PageUtil.initWrapper(storeRole));
        return ResultUtil.data(page);
    }
 
    @PutMapping("/{roleId}")
    @ApiOperation(value = "编辑店铺角色")
    public ResultMessage<StoreRole> edit(@PathVariable String roleId, StoreRole storeRole) {
        storeRole.setId(roleId);
        storeRoleService.update(storeRole);
        return ResultUtil.data(storeRole);
    }
 
    @DeleteMapping(value = "/{ids}")
    @ApiOperation(value = "批量删除店铺角色")
    public ResultMessage<Role> delByIds(@PathVariable List<String> ids) {
        storeRoleService.deleteRoles(ids);
        return ResultUtil.success();
    }
 
 
}