parent
37bd21ccfc
commit
abb95641d2
14 changed files with 342 additions and 52 deletions
@ -0,0 +1,93 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import cn.hutool.core.util.ObjectUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.huoran.iasf.common.aop.annotation.LogAnnotation; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.Site; |
||||
import com.huoran.iasf.service.SiteService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.util.StringUtils; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 站点管理 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2022-08-24 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/sys/site") |
||||
@Api(tags = "站点管理") |
||||
public class SiteController { |
||||
|
||||
@Autowired |
||||
private SiteService siteService; |
||||
|
||||
@PostMapping("/add") |
||||
@ApiOperation(value = "新增站点") |
||||
@LogAnnotation(title = "站点管理", action = "新增站点") |
||||
@RequiresPermissions("sys:site:add") |
||||
public R addUserGroup(@RequestBody Site site) { |
||||
Site one = siteService.getOne(new QueryWrapper<Site>(). |
||||
eq("site_name", site.getSiteName())); |
||||
if (ObjectUtil.isNotNull(one)){ |
||||
R.fail("站点已存在"); |
||||
} |
||||
siteService.save(site); |
||||
return R.success(); |
||||
} |
||||
|
||||
@DeleteMapping("/delete/{id}") |
||||
@ApiOperation(value = "删除站点") |
||||
@LogAnnotation(title = "站点管理", action = "删除站点") |
||||
@RequiresPermissions("sys:site:deleted") |
||||
public R deleted(@PathVariable("id") Integer id) { |
||||
siteService.removeById(id); |
||||
return R.success(); |
||||
} |
||||
|
||||
@PutMapping("/update") |
||||
@ApiOperation(value = "更新站点") |
||||
@LogAnnotation(title = "站点管理", action = "更新站点") |
||||
@RequiresPermissions("sys:site:update") |
||||
public R updateUserGroup(@RequestBody Site site) { |
||||
if (StringUtils.isEmpty(site.getId())) { |
||||
return R.fail("id不能为空"); |
||||
} |
||||
QueryWrapper<Site> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("domain_name", site.getDomainName()); |
||||
queryWrapper.last(" and id != " + site.getId()); |
||||
List<Site> groups = siteService.list(queryWrapper); |
||||
if (ObjectUtil.isNotNull(groups) && groups.size()>0){ |
||||
R.fail("域名已存在"); |
||||
} |
||||
siteService.updateById(site); |
||||
return R.success(); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/list") |
||||
@ApiOperation(value = "站点列表") |
||||
@LogAnnotation(title = "站点管理", action = "获取所有站点") |
||||
@RequiresPermissions("sys:site:list") |
||||
public R getUserGroupAll(@RequestBody Site site) { |
||||
LambdaQueryWrapper<Site> queryWrapper = Wrappers.lambdaQuery(); |
||||
if (!StringUtils.isEmpty(site.getSiteName())) { |
||||
queryWrapper.like(Site::getSiteName, site.getSiteName()); |
||||
} |
||||
IPage<Site> iPage = siteService.page(site.getQueryPage(),queryWrapper); |
||||
return R.success(iPage); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,45 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* <p> |
||||
* 站点管理 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2022-08-24 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@TableName("sys_site") |
||||
@ApiModel(value="Site对象", description="站点管理") |
||||
public class Site extends BaseEntity implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "主键") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "站点名称") |
||||
private String siteName; |
||||
|
||||
@ApiModelProperty(value = "域名") |
||||
private String domainName; |
||||
|
||||
@TableField(fill = FieldFill.INSERT) |
||||
private Date createTime; |
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.Site; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 站点管理 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2022-08-24 |
||||
*/ |
||||
public interface SiteMapper extends BaseMapper<Site> { |
||||
|
||||
} |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.iasf.mapper.SiteMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.Site; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 站点管理 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2022-08-24 |
||||
*/ |
||||
public interface SiteService extends IService<Site> { |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.huoran.iasf.entity.Site; |
||||
import com.huoran.iasf.mapper.SiteMapper; |
||||
import com.huoran.iasf.service.SiteService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 站点管理 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2022-08-24 |
||||
*/ |
||||
@Service |
||||
public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements SiteService { |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.huoran.iasf.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author chen |
||||
* @DATE 2022/8/25 11:37 |
||||
* @Version 1.0 |
||||
*/ |
||||
@Data |
||||
public class UEditorResultVO { |
||||
/** |
||||
* 上传结果 |
||||
*/ |
||||
@ApiModelProperty(value = "上传结果") |
||||
private String state; |
||||
/** |
||||
* 原图名称 |
||||
*/ |
||||
@ApiModelProperty(value = "原图名称") |
||||
private String original; |
||||
/** |
||||
* 保存名称 |
||||
*/ |
||||
@ApiModelProperty(value = "保存名称") |
||||
private String title; |
||||
/** |
||||
* 文件路径 |
||||
*/ |
||||
@ApiModelProperty(value = "文件路径") |
||||
private String url; |
||||
} |
||||
|
Loading…
Reference in new issue