提交 6e17a840 作者: yuanhaojie

智库关联ott接口

上级 e5e191de
...@@ -125,6 +125,18 @@ public class ThinktankBasicInfoController { ...@@ -125,6 +125,18 @@ public class ThinktankBasicInfoController {
} }
/** /**
* 智库关联ott
* @param baseCode 智库编码
* @param ottCode ott主键
* @return
*/
@GetMapping("relation")
public Result<?> relation(String baseCode, String ottCode) {
thinktankBasicInfoService.relation(baseCode,ottCode);
return Result.OK("操作成功");
}
/**
* 已收藏智库列表 * 已收藏智库列表
* @return * @return
*/ */
......
...@@ -3,6 +3,7 @@ package com.zzsn.thinktank.mapper; ...@@ -3,6 +3,7 @@ package com.zzsn.thinktank.mapper;
import com.zzsn.thinktank.entity.ThinktankBasicInfo; import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.entity.ThinktankOttInfo; import com.zzsn.thinktank.entity.ThinktankOttInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
...@@ -62,4 +63,28 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> { ...@@ -62,4 +63,28 @@ public interface ThinktankOttInfoMapper extends BaseMapper<ThinktankOttInfo> {
@Update("delete from thinktank_collect where base_code = #{baseCode} and user_id = #{userId}") @Update("delete from thinktank_collect where base_code = #{baseCode} and user_id = #{userId}")
int cancelCollect(@Param("baseCode") String baseCode,@Param("userId") String userId); int cancelCollect(@Param("baseCode") String baseCode,@Param("userId") String userId);
/**
* 智库关联ott
* @param baseCode 智库表智库编码
* @param ottCode ott表主键
*/
@Insert("insert into thinktank_base_ott_relation(base_code,ott_code) values (#{baseCode},#{ottCode})")
void addRelation(String baseCode, String ottCode);
/**
* 根据智库编码查询已关联ott
* @param baseCode 智库编码
* @return
*/
@Select("select ott_code from thinktank_base_ott_relation where base_code = #{baseCode}")
String getRelation(String baseCode);
/**
* 更新智库已关联的ott
* @param baseCode 智库编码
* @param ottCode ott表主键
*/
@Update("update thinktank_base_ott_relation set ott_code = #{ottCode} where base_code = #{baseCode}")
void updateRelation(String baseCode, String ottCode);
} }
...@@ -35,6 +35,8 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo> ...@@ -35,6 +35,8 @@ public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo>
void collect(String id, String userId); void collect(String id, String userId);
void relation(String baseCode, String ottCode);
List<ThinktankBasicInfo> collectList(String userId); List<ThinktankBasicInfo> collectList(String userId);
Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo); Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
......
...@@ -296,6 +296,24 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf ...@@ -296,6 +296,24 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
} }
} }
/**
* 智库关联ott
* @param baseCode 智库编码
* @param ottCode ott表主键
*/
@Override
public void relation(String baseCode, String ottCode) {
String relation = thinktankOttInfoMapper.getRelation(baseCode);
if (relation != null || !"".equals(relation)) {
// 已关联
thinktankOttInfoMapper.updateRelation(baseCode,ottCode);
} else {
// 未关联
thinktankOttInfoMapper.addRelation(baseCode,ottCode);
}
}
@Override @Override
public List<ThinktankBasicInfo> collectList(String userId) { public List<ThinktankBasicInfo> collectList(String userId) {
List<ThinktankBasicInfo> collectList = thinktankOttInfoMapper.getCollectList(userId); List<ThinktankBasicInfo> collectList = thinktankOttInfoMapper.getCollectList(userId);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论