feat:标签

desc:标签添加是否显示字段
main
zjb 11 months ago
parent 88a4034a6b
commit a165ba794f

@ -65,6 +65,16 @@ public class TagInfoController {
return Result.success();
}
@ApiOperation(value = "更新标签是否显示", notes = "更新标签是否显示")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标签ID", required = true),
@ApiImplicitParam(name = "show", value = "是否显示", required = true) })
@PutMapping("/show/{id}")
public Result<Void> updateShow(@PathVariable String id, @RequestParam Integer show) {
tagService.updateIsShow(id, show);
return Result.success();
}
@ApiOperation(value = "删除标签信息", notes = "删除标签信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@DeleteMapping("/{id}")

@ -24,6 +24,11 @@ public interface TagDao extends JpaRepository<Tag, String>, JpaSpecificationExec
"updaterId=:#{#updateTag.updaterId} where id=:#{#updateTag.id}")
void updateStateById(Tag updateTag);
@Modifying
@Query(value = "update Tag set isShow=:#{#updateTag.isShow}, updateTime=:#{#updateTag.updateTime}, " +
"updaterId=:#{#updateTag.updaterId} where id=:#{#updateTag.id}")
void updateShowById(Tag updateTag);
@Modifying
@Query(value = "update Tag set state=:#{#updateTag.state}, updateTime=:#{#updateTag.updateTime}, " +
"updaterId=:#{#updateTag.updaterId} where parentId=:#{#updateTag.id}")

@ -53,6 +53,11 @@ public class Tag implements Serializable {
*/
private Integer state;
/**
*
*/
private Integer isShow;
/**
*
*/

@ -31,6 +31,9 @@ public class TagDTO implements Serializable {
@ApiModelProperty(value = "标签状态 0=禁用1=启用")
private Integer state;
@ApiModelProperty(value = "标签是否显示 0=不显示1=显示")
private Integer isShow;
@ApiModelProperty(value = "说明文案")
private String description;

@ -28,4 +28,7 @@ public class TagNameDTO implements Serializable {
@ApiModelProperty(value = "标签状态 0=禁用1=启用")
private Integer state;
@ApiModelProperty(value = "标签是否显示 0=不显示1=显示")
private Integer isShow;
}

@ -228,13 +228,29 @@ public class TagService {
Tag updateTag = new Tag();
updateTag.setId(id);
updateTag.setState(state);
updateTag.setUpdaterId(RequestContext.get().getId());
// updateTag.setUpdaterId(RequestContext.get().getId());
updateTag.setUpdateTime(LocalDateTime.now());
tagDao.updateStateById(updateTag);
// 级联更新子标签状态
tagDao.updateStateByParentId(updateTag);
}
/**
*
*
* @param id ID
* @param show
*/
@Transactional(rollbackFor = Exception.class)
public void updateIsShow(String id, Integer show) {
Tag updateTag = new Tag();
updateTag.setId(id);
updateTag.setIsShow(show);
// updateTag.setUpdaterId(RequestContext.get().getId());
updateTag.setUpdateTime(LocalDateTime.now());
tagDao.updateShowById(updateTag);
}
/**
* ()
*

Loading…
Cancel
Save