|
|
|
@ -3,6 +3,7 @@ package com.zh.project0512.controller.manage;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.zh.project0512.annotation.adminTokenValid;
|
|
|
|
|
import com.zh.project0512.model.Brand;
|
|
|
|
|
import com.zh.project0512.model.Tag;
|
|
|
|
@ -65,11 +66,11 @@ public class TagController {
|
|
|
|
|
private Integer id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "删除标签")
|
|
|
|
|
@Operation(summary = "删除标签(软删除)")
|
|
|
|
|
@PostMapping("/del")
|
|
|
|
|
@adminTokenValid
|
|
|
|
|
public Result del(@Validated @RequestBody DelTagParam param) {
|
|
|
|
|
return MybatisPlusUtil.sqlResult(tagService.removeById(param.getId()), "删除");
|
|
|
|
|
return MybatisPlusUtil.sqlResult(tagService.update(new UpdateWrapper<Tag>().eq("id", param.getId()).set("isDeleted", 1)), "删除");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
@ -95,8 +96,8 @@ public class TagController {
|
|
|
|
|
@adminTokenValid
|
|
|
|
|
public Result list(@RequestBody(required = false) JSONObject obj) {
|
|
|
|
|
QueryWrapper<Tag> qw = new QueryWrapper<>();
|
|
|
|
|
qw.orderByAsc("sortWeight").orderByDesc("updateAt","creatAt");
|
|
|
|
|
return Result.success(tagService.pageMaps(MybatisPlusUtil.SetPage(obj),qw));
|
|
|
|
|
qw.orderByAsc("sortWeight").orderByDesc("updateAt", "creatAt");
|
|
|
|
|
return Result.success(tagService.pageMaps(MybatisPlusUtil.SetPage(obj), qw));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
@ -118,10 +119,10 @@ public class TagController {
|
|
|
|
|
Tag tag = tagService.getById(param.getId());
|
|
|
|
|
int origin = tag.getSortWeight();
|
|
|
|
|
int current = param.getSortWeight();
|
|
|
|
|
if(origin==current){
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION,"权重无变化");
|
|
|
|
|
if (origin == current) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "权重无变化");
|
|
|
|
|
}
|
|
|
|
|
tagService.updSort(origin,current,origin>current);
|
|
|
|
|
tagService.updSort(origin, current, origin > current);
|
|
|
|
|
return Result.success("修改完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|