|
@@ -0,0 +1,148 @@
|
|
|
|
+package com.iotechn.unimall.admin.api.card.impl;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import com.iotechn.unimall.admin.api.card.ICircleFriendsInfoService;
|
|
|
|
+import com.iotechn.unimall.data.domain.CircleFriendsInfo;
|
|
|
|
+import com.iotechn.unimall.data.mapper.CircleFriendsInfoMapper;
|
|
|
|
+import org.apache.ibatis.session.RowBounds;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
|
+import com.iotechn.unimall.core.exception.ServiceException;
|
|
|
|
+import com.iotechn.unimall.data.util.ExcelUtil;
|
|
|
|
+import com.iotechn.unimall.data.model.Page;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 记录朋友圈信息Service业务层处理
|
|
|
|
+ *
|
|
|
|
+ * @author jlb
|
|
|
|
+ * @date 2023-05-22
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class CircleFriendsInfoServiceImpl implements ICircleFriendsInfoService {
|
|
|
|
+ @Autowired
|
|
|
|
+ private CircleFriendsInfoMapper circleFriendsInfoMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean add(CircleFriendsInfo circleFriendsInfo) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ circleFriendsInfo.setGmtCreate(now);
|
|
|
|
+ circleFriendsInfo.setGmtUpdate(now);
|
|
|
|
+ return circleFriendsInfoMapper.insert(circleFriendsInfo)>0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<CircleFriendsInfo> list(Long commonId,String head,String nickname,String content,String image,String location,String positioning,String commentFlag,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
|
+ Wrapper<CircleFriendsInfo> wrapper = new EntityWrapper<CircleFriendsInfo>();
|
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(head)) {
|
|
|
|
+ wrapper.eq("head", head);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(nickname)) {
|
|
|
|
+ wrapper.eq("nickname", nickname);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(content)) {
|
|
|
|
+ wrapper.eq("content", content);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(image)) {
|
|
|
|
+ wrapper.eq("image", image);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(location)) {
|
|
|
|
+ wrapper.eq("location", location);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(positioning)) {
|
|
|
|
+ wrapper.eq("positioning", positioning);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(commentFlag)) {
|
|
|
|
+ wrapper.eq("comment_flag", commentFlag);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
|
+ }
|
|
|
|
+ wrapper.eq("delete_flag", 0);
|
|
|
|
+ List<CircleFriendsInfo> list = circleFriendsInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
|
|
+ Integer count = circleFriendsInfoMapper.selectCount(wrapper);
|
|
|
|
+ return new Page<CircleFriendsInfo>(list, page, limit, count);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Boolean delete(String id) {
|
|
|
|
+ String[] ids = String.valueOf(id).split(",");
|
|
|
|
+ for (String tt:ids) {
|
|
|
|
+ CircleFriendsInfo tmp = circleFriendsInfoMapper.selectById(Long.parseLong(tt));
|
|
|
|
+ if(tmp != null){
|
|
|
|
+ tmp.setDeleteFlag(1l);
|
|
|
|
+ circleFriendsInfoMapper.updateById(tmp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean update(CircleFriendsInfo circleFriendsInfo) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ circleFriendsInfo.setGmtUpdate(now);
|
|
|
|
+ return circleFriendsInfoMapper.updateById(circleFriendsInfo)>0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CircleFriendsInfo get(Long id) throws ServiceException {
|
|
|
|
+ return circleFriendsInfoMapper.selectById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String export(Long commonId,String head,String nickname,String content,String image,String location,String positioning,String commentFlag,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
|
+ Wrapper<CircleFriendsInfo> wrapper = new EntityWrapper<CircleFriendsInfo>();
|
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(head)) {
|
|
|
|
+ wrapper.eq("head", head);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(nickname)) {
|
|
|
|
+ wrapper.eq("nickname", nickname);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(content)) {
|
|
|
|
+ wrapper.eq("content", content);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(image)) {
|
|
|
|
+ wrapper.eq("image", image);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(location)) {
|
|
|
|
+ wrapper.eq("location", location);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(positioning)) {
|
|
|
|
+ wrapper.eq("positioning", positioning);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(commentFlag)) {
|
|
|
|
+ wrapper.eq("comment_flag", commentFlag);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
|
+ }
|
|
|
|
+ List<CircleFriendsInfo> list = circleFriendsInfoMapper.selectList(wrapper);
|
|
|
|
+ ExcelUtil<CircleFriendsInfo> util = new ExcelUtil<CircleFriendsInfo>(CircleFriendsInfo.class);
|
|
|
|
+ return util.exportExcel(list, "操作日志");
|
|
|
|
+ }
|
|
|
|
+}
|