|
@@ -7,11 +7,15 @@ import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.SearchRecordsInfo;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.TranProcessInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.SearchRecordsInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ISearchRecordsInfoService;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -23,19 +27,29 @@ import org.springframework.stereotype.Service;
|
|
|
*/
|
|
|
@Service
|
|
|
public class SearchRecordsInfoServiceImpl extends ServiceImpl<SearchRecordsInfoMapper, SearchRecordsInfo> implements ISearchRecordsInfoService {
|
|
|
+ @Autowired
|
|
|
+ private ISearchRecordsInfoService searchRecordsInfoService;
|
|
|
/**
|
|
|
* 删除搜索记录
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @param comId
|
|
|
*/
|
|
|
@Override
|
|
|
- public void deleteSearchRecordsInfo(String id) {
|
|
|
+ public void deleteSearchRecordsInfo(String comId) {
|
|
|
//查询搜索记录
|
|
|
- SearchRecordsInfo searchRecordsInfo = this.selectById(id);
|
|
|
- if (searchRecordsInfo != null) {
|
|
|
+ //判断记录是否存在
|
|
|
+ List<SearchRecordsInfo> searchRecordsInfos =
|
|
|
+ this.selectList(new EntityWrapper<SearchRecordsInfo>()
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.COMP_ID, AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
+ //已存在
|
|
|
+ if (searchRecordsInfos.size()>0) {
|
|
|
//删除搜索记录
|
|
|
- this.deleteById(searchRecordsInfo);
|
|
|
+ for (SearchRecordsInfo searchRecordsInfo : searchRecordsInfos) {
|
|
|
+ searchRecordsInfoService.deleteById(searchRecordsInfo.getId());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -51,7 +65,7 @@ public class SearchRecordsInfoServiceImpl extends ServiceImpl<SearchRecordsInfoM
|
|
|
this.selectOne(new EntityWrapper<SearchRecordsInfo>()
|
|
|
.eq(SearchRecordsInfo.QueryFiles.COMP_ID, AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
.eq("search_content", searchRecordsInfo.getSearchContent())
|
|
|
- .eq(ContractManagementInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
//已存在,次数加1
|
|
|
if (searchRecordsInfo1 != null) {
|
|
|
Long count = searchRecordsInfo1.getSearchCount() + 1;
|
|
@@ -78,8 +92,8 @@ public class SearchRecordsInfoServiceImpl extends ServiceImpl<SearchRecordsInfoM
|
|
|
public Page<SearchRecordsInfo> selectSearchRecordsInfo(SearchRecordsInfo searchRecordsInfo) {
|
|
|
//查询搜索记录
|
|
|
Page<SearchRecordsInfo> searchRecordsInfoPage = this.selectPage(searchRecordsInfo.getQueryPage(), new EntityWrapper<SearchRecordsInfo>()
|
|
|
- .eq("id", searchRecordsInfo.getId())
|
|
|
- .eq("comp_id", searchRecordsInfo.getCompId())
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.COMP_ID, AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)
|
|
|
.orderBy("update_date", false));
|
|
|
return searchRecordsInfoPage;
|
|
|
}
|
|
@@ -92,9 +106,9 @@ public class SearchRecordsInfoServiceImpl extends ServiceImpl<SearchRecordsInfoM
|
|
|
*/
|
|
|
public Page<SearchRecordsInfo> selectRecommendedSearchRecordsInfo(SearchRecordsInfo searchRecordsInfo) {
|
|
|
Page<SearchRecordsInfo> RecommendedSearchRecordsInfoPage = this.selectPage(searchRecordsInfo.getQueryPage(), new EntityWrapper<SearchRecordsInfo>()
|
|
|
- .eq("id", searchRecordsInfo.getId())
|
|
|
- .eq("compId", searchRecordsInfo.getCompId())
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.COMP_ID, AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
.gt("searchCount", "5")
|
|
|
+ .eq(SearchRecordsInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)
|
|
|
.orderBy("update_date", false));
|
|
|
return RecommendedSearchRecordsInfoPage;
|
|
|
}
|