Commit 76b085ab authored by 罗林杰's avatar 罗林杰

修改关注

parent fca9b11f
......@@ -11,8 +11,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.servlet.http.HttpServletResponse;
import org.imgscalr.Scalr;
import org.rcisoft.business.memInfo.entity.MemFollowDTO;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.MemInfoService;
import org.rcisoft.core.anno.CyEncryptSm4Anno;
......@@ -27,11 +26,9 @@ import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.result.enums.CyResSysExcEnum;
import org.rcisoft.core.service.CyFileStorageService;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -44,7 +41,6 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* Created by cy on 2024年12月20日 下午3:35:34.
......@@ -273,4 +269,28 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
memInfo);
}
@CyOpeLogAnno(title = "system-会员关注-会员关注", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="会员关注", description="会员关注")
@PostMapping(value = "/open/memInfo/follow")
@CyEncryptSm4Anno
public Integer follow( @RequestBody MemFollowDTO followDTO) {
return memInfoServiceImpl.addFollow(followDTO);
}
@CyOpeLogAnno(title = "system-会员关注-查询是否关注", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询是否关注", description="查询是否关注")
@GetMapping(value = "/open/memInfo/isFollow")
@CyEncryptSm4Anno
public MemFollowDTO isFollow(MemFollowDTO followDTO) {
return memInfoServiceImpl.isFollow(followDTO);
}
@CyOpeLogAnno(title = "system-会员取消关注-会员取消关注", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="会员取消关注", description="会员取消关注")
@PostMapping(value = "/open/memInfo/followDelete")
@CyEncryptSm4Anno
public Integer followDelete( @RequestBody MemFollowDTO followDTO) {
return memInfoServiceImpl.deleteFollow(followDTO);
}
}
package org.rcisoft.business.memInfo.dao;
import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.memInfo.entity.ArticleExamStatus;
import org.rcisoft.business.memInfo.entity.opmArticleDTO;
import org.rcisoft.business.memInfo.entity.peopleNumberDTO;
import org.rcisoft.business.memInfo.entity.*;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.sys.rbac.user.dto.SysUserRbacDTO;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo;
......@@ -99,5 +97,11 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
* @return
*/
MemInfo selectByOpenId(String openId);
Integer addFollow(@Param("entity") MemFollowDTO followDTO);
MemFollowDTO getFollow(@Param("entity") MemFollowDTO followDTO);
Integer deleteFollow(@Param("entity") MemFollowDTO followDTO);
}
package org.rcisoft.business.memInfo.entity;
import lombok.Data;
@Data
public class MemFollowDTO {
private Integer userId;
private Integer targetId;
private Integer isFollowed;
}
package org.rcisoft.business.memInfo.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.business.memInfo.entity.ArticleExamStatus;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.entity.opmArticleDTO;
import org.rcisoft.business.memInfo.entity.peopleNumberDTO;
import org.rcisoft.business.memInfo.entity.*;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
......@@ -95,4 +90,10 @@ public interface MemInfoService {
CyPersistModel checkIdCard(MemInfo memInfo);
CyPersistModel update(MemInfo memInfo);
Integer addFollow(MemFollowDTO followDTO);
MemFollowDTO isFollow(MemFollowDTO followDTO);
Integer deleteFollow(MemFollowDTO followDTO);
}
......@@ -7,9 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import org.rcisoft.alibaba.faceVerify.bean.FaceVerifyAliComp;
import org.rcisoft.alibaba.faceVerify.bean.FaceVerifyRedisBean;
import org.rcisoft.business.memInfo.bean.MemberGenerateBean;
import org.rcisoft.business.memInfo.entity.ArticleExamStatus;
import org.rcisoft.business.memInfo.entity.opmArticleDTO;
import org.rcisoft.business.memInfo.entity.peopleNumberDTO;
import org.rcisoft.business.memInfo.entity.*;
import org.rcisoft.core.constant.CyDelStaCons;
import org.rcisoft.core.constant.CyFlagStaCons;
import org.rcisoft.core.exception.CyServiceException;
......@@ -17,7 +15,6 @@ import org.rcisoft.core.service.CyRedisService;
import org.rcisoft.core.util.*;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.MemInfoService;
import org.rcisoft.sys.constant.CyUserCons;
......@@ -500,4 +497,37 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ memInfo.getBusinessId()+"的会员表信息");
return new CyPersistModel(line);
}
/**
* 添加关注
*
* @param followDTO
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public Integer addFollow(MemFollowDTO followDTO){
return baseMapper.addFollow(followDTO);
}
/**
* 查询是否关注
*
* @param followDTO
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public MemFollowDTO isFollow(MemFollowDTO followDTO){
return baseMapper.getFollow(followDTO);
}
/**
* 取消关注
*
* @param followDTO
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public Integer deleteFollow(MemFollowDTO followDTO){
return baseMapper.deleteFollow(followDTO);
}
}
......@@ -519,6 +519,16 @@
parameterType="java.lang.String">
select * from mem_info where wx_openid = #{openId} and del_flag = 0
</select>
<select id="getFollow" resultType="org.rcisoft.business.memInfo.entity.MemFollowDTO" parameterType="org.rcisoft.business.memInfo.entity.MemFollowDTO">
SELECT MAX(CASE WHEN ouf.business_id IS NOT NULL THEN 1 ELSE 0 END) AS isFollowed
FROM (SELECT 1 AS dummy) d LEFT JOIN opm_user_follow ouf ON ouf.user_id = #{entity.userId} AND ouf.target_id = #{entity.targetId};
</select>
<delete id="deleteFollow" parameterType="org.rcisoft.business.memInfo.entity.MemFollowDTO">
delete from opm_user_follow
where user_id = #{entity.userId} and target_id = #{entity.targetId}
</delete>
<insert id="addFollow" parameterType="org.rcisoft.business.memInfo.entity.MemFollowDTO">
insert into opm_user_follow (target_id,user_id)
values(#{entity.targetId},#{entity.userId})
</insert>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment