员工账号接口实现

This commit is contained in:
张松
2025-02-12 15:14:55 +08:00
parent 7000892d9b
commit 119ef4397d
16 changed files with 392 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ import com.czg.account.service.CommonService;
import com.czg.resp.CzgResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -11,7 +12,8 @@ import org.springframework.web.bind.annotation.RestController;
* 公共接口
* @author Administrator
*/
@RestController("/admin/common")
@RestController
@RequestMapping("/admin/common")
public class CommonController {
@Resource
private CommonService commonService;
@@ -21,7 +23,7 @@ public class CommonController {
* @param type 验证码类型
* @return 是否成功
*/
@PostMapping
@PostMapping("/sms")
public CzgResult<Boolean> sendSms(@RequestParam String type) {
return CzgResult.success(commonService.sendSms(type));
}

View File

@@ -0,0 +1,75 @@
package com.czg.controller;
import com.czg.account.dto.staff.ShopStaffAddDTO;
import com.czg.account.dto.staff.ShopStaffEditDTO;
import com.czg.account.dto.staff.ShopStaffRemoveDTO;
import com.czg.account.entity.ShopStaff;
import com.czg.account.service.ShopStaffService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 店铺员工管理
*
* @author Administrator
*/
@RestController
@RequestMapping("/admin/shopStaff")
public class ShopStaffController {
@Resource
private ShopStaffService shopStaffService;
/**
* 员工列表
* 权限标识: shopStaff:list
* @param name 账号名
* @param code 员工编号
* @return 分页数据
*/
@SaAdminCheckPermission("shopStaff:list")
@GetMapping
public CzgResult<Page<ShopStaff>> list(String name, String code) {
return CzgResult.success(shopStaffService.get(name, code));
}
/**
* 员工添加
* 权限标识: shopStaff:add
* @param shopStaffAddDTO 添加信息
* @return 是否成功
*/
@SaAdminCheckPermission("shopStaff:add")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopStaffAddDTO shopStaffAddDTO) {
return CzgResult.success(shopStaffService.add(shopStaffAddDTO));
}
/**
* 员工修改
* 权限标识: shopStaff:edit
* @param shopStaffEditDTO 添加信息
* @return 是否成功
*/
@SaAdminCheckPermission("shopStaff:edit")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopStaffEditDTO shopStaffEditDTO) {
return CzgResult.success(shopStaffService.edit(shopStaffEditDTO));
}
/**
* 员工删除
* 权限标识: shopStaff:del
* @param shopStaffRemoveDTO 删除信息
* @return 是否成功
*/
@SaAdminCheckPermission("shopStaff:del")
@DeleteMapping
public CzgResult<Boolean> delete(@RequestBody @Validated ShopStaffRemoveDTO shopStaffRemoveDTO) {
return CzgResult.success(shopStaffService.delete(shopStaffRemoveDTO));
}
}