parent
8efcdef1c9
commit
321db56def
7 changed files with 215 additions and 14 deletions
@ -0,0 +1,79 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.Logo; |
||||
import com.huoran.iasf.service.LogoService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:系统logo设置控制类 |
||||
* @作者: Rong |
||||
* @日期: 2024-07-01 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/LogoService/Logo") |
||||
@Api(value = "系统logo设置:LogoController", tags = "系统logo设置:系统logo设置") |
||||
public class LogoController { |
||||
|
||||
@Autowired |
||||
public LogoService service; |
||||
|
||||
|
||||
/** |
||||
* 保存或更新系统logo设置记录 |
||||
* 如果ID为空,则执行保存操作;如果ID有值,则视为更新操作。 |
||||
* |
||||
* @param logo 要保存或更新的系统logo设置对象 |
||||
* @return R 结果对象,包含操作状态信息 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperation(value = "保存或更新系统logo设置记录", response = Logo.class) |
||||
public R saveOrUpdate(@RequestBody @ApiParam(name = "系统logo设置对象", value = "包含系统logo设置详细信息,若id不存在则新建,否则视为更新", required = true) Logo logo) { |
||||
|
||||
if (logo.getId() == null) { |
||||
// 保存操作
|
||||
boolean addState = service.save(logo); |
||||
return addState ? R.success(logo.getId()) : R.fail("新增失败"); |
||||
} else { |
||||
// 更新操作
|
||||
boolean updateState = service.updateById(logo); |
||||
return updateState ? R.success() : R.fail("编辑失败"); |
||||
} |
||||
} |
||||
|
||||
|
||||
@PostMapping("/findById") |
||||
@ApiOperation(value = "查询详情", response = Logo.class) |
||||
public R findById(@ApiParam(name = "siteId", value = "主键", required = true) @RequestParam Integer siteId) { |
||||
//根据站点id查询站点信息
|
||||
QueryWrapper<Logo> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("site_id", siteId); |
||||
Logo logo = service.getOne(queryWrapper); |
||||
return R.success(logo); |
||||
} |
||||
|
||||
|
||||
|
||||
/*@PostMapping("/update") |
||||
@ApiOperation(value = "修改", response = Logo.class) |
||||
public R update(@RequestBody @ApiParam(name = "系统logo设置对象", value = "传入json格式", required = true) Logo logo) { |
||||
boolean updateState = service.updateById(logo); |
||||
return updateState ? R.success() : R.fail("编辑失败"); |
||||
}*/ |
||||
|
||||
|
||||
@PostMapping("/batchDeletion") |
||||
@ApiOperation(value = "批量删除", response = Logo.class) |
||||
public R batchDeletion(@ApiParam(name = "ids", value = "多个主键", required = true) @RequestParam List<Integer> ids) { |
||||
boolean delState = service.removeByIds(ids); |
||||
return delState ? R.success() : R.fail("删除失败"); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,38 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @描述:系统logo设置 |
||||
* @作者: Rong |
||||
* @日期: 2024-07-01 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "系统logo设置") |
||||
@TableName("sys_logo") |
||||
public class Logo implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "标题") |
||||
private String title; |
||||
|
||||
@ApiModelProperty(value = "图标") |
||||
private String logoUrl; |
||||
|
||||
@ApiModelProperty(value = "站点id") |
||||
private Integer siteId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import com.huoran.iasf.entity.Logo; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @描述:系统logo设置 Mapper 接口 |
||||
* @作者: Rong |
||||
* @日期: 2024-07-01 |
||||
*/ |
||||
@Mapper |
||||
public interface LogoMapper extends BaseMapper<Logo> { |
||||
|
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.Logo; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @描述:系统logo设置 service接口 |
||||
* @作者: Rong |
||||
* @日期: 2024-07-01 |
||||
*/ |
||||
public interface LogoService extends IService<Logo> { |
||||
|
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.iasf.entity.Logo; |
||||
import com.huoran.iasf.mapper.LogoMapper; |
||||
import com.huoran.iasf.service.LogoService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @描述:系统logo设置 服务类 |
||||
* @作者: Rong |
||||
* @日期: 2024-07-01 |
||||
*/ |
||||
@Service |
||||
public class LogoServiceImpl extends ServiceImpl<LogoMapper, Logo> implements LogoService { |
||||
|
||||
@Autowired |
||||
private LogoMapper mapper; |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
Loading…
Reference in new issue