diff --git a/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorStaffController.java b/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorStaffController.java index 2816240..1ae1dde 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorStaffController.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/controller/EbikeOperatorStaffController.java @@ -1,23 +1,18 @@ package com.cdzy.staff.controller; import com.cdzy.common.enums.Message; -import com.cdzy.common.model.request.PageParam; import com.cdzy.common.model.response.JsonResult; import com.cdzy.staff.model.dto.StaffInfo; -import com.cdzy.staff.model.entity.EbikeOperatorStaff; -import com.cdzy.staff.service.EbikeOperatorStaffService; import com.cdzy.staff.model.vo.StaffVo; -import com.mybatisflex.core.paginate.Page; +import com.cdzy.staff.service.EbikeOperatorStaffService; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.List; - /** * 运营商员工账户表 控制层。 * - * @author loves + * @author attiya * @since 2025-08-08 */ @RestController @@ -28,75 +23,16 @@ public class EbikeOperatorStaffController { private EbikeOperatorStaffService ebikeOperatorStaffService; /** - * 添加运营商员工账户表。 - * - * @param ebikeOperatorStaff 运营商员工账户表 - * @return {@code true} 添加成功,{@code false} 添加失败 - */ - @PostMapping("save") - public JsonResult save(@RequestBody EbikeOperatorStaff ebikeOperatorStaff) { - ebikeOperatorStaffService.save(ebikeOperatorStaff); - return JsonResult.success(); - } - - /** - * 根据主键删除运营商员工账户表。 - * - * @param id 主键 - * @return {@code true} 删除成功,{@code false} 删除失败 - */ - @PostMapping("remove/{id}") - public JsonResult remove(@PathVariable Long id) { - ebikeOperatorStaffService.removeById(id); - return JsonResult.success(); - } - - /** - * 根据主键更新运营商员工账户表。 - * - * @param ebikeOperatorStaff 运营商员工账户表 - * @return {@code true} 更新成功,{@code false} 更新失败 - */ - @PostMapping("update") - public JsonResult update(@RequestBody EbikeOperatorStaff ebikeOperatorStaff) { - ebikeOperatorStaffService.updateById(ebikeOperatorStaff); - return JsonResult.success(); - } - - /** - * 查询所有运营商员工账户表。 - * - * @return 所有数据 - */ - @GetMapping("list") - public JsonResult list() { - List list = ebikeOperatorStaffService.list(); - return JsonResult.success(list); - } - - /** - * 根据运营商员工账户表主键获取详细信息。 + * 获取当前登陆账号详情 * * @return 运营商员工账户表详情 */ @GetMapping("getStaffInfo") public JsonResult getStaffInfo() { - StaffInfo info = ebikeOperatorStaffService.getStaffInfo(); + StaffInfo info = ebikeOperatorStaffService.getStaffInfo(); return JsonResult.success(info); } - /** - * 分页查询运营商员工账户表。 - * - * @param pageParam 分页对象 - * @return 分页对象 - */ - @GetMapping("page") - public JsonResult page(PageParam pageParam) { - Page page = ebikeOperatorStaffService.page(pageParam.getPage()); - return JsonResult.success(page); - } - /** * 运营商员工登录。 * @@ -108,4 +44,16 @@ public class EbikeOperatorStaffController { String token = ebikeOperatorStaffService.login(staffVo); return JsonResult.success(Message.LOGIN,token); } + + /** + * 运营商员工登录。 + * + * @param staffVo 登录信息 + * @return 结果 + */ + @PostMapping("add") + public JsonResult add(@Validated @RequestBody StaffVo staffVo) { + ebikeOperatorStaffService.add(staffVo); + return JsonResult.success(Message.ADD_SUCCESS); + } } diff --git a/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperatorStaff.java b/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperatorStaff.java index a7111ea..9bdbf8e 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperatorStaff.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/model/entity/EbikeOperatorStaff.java @@ -36,6 +36,8 @@ public class EbikeOperatorStaff implements Serializable { private String password; + private String salt; + private Long roleId; private Long operatorId; diff --git a/ebike-staff/src/main/java/com/cdzy/staff/service/EbikeOperatorStaffService.java b/ebike-staff/src/main/java/com/cdzy/staff/service/EbikeOperatorStaffService.java index 29a4ba9..65bb40c 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/service/EbikeOperatorStaffService.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/service/EbikeOperatorStaffService.java @@ -16,4 +16,6 @@ public interface EbikeOperatorStaffService extends IService String login(StaffVo staffVo); StaffInfo getStaffInfo(); + + void add(StaffVo staffVo); } diff --git a/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorStaffServiceImpl.java b/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorStaffServiceImpl.java index d9f5089..a6e73a2 100644 --- a/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorStaffServiceImpl.java +++ b/ebike-staff/src/main/java/com/cdzy/staff/service/impl/EbikeOperatorStaffServiceImpl.java @@ -2,6 +2,7 @@ package com.cdzy.staff.service.impl; import cn.dev33.satoken.stp.StpUtil; import com.cdzy.common.ex.EbikeException; +import com.cdzy.common.utils.SHA256WithSaltUtil; import com.cdzy.staff.model.dto.StaffInfo; import com.cdzy.staff.model.entity.EbikeOperatorStaff; import com.cdzy.staff.mapper.EbikeOperatorStaffMapper; @@ -24,7 +25,7 @@ import static com.cdzy.staff.model.entity.table.EbikeOperatorStaffTableDef.EBIKE * @since 2025-08-07 */ @Service -public class EbikeOperatorStaffServiceImpl extends ServiceImpl implements EbikeOperatorStaffService{ +public class EbikeOperatorStaffServiceImpl extends ServiceImpl implements EbikeOperatorStaffService { @Resource private EbikeOperatorStaffMapper staffMapper; @@ -32,17 +33,20 @@ public class EbikeOperatorStaffServiceImpl extends ServiceImpl