记得上下班打卡 | git大法好,push需谨慎

Commit f3de844a authored by zhengfuxin's avatar zhengfuxin

修改热词问题

parent 6c7d1c1f
......@@ -47,10 +47,10 @@ public class GoblinFrontHotWordController extends BaseController {
return error("操作失败");
}
}
@PostMapping("update")
@ApiOperation(value = "修改热词")
@PostMapping("updateOrCreate")
@ApiOperation(value = "修改或者增加热词")
@ResponseBody
public AjaxResult update(@RequestBody GoblinFrontHotWordBuildParam goblinFrontHotWordBuildParam) {
public AjaxResult updateOrCreate(@RequestBody GoblinFrontHotWordBuildParam goblinFrontHotWordBuildParam) {
GoblinFrontHotWord goblinFrontHotWord=new GoblinFrontHotWord();
BeanUtils.copyProperties(goblinFrontHotWordBuildParam,goblinFrontHotWord);
logger.info("修改热词{}", JSON.toJSONString(goblinFrontHotWord));
......@@ -61,6 +61,13 @@ public class GoblinFrontHotWordController extends BaseController {
return error("操作失败");
}
}
@PostMapping("list")
@ApiOperation(value = "list")
@ResponseBody
public AjaxResult page( ) {
return AjaxResult.success(goblinFrontHotWordService.list());
}
@PostMapping("delete")
@ApiOperation(value = "删除热词")
@ResponseBody
......
......@@ -63,9 +63,15 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor
* @date 2021/12/27 下午4:03
*/
public boolean update(GoblinFrontHotWord goblinFrontHotWord){
goblinFrontHotWord.setUpdateTime(LocalDateTime.now());
//数据库修改
goblinFrontHotWordMapper.updateById(goblinFrontHotWord);
if(goblinFrontHotWord.getMid()==0){
this.create(goblinFrontHotWord);
}else{
goblinFrontHotWord.setUpdateTime(LocalDateTime.now());
//数据库修改
goblinFrontHotWordMapper.updateById(goblinFrontHotWord);
}
/*//mongodb修改
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontHotWord)));
mongoTemplate.getCollection(GoblinFrontHotWord.class.getSimpleName()).updateOne(
......@@ -100,6 +106,13 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor
this.update(goblinFrontHotWord);
return true;
}
public List<GoblinFrontHotWord> list(){
LambdaQueryWrapper<GoblinFrontHotWord> queryWrapper = Wrappers.lambdaQuery(GoblinFrontHotWord.class);
queryWrapper.ne(GoblinFrontHotWord::getDelTag,1);
queryWrapper.orderByDesc(GoblinFrontHotWord::getCreateTime);
List<GoblinFrontHotWord> list=goblinFrontHotWordMapper.selectList(queryWrapper);
return list;
}
/**
* @author zhangfuxin
* @Description:分页
......
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