| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.enums.CauseEnums; |
| | |
| | | import com.example.jz.service.CauseService; |
| | | import com.example.jz.service.ReportService; |
| | | import com.example.jz.service.UserService; |
| | | import com.example.jz.utils.IdUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | |
| | | Cause cause = new Cause(); |
| | | BeanUtils.copyProperties(causeDto, cause); |
| | | cause.setId(id); |
| | | groupDao.update(null, Wrappers.lambdaUpdate(Group.class) |
| | | .set(Group::getGroupName, causeDto.getName()) |
| | | .eq(Group::getCauseId, id)); |
| | | return causeDao.updateById(cause); |
| | | } |
| | | |
| | |
| | | public void deleteCause(Integer id) { |
| | | causeDao.deleteById(id); |
| | | Group group = groupDao.selectOne(new LambdaQueryWrapper<Group>().eq(Group::getCauseId, id)); |
| | | if (group!=null){ |
| | | messageDao.delete(new LambdaQueryWrapper<Message>().eq(Message::getGroupId,group.getId())); |
| | | groupUserDao.delete(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getGroupId,group.getId())); |
| | | if (group != null) { |
| | | messageDao.delete(new LambdaQueryWrapper<Message>().eq(Message::getGroupId, group.getId())); |
| | | groupUserDao.delete(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getGroupId, group.getId())); |
| | | } |
| | | groupDao.delete(new QueryWrapper<Group>().eq("cause_id", id)); |
| | | } |
| | |
| | | a -> { |
| | | Cause cause = new Cause(); |
| | | BeanUtils.copyProperties(a, cause); |
| | | cause.setNumber(IdUtils.getAduitId()); |
| | | if (StringUtils.isBlank(a.getStatus())) { |
| | | throw new BusinessException("状态不能为空"); |
| | | } |
| | |
| | | @Override |
| | | public List<Map<String, String>> getCauseIdAndName() { |
| | | ArrayList<Map<String, String>> maps = new ArrayList<>(); |
| | | causeDao.selectList(null).stream().forEach(a -> { |
| | | causeDao.selectList(new QueryWrapper<Cause>().eq("status", 0).or().eq("status", 2)).stream().forEach(a -> { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("id", a.getId().toString()); |
| | | map.put("name", a.getName()); |