| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import com.ruoyi.projectManagement.dto.RoleDto; |
| | | import com.ruoyi.projectManagement.mapper.RolesMapper; |
| | | import com.ruoyi.projectManagement.pojo.Roles; |
| | |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | |
| | | private RolesMapper rolesMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @PreAuthorize("@ss.hasPermi('project:legacy:query')") |
| | | @Operation(summary = "分页查询所有") |
| | | public AjaxResult listPage(Page<Roles> page, Roles roles) { |
| | | return AjaxResult.success(rolesservice.listPage(page, roles)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @PreAuthorize("@ss.hasPermi('project:legacy:maintain')") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody RoleDto roleDto) { |
| | | if (roleDto.getIsDefaultNo()) { |
| | | roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no")); |
| | | roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no", roleDto.getCreateTime() != null ? roleDto.getCreateTime() : LocalDateTime.now())); |
| | | } |
| | | return AjaxResult.success(rolesservice.save(roleDto)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @PreAuthorize("@ss.hasPermi('project:legacy:maintain')") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody Roles roles) { |
| | | return AjaxResult.success(rolesservice.updateById(roles)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @PreAuthorize("@ss.hasPermi('project:legacy:maintain')") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | |
| | | } |
| | | |
| | | @PostMapping("/listSimpleRole") |
| | | @PreAuthorize("@ss.hasPermi('project:legacy:query')") |
| | | public AjaxResult listSimpleRole() { |
| | | return AjaxResult.success(rolesservice.listSimpleRole()); |
| | | } |