提交 9adecf52 authored 作者: yucaiwei's avatar yucaiwei

--no commit message

上级 5f79ea1a
......@@ -20,6 +20,7 @@ import tk.mybatis.mapper.entity.Example.Criteria;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.enums.AuditStatusEnum;
import com.zrqx.core.enums.BooleanStatusEnum;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.exception.ParameterValidateException;
......@@ -50,6 +51,7 @@ public class HotSearchWordController {
throw new BusinessValidateException("该热词已存在");
}
entity.setAuditStatus(AuditStatusEnum.STATUS_1.getCode());
entity.setShowState(Integer.parseInt(BooleanStatusEnum.NO.getCode()));
entity.setSearchCount(0);
if(!service.insert(entity)){
throw new BusinessValidateException("操作失败");
......
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -44,4 +45,24 @@ public class FgHotSearchWordController {
return fgHotSearchWordService.updateSearchCount(oid) ? CallBack.success() : CallBack.fail();
}
@ApiOperation(value = "通过增加热搜词搜索数")
@PostMapping(value = SysUserRequestPath.UPDATE)
public CallBack<Boolean> updateSearch(@RequestBody String content){
boolean b = false;
HotSearchWord hotSearchWord = new HotSearchWord();
hotSearchWord.setHotSearchWord(content);
HotSearchWord word = fgHotSearchWordService.selectOne(hotSearchWord);
if(word != null){
word.setSearchCount(word.getSearchCount()+1);
b = fgHotSearchWordService.updateByPrimaryKeySelective(word);
}else{
hotSearchWord.setAuditStatus(1);
hotSearchWord.setShowState(0);
hotSearchWord.setSort(0);
hotSearchWord.setSearchCount(1);
b = fgHotSearchWordService.insert(hotSearchWord);
}
return CallBack.success(b);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论