| | |
| | | package com.gkhy.exam.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.exam.common.exception.ApiException; |
| | | import com.gkhy.exam.common.utils.NaturalOrderComparator; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.system.domain.SysClauseManagement; |
| | | import com.gkhy.exam.system.mapper.SysClauseManagementMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<SysClauseManagement> getSysClauseManagements() { |
| | | LambdaQueryWrapper<SysClauseManagement> lambdaQueryWrapper = Wrappers.<SysClauseManagement>lambdaQuery() |
| | | .eq(SysClauseManagement::getDelFlag, "0").orderByAsc(SysClauseManagement::getClauseNum); |
| | | return baseMapper.selectList(lambdaQueryWrapper); |
| | | List<SysClauseManagement> sysClauseManagements = baseMapper.selectList(lambdaQueryWrapper); |
| | | if (ObjectUtil.isNotEmpty(sysClauseManagements)){ |
| | | sysClauseManagements.sort(Comparator.comparing(SysClauseManagement::getClauseNum, new NaturalOrderComparator())); |
| | | } |
| | | |
| | | return sysClauseManagements; |
| | | } |
| | | |
| | | @Override |
| | | public int saveSysClauseManagement(SysClauseManagement sysClauseManagement) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | throw new ApiException("没有权限访问!"); |
| | | } |
| | | LambdaQueryWrapper<SysClauseManagement> lambdaQueryWrapper = Wrappers.<SysClauseManagement>lambdaQuery() |
| | |
| | | |
| | | @Override |
| | | public int delSysClauseManagement(Long id) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | throw new ApiException("没有权限访问!"); |
| | | } |
| | | //todo 校验已使用的? |