|
@@ -0,0 +1,83 @@
|
|
|
|
+package com.dragon.tj.portal.service.impl;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.dragon.tj.portal.auth.model.LoginUser;
|
|
|
|
+import com.dragon.tj.portal.entity.IssueInfo;
|
|
|
|
+import com.dragon.tj.portal.entity.PageParam;
|
|
|
|
+import com.dragon.tj.portal.mapper.IssueInfoMapper;
|
|
|
|
+import com.dragon.tj.portal.service.IssueService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class IssueServiceImpl implements IssueService {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IssueInfoMapper issueInfoMapper;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * CRUD
|
|
|
|
+ * */
|
|
|
|
+ @Override
|
|
|
|
+ public int addIssue(IssueInfo issueInfo, LoginUser loginUser) {
|
|
|
|
+ issueInfo.setCreateUser(loginUser.getUsername());
|
|
|
|
+ issueInfo.setCreateUserIdcard(loginUser.getIdCard());
|
|
|
|
+ return issueInfoMapper.insert(issueInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int deleteIssue(Long id) {
|
|
|
|
+ IssueInfo issueInfo = new IssueInfo();
|
|
|
|
+ issueInfo.setId(id);
|
|
|
|
+ issueInfo.setDelFlag(1);
|
|
|
|
+
|
|
|
|
+ return issueInfoMapper.updateById(issueInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int updateIssue(IssueInfo issueInfo) {
|
|
|
|
+ return issueInfoMapper.updateById(issueInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public IssueInfo detail(Long id) {
|
|
|
|
+ return issueInfoMapper.selectById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 搜索
|
|
|
|
+ * */
|
|
|
|
+ @Override
|
|
|
|
+ public Page<IssueInfo> search(PageParam<IssueInfo> issueInfoPage) {
|
|
|
|
+
|
|
|
|
+ IssueInfo issueInfo = issueInfoPage.getParams();
|
|
|
|
+ Page<IssueInfo> rowPage = new Page(issueInfoPage.getPage(), issueInfoPage.getSize());
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<IssueInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+
|
|
|
|
+ //标题
|
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(issueInfo.getTitle()),
|
|
|
|
+ IssueInfo::getTitle, issueInfo.getTitle());
|
|
|
|
+ //内容
|
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(issueInfo.getContent()),
|
|
|
|
+ IssueInfo::getContent, issueInfo.getContent());
|
|
|
|
+
|
|
|
|
+ //创建人
|
|
|
|
+ queryWrapper.eq(StringUtils.isNotEmpty(issueInfo.getCreateUser()),
|
|
|
|
+ IssueInfo::getCreateUser, issueInfo.getCreateUser());
|
|
|
|
+ queryWrapper.eq(StringUtils.isNotEmpty(issueInfo.getCreateUserIdcard()),
|
|
|
|
+ IssueInfo::getCreateUserIdcard, issueInfo.getCreateUserIdcard());
|
|
|
|
+
|
|
|
|
+ queryWrapper.eq(issueInfo.getDelFlag() != null,
|
|
|
|
+ IssueInfo::getDelFlag, issueInfo.getDelFlag());
|
|
|
|
+
|
|
|
|
+ queryWrapper.orderByDesc(IssueInfo::getCreateTime);
|
|
|
|
+
|
|
|
|
+ return issueInfoMapper.selectPage(rowPage, queryWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|