New file |
| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import com.ycl.platform.base.BaseSelect; |
| | | import com.ycl.platform.domain.entity.TCheckPublish; |
| | | import com.ycl.platform.mapper.TCheckPublishMapper; |
| | | import com.ycl.platform.service.ITCheckPublishService; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.entity.SysDept; |
| | | import com.ycl.system.entity.SysUser; |
| | | import com.ycl.system.mapper.SysUserMapper; |
| | | import com.ycl.system.model.LoginUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import utils.DateUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 考核发布Service业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-03-07 |
| | | */ |
| | | @Service |
| | | public class TCheckPublishServiceImpl implements ITCheckPublishService |
| | | { |
| | | @Autowired |
| | | private TCheckPublishMapper tCheckPublishMapper; |
| | | @Autowired |
| | | private SysUserMapper userMapper; |
| | | /** |
| | | * 查询考核发布 |
| | | * |
| | | * @param id 考核发布主键 |
| | | * @return 考核发布 |
| | | */ |
| | | @Override |
| | | public TCheckPublish selectTCheckPublishById(Long id) |
| | | { |
| | | return tCheckPublishMapper.selectTCheckPublishById(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询考核发布列表 |
| | | * |
| | | * @param tCheckPublish 考核发布 |
| | | * @return 考核发布 |
| | | */ |
| | | @Override |
| | | public List<TCheckPublish> selectTCheckPublishList(TCheckPublish tCheckPublish) |
| | | { |
| | | return tCheckPublishMapper.selectTCheckPublishList(tCheckPublish); |
| | | } |
| | | |
| | | /** |
| | | * 新增考核发布 |
| | | * |
| | | * @param tCheckPublish 考核发布 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertTCheckPublish(TCheckPublish tCheckPublish) |
| | | { |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | tCheckPublish.setCreateTime(nowDate); |
| | | tCheckPublish.setUpdateTime(nowDate); |
| | | LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | tCheckPublish.setCreateUser(user.getUserId()); |
| | | tCheckPublish.setCreateUserName(user.getUsername()); |
| | | tCheckPublish.setUpdateUser(user.getUserId()); |
| | | tCheckPublish.setUpdateUserName(user.getUsername()); |
| | | return tCheckPublishMapper.insertTCheckPublish(tCheckPublish); |
| | | } |
| | | |
| | | /** |
| | | * 修改考核发布 |
| | | * |
| | | * @param tCheckPublish 考核发布 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateTCheckPublish(TCheckPublish tCheckPublish) |
| | | { |
| | | tCheckPublish.setUpdateTime(DateUtils.getNowDate()); |
| | | LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | tCheckPublish.setUpdateUser(user.getUserId()); |
| | | tCheckPublish.setUpdateUserName(user.getUsername()); |
| | | return tCheckPublishMapper.updateTCheckPublish(tCheckPublish); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除考核发布 |
| | | * |
| | | * @param ids 需要删除的考核发布主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteTCheckPublishByIds(Long[] ids) |
| | | { |
| | | return tCheckPublishMapper.deleteTCheckPublishByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * 删除考核发布信息 |
| | | * |
| | | * @param id 考核发布主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteTCheckPublishById(Long id) |
| | | { |
| | | return tCheckPublishMapper.deleteTCheckPublishById(id); |
| | | } |
| | | /** |
| | | * 下拉列表 |
| | | * */ |
| | | @Override |
| | | public Result all() { |
| | | List<BaseSelect> vos = tCheckPublishMapper.selectTCheckPublishList(new TCheckPublish()).stream().map(checkPublish -> { |
| | | BaseSelect baseSelect = new BaseSelect(); |
| | | baseSelect.setId(Integer.parseInt(checkPublish.getId() + "")); |
| | | baseSelect.setValue(checkPublish.getExamineName()); |
| | | return baseSelect; |
| | | } |
| | | ).collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | } |