|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.huoran.iasf.controller; |
|
|
|
package com.huoran.iasf.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.huoran.iasf.common.utils.R; |
|
|
|
import com.huoran.iasf.common.utils.R; |
|
|
|
import com.huoran.iasf.entity.SysNavigationIcon; |
|
|
|
import com.huoran.iasf.entity.SysNavigationIcon; |
|
|
|
import com.huoran.iasf.service.SysNavigationIconService; |
|
|
|
import com.huoran.iasf.service.SysNavigationIconService; |
|
|
@ -10,6 +11,7 @@ import io.swagger.annotations.ApiParam; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -26,6 +28,22 @@ public class SysNavigationIconController { |
|
|
|
public SysNavigationIconService service; |
|
|
|
public SysNavigationIconService service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/checkIfTheTitleIsRepeat") |
|
|
|
|
|
|
|
@ApiOperation(value = "标题判重——适用于新增、编辑及发布前的校验", response = Boolean.class) |
|
|
|
|
|
|
|
public R checkIfTheTitleIsRepeat(@RequestBody @Valid SysNavigationIcon icon) { |
|
|
|
|
|
|
|
boolean isDuplicate = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果ID不为空,说明是编辑操作,需要排除当前记录自身
|
|
|
|
|
|
|
|
if (icon.getId() != null) { |
|
|
|
|
|
|
|
isDuplicate = service.existsOtherByTitle(icon.getTitle(), icon.getId(), icon.getSiteId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// ID为空,说明是新增操作
|
|
|
|
|
|
|
|
isDuplicate = service.existsByTitle(icon.getTitle(), icon.getSiteId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.result(!isDuplicate, !isDuplicate ? "标题可用" : "该标题已重复!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存或更新导航图标设置记录 |
|
|
|
* 保存或更新导航图标设置记录 |
|
|
|
* 如果ID为空,则执行保存操作;如果ID有值,则视为更新操作。 |
|
|
|
* 如果ID为空,则执行保存操作;如果ID有值,则视为更新操作。 |
|
|
@ -61,8 +79,9 @@ public class SysNavigationIconController { |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/list") |
|
|
|
@PostMapping("/list") |
|
|
|
@ApiOperation(value = "根据站点ID查询列表数据,可选过滤禁用状态", response = SysNavigationIcon.class, responseContainer = "List") |
|
|
|
@ApiOperation(value = "根据站点ID查询列表数据,可选过滤禁用状态", response = SysNavigationIcon.class, responseContainer = "List") |
|
|
|
public R listSysNavigationIconsByCondition(@ApiParam(value = "站点ID", required = true) @RequestParam Integer siteId, @ApiParam(value = "禁用状态:0-启用,1-禁用,默认查询所有状态") @RequestParam(required = false) Integer isDisable) { |
|
|
|
public R listSysNavigationIconsByCondition(@ApiParam(value = "站点ID", required = true) @RequestParam Integer siteId, @ApiParam(value = "禁用状态:0-启用,1-禁用,默认查询所有状态") @RequestParam(required = false) Integer isDisable, |
|
|
|
List<SysNavigationIcon> sysNavigationIcons = service.listBySiteIdAndStatus(siteId, isDisable); |
|
|
|
@ApiParam(value = "查询关键词") @RequestParam(required = false) String search) { |
|
|
|
|
|
|
|
List<SysNavigationIcon> sysNavigationIcons = service.listBySiteIdAndStatus(siteId, isDisable,search); |
|
|
|
return R.success(sysNavigationIcons); |
|
|
|
return R.success(sysNavigationIcons); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -81,5 +100,16 @@ public class SysNavigationIconController { |
|
|
|
boolean delState = service.removeByIds(ids); |
|
|
|
boolean delState = service.removeByIds(ids); |
|
|
|
return delState ? R.success() : R.fail("删除失败"); |
|
|
|
return delState ? R.success() : R.fail("删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/enableDisable") |
|
|
|
|
|
|
|
@ApiOperation(value = "启用禁用", response = SysNavigationIcon.class) |
|
|
|
|
|
|
|
public R enableDisable(@ApiParam(name = "id", value = "主键id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用:0-启用,1-禁用", required = true) @RequestParam Integer isDisable) { |
|
|
|
|
|
|
|
UpdateWrapper<SysNavigationIcon> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
updateWrapper.set("is_disable", isDisable); |
|
|
|
|
|
|
|
updateWrapper.eq("id", id); |
|
|
|
|
|
|
|
boolean ret = service.update(updateWrapper); |
|
|
|
|
|
|
|
return ret ? R.success() : R.fail("禁用/启用失败"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|