🎉 2.2.3.RELEASE

This commit is contained in:
smallchill 2019-04-18 23:04:37 +08:00
parent 2e71e38a67
commit 43df1275b8
28 changed files with 506 additions and 40 deletions

View File

@ -8,7 +8,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<artifactId>blade-auth</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -0,0 +1,125 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.system.feign.IDictClient;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.system.entity.Tenant;
import org.springblade.system.vo.TenantVO;
import org.springblade.system.wrapper.TenantWrapper;
import org.springblade.system.service.ITenantService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
* 控制器
*
* @author Blade
* @since 2019-04-17
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tenant")
@Api(value = "", tags = "接口")
public class TenantController extends BladeController {
private ITenantService tenantService;
private IDictClient dictClient;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperation(value = "详情", notes = "传入tenant", position = 1)
public R<TenantVO> detail(Tenant tenant) {
Tenant detail = tenantService.getOne(Condition.getQueryWrapper(tenant));
TenantWrapper tenantWrapper = new TenantWrapper(dictClient);
return R.data(tenantWrapper.entityVO(detail));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperation(value = "分页", notes = "传入tenant", position = 2)
public R<IPage<TenantVO>> list(Tenant tenant, Query query) {
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), Condition.getQueryWrapper(tenant));
TenantWrapper tenantWrapper = new TenantWrapper(dictClient);
return R.data(tenantWrapper.pageVO(pages));
}
/**
* 自定义分页
*/
@GetMapping("/page")
@ApiOperation(value = "分页", notes = "传入tenant", position = 3)
public R<IPage<TenantVO>> page(TenantVO tenant, Query query) {
IPage<TenantVO> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant);
return R.data(pages);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperation(value = "新增", notes = "传入tenant", position = 4)
public R save(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.save(tenant));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperation(value = "修改", notes = "传入tenant", position = 5)
public R update(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.updateById(tenant));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperation(value = "新增或修改", notes = "传入tenant", position = 6)
public R submit(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.saveOrUpdate(tenant));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toIntList(ids)));
}
}

View File

@ -0,0 +1,33 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.dto;
import org.springblade.system.entity.Tenant;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 数据传输对象实体类
*
* @author Blade
* @since 2019-04-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class TenantDTO extends Tenant {
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,61 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 实体类
*
* @author Blade
* @since 2019-04-17
*/
@Data
@TableName("blade_tenant")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Tenant对象", description = "Tenant对象")
public class Tenant extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户名称
*/
@ApiModelProperty(value = "租户名称")
private String tenantName;
/**
* 联系人
*/
@ApiModelProperty(value = "联系人")
private String linkman;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
private String contactNumber;
/**
* 联系地址
*/
@ApiModelProperty(value = "联系地址")
private String address;
}

View File

@ -0,0 +1,41 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.mapper;
import org.springblade.system.entity.Tenant;
import org.springblade.system.vo.TenantVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Mapper 接口
*
* @author Blade
* @since 2019-04-17
*/
public interface TenantMapper extends BaseMapper<Tenant> {
/**
* 自定义分页
*
* @param page
* @param tenant
* @return
*/
List<TenantVO> selectTenantPage(IPage page, TenantVO tenant);
}

View File

@ -0,0 +1,25 @@
<?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="org.springblade.system.mapper.TenantMapper">
<!-- 通用查询映射结果 -->
<resultMap id="tenantResultMap" type="org.springblade.system.entity.Tenant">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="tenant_name" property="tenantName"/>
<result column="linkman" property="linkman"/>
<result column="contact_number" property="contactNumber"/>
<result column="address" property="address"/>
</resultMap>
<select id="selectTenantPage" resultMap="tenantResultMap">
select * from blade_tenant where is_deleted = 0
</select>
</mapper>

View File

@ -0,0 +1,40 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.service;
import org.springblade.system.entity.Tenant;
import org.springblade.system.vo.TenantVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
* 服务类
*
* @author Blade
* @since 2019-04-17
*/
public interface ITenantService extends BaseService<Tenant> {
/**
* 自定义分页
*
* @param page
* @param tenant
* @return
*/
IPage<TenantVO> selectTenantPage(IPage<TenantVO> page, TenantVO tenant);
}

View File

@ -0,0 +1,40 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.service.impl;
import org.springblade.system.entity.Tenant;
import org.springblade.system.vo.TenantVO;
import org.springblade.system.mapper.TenantMapper;
import org.springblade.system.service.ITenantService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
* 服务实现类
*
* @author Blade
* @since 2019-04-17
*/
@Service
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {
@Override
public IPage<TenantVO> selectTenantPage(IPage<TenantVO> page, TenantVO tenant) {
return page.setRecords(baseMapper.selectTenantPage(page, tenant));
}
}

View File

@ -0,0 +1,35 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.vo;
import org.springblade.system.entity.Tenant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
/**
* 视图实体类
*
* @author Blade
* @since 2019-04-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "TenantVO对象", description = "TenantVO对象")
public class TenantVO extends Tenant {
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,49 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.system.wrapper;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.feign.IDictClient;
import org.springblade.system.entity.Tenant;
import org.springblade.system.vo.TenantVO;
/**
* 包装类,返回视图层所需的字段
*
* @author Blade
* @since 2019-04-17
*/
@AllArgsConstructor
public class TenantWrapper extends BaseEntityWrapper<Tenant, TenantVO> {
private IDictClient dictClient;
@Override
public TenantVO entityVO(Tenant tenant) {
TenantVO tenantVO = BeanUtil.copy(tenant, TenantVO.class);
/*R<String> dict = dictClient.getValue("tenant" , tenantVO.getCategory());
if (dict.isSuccess()) {
String categoryName = dict.getData();
tenantVO.setCategoryName(categoryName);
}*/
return tenantVO;
}
}

View File

@ -0,0 +1,11 @@
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (0, 'tenant', '租户管理', 'menu', '/system/tenant', NULL, 1, 1, 0, 1, NULL, 0);
set @parentid = (SELECT LAST_INSERT_ID());
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, 'tenant_add', '新增', 'add', '/system/tenant/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, 'tenant_edit', '修改', 'edit', '/system/tenant/edit', 'form', 2, 2, 1, 2, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, 'tenant_delete', '删除', 'delete', '/api/blade-system/tenant/remove', 'delete', 3, 2, 1, 3, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, 'tenant_view', '查看', 'view', '/system/tenant/view', 'file-text', 4, 2, 1, 2, NULL, 0);

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>2.2.1</version>
<version>2.2.3</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -20,7 +20,9 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Menu;
@ -54,6 +56,7 @@ public class MenuController extends BladeController {
* 详情
*/
@GetMapping("/detail")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@ApiOperation(value = "详情", notes = "传入menu", position = 1)
public R<MenuVO> detail(Menu menu) {
Menu detail = menuService.getOne(Condition.getQueryWrapper(menu));
@ -69,6 +72,7 @@ public class MenuController extends BladeController {
@ApiImplicitParam(name = "code", value = "菜单编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "菜单名称", paramType = "query", dataType = "string")
})
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@ApiOperation(value = "列表", notes = "传入menu", position = 2)
public R<List<MenuVO>> list(@ApiIgnore @RequestParam Map<String, Object> menu) {
@SuppressWarnings("unchecked")
@ -77,6 +81,27 @@ public class MenuController extends BladeController {
return R.data(menuWrapper.listNodeVO(list));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@ApiOperation(value = "新增或修改", notes = "传入menu", position = 8)
public R submit(@Valid @RequestBody Menu menu) {
return R.status(menuService.saveOrUpdate(menu));
}
/**
* 删除
*/
@PostMapping("/remove")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@ApiOperation(value = "删除", notes = "传入ids", position = 9)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids)));
}
/**
* 前端菜单数据
*/
@ -125,25 +150,6 @@ public class MenuController extends BladeController {
return R.data(menuService.roleTreeKeys(roleIds));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperation(value = "新增或修改", notes = "传入menu", position = 8)
public R submit(@Valid @RequestBody Menu menu) {
return R.status(menuService.saveOrUpdate(menu));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperation(value = "删除", notes = "传入ids", position = 9)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids)));
}
/**
* 获取配置的角色权限
*/

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -7,12 +7,12 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.2.1</version>
<version>2.2.3</version>
</parent>
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>2.2.1</version>
<version>2.2.3</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务集合</description>

View File

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.2.1</version>
<version>2.2.3</version>
<packaging>pom</packaging>
<properties>
<blade.tool.version>2.2.1</blade.tool.version>
<blade.project.version>2.2.1</blade.project.version>
<blade.tool.version>2.2.3</blade.tool.version>
<blade.project.version>2.2.3</blade.project.version>
<java.version>1.8</java.version>
<swagger.version>2.9.2</swagger.version>