package com.cdzy.staff.controller; import com.cdzy.common.model.request.PageParam; import com.cdzy.common.model.response.JsonResult; import com.cdzy.staff.model.entity.EbikeStaffRole; import com.cdzy.staff.service.EbikeStaffRoleService; import com.mybatisflex.core.paginate.Page; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 员工-角色映射表 控制层。 * * @author loves * @since 2025-08-08 */ @RestController @RequestMapping("/ebikeStaffRole") public class EbikeStaffRoleController { @Resource private EbikeStaffRoleService ebikeStaffRoleService; /** * 添加员工-角色映射表。 * * @param ebikeStaffRole 员工-角色映射表 * @return {@code true} 添加成功,{@code false} 添加失败 */ @PostMapping("save") public JsonResult save(@RequestBody EbikeStaffRole ebikeStaffRole) { ebikeStaffRoleService.save(ebikeStaffRole); return JsonResult.success(); } /** * 根据主键删除员工-角色映射表。 * * @param id 主键 * @return {@code true} 删除成功,{@code false} 删除失败 */ @PostMapping("remove/{id}") public JsonResult remove(@PathVariable Long id) { ebikeStaffRoleService.removeById(id); return JsonResult.success(); } /** * 根据主键更新员工-角色映射表。 * * @param ebikeStaffRole 员工-角色映射表 * @return {@code true} 更新成功,{@code false} 更新失败 */ @PostMapping("update") public JsonResult update(@RequestBody EbikeStaffRole ebikeStaffRole) { ebikeStaffRoleService.updateById(ebikeStaffRole); return JsonResult.success(); } /** * 查询所有员工-角色映射表。 * * @return 所有数据 */ @GetMapping("list") public JsonResult list() { List list = ebikeStaffRoleService.list(); return JsonResult.success(list); } /** * 根据员工-角色映射表主键获取详细信息。 * * @param id 员工-角色映射表主键 * @return 员工-角色映射表详情 */ @GetMapping("getInfo/{id}") public JsonResult getInfo(@PathVariable Long id) { EbikeStaffRole staffRole = ebikeStaffRoleService.getById(id); return JsonResult.success(staffRole); } /** * 分页查询员工-角色映射表。 * * @param pageParam 分页对象 * @return 分页对象 */ @GetMapping("page") public JsonResult page(PageParam pageParam) { Page rolePage = ebikeStaffRoleService.page(pageParam.getPage()); return JsonResult.success(rolePage); } }