From 25d7988c24d80193da70941e55f8a4e861d6b46b Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 13 Feb 2019 17:22:55 +0800 Subject: [PATCH] :tada: 2.0.0.RELEASE --- .../demo/controller/BlogController.java | 123 ------------------ .../org/springblade/demo/dto/BlogDTO.java | 33 ----- .../org/springblade/demo/entity/Blog.java | 54 -------- .../springblade/demo/mapper/BlogMapper.java | 41 ------ .../springblade/demo/mapper/BlogMapper.xml | 24 ---- .../demo/service/IBlogService.java | 40 ------ .../demo/service/impl/BlogServiceImpl.java | 40 ------ .../java/org/springblade/demo/vo/BlogVO.java | 35 ----- .../springblade/demo/wrapper/BlogWrapper.java | 49 ------- 9 files changed, 439 deletions(-) delete mode 100644 src/main/java/org/springblade/demo/controller/BlogController.java delete mode 100644 src/main/java/org/springblade/demo/dto/BlogDTO.java delete mode 100644 src/main/java/org/springblade/demo/entity/Blog.java delete mode 100644 src/main/java/org/springblade/demo/mapper/BlogMapper.java delete mode 100644 src/main/java/org/springblade/demo/mapper/BlogMapper.xml delete mode 100644 src/main/java/org/springblade/demo/service/IBlogService.java delete mode 100644 src/main/java/org/springblade/demo/service/impl/BlogServiceImpl.java delete mode 100644 src/main/java/org/springblade/demo/vo/BlogVO.java delete mode 100644 src/main/java/org/springblade/demo/wrapper/BlogWrapper.java diff --git a/src/main/java/org/springblade/demo/controller/BlogController.java b/src/main/java/org/springblade/demo/controller/BlogController.java deleted file mode 100644 index 8325ed9..0000000 --- a/src/main/java/org/springblade/demo/controller/BlogController.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.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.modules.system.service.IDictService; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springblade.demo.entity.Blog; -import org.springblade.demo.vo.BlogVO; -import org.springblade.demo.wrapper.BlogWrapper; -import org.springblade.demo.service.IBlogService; -import org.springblade.core.boot.ctrl.BladeController; - -/** - * 控制器 - * - * @author BladeX - * @since 2019-02-13 - */ -@RestController -@AllArgsConstructor -@RequestMapping("/blog") -@Api(value = "", tags = "接口") -public class BlogController extends BladeController { - - private IBlogService blogService; - - private IDictService dictService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperation(value = "详情", notes = "传入blog", position = 1) - public R detail(Blog blog) { - Blog detail = blogService.getOne(Condition.getQueryWrapper(blog)); - BlogWrapper blogWrapper = new BlogWrapper(dictService); - return R.data(blogWrapper.entityVO(detail)); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperation(value = "分页", notes = "传入blog", position = 2) - public R> list(Blog blog, Query query) { - IPage pages = blogService.page(Condition.getPage(query), Condition.getQueryWrapper(blog)); - BlogWrapper blogWrapper = new BlogWrapper(dictService); - return R.data(blogWrapper.pageVO(pages)); - } - - /** - * 自定义分页 - */ - @GetMapping("/page") - @ApiOperation(value = "分页", notes = "传入blog", position = 3) - public R> page(BlogVO blog, Query query) { - IPage pages = blogService.selectBlogPage(Condition.getPage(query), blog); - return R.data(pages); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperation(value = "新增", notes = "传入blog", position = 4) - public R save(@Valid @RequestBody Blog blog) { - return R.status(blogService.save(blog)); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperation(value = "修改", notes = "传入blog", position = 5) - public R update(@Valid @RequestBody Blog blog) { - return R.status(blogService.updateById(blog)); - } - - /** - * 新增或修改 - */ - @PostMapping("/submit") - @ApiOperation(value = "新增或修改", notes = "传入blog", position = 6) - public R submit(@Valid @RequestBody Blog blog) { - return R.status(blogService.saveOrUpdate(blog)); - } - - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperation(value = "物理删除", notes = "传入ids", position = 7) - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(blogService.removeByIds(Func.toIntList(ids))); - } - - -} diff --git a/src/main/java/org/springblade/demo/dto/BlogDTO.java b/src/main/java/org/springblade/demo/dto/BlogDTO.java deleted file mode 100644 index 54d9a52..0000000 --- a/src/main/java/org/springblade/demo/dto/BlogDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.dto; - -import org.springblade.demo.entity.Blog; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 数据传输对象实体类 - * - * @author BladeX - * @since 2019-02-13 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class BlogDTO extends Blog { - private static final long serialVersionUID = 1L; - -} diff --git a/src/main/java/org/springblade/demo/entity/Blog.java b/src/main/java/org/springblade/demo/entity/Blog.java deleted file mode 100644 index 67273ef..0000000 --- a/src/main/java/org/springblade/demo/entity/Blog.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.io.Serializable; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * 实体类 - * - * @author BladeX - * @since 2019-02-13 - */ -@Data -@TableName("blade_blog") -@ApiModel(value = "Blog对象", description = "Blog对象") -public class Blog implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private String blogTitle; - - private String blogContent; - - private LocalDateTime blogDate; - - private Integer isDeleted; - - - -} diff --git a/src/main/java/org/springblade/demo/mapper/BlogMapper.java b/src/main/java/org/springblade/demo/mapper/BlogMapper.java deleted file mode 100644 index 92be5a7..0000000 --- a/src/main/java/org/springblade/demo/mapper/BlogMapper.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.mapper; - -import org.springblade.demo.entity.Blog; -import org.springblade.demo.vo.BlogVO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import java.util.List; - -/** - * Mapper 接口 - * - * @author BladeX - * @since 2019-02-13 - */ -public interface BlogMapper extends BaseMapper { - - /** - * 自定义分页 - * - * @param page - * @param blog - * @return - */ - List selectBlogPage(IPage page, BlogVO blog); - -} diff --git a/src/main/java/org/springblade/demo/mapper/BlogMapper.xml b/src/main/java/org/springblade/demo/mapper/BlogMapper.xml deleted file mode 100644 index a894846..0000000 --- a/src/main/java/org/springblade/demo/mapper/BlogMapper.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - select - id, blog_title, blog_content, blog_date, is_deleted - - - - - diff --git a/src/main/java/org/springblade/demo/service/IBlogService.java b/src/main/java/org/springblade/demo/service/IBlogService.java deleted file mode 100644 index 9e9fcd7..0000000 --- a/src/main/java/org/springblade/demo/service/IBlogService.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.service; - -import org.springblade.demo.entity.Blog; -import org.springblade.demo.vo.BlogVO; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * 服务类 - * - * @author BladeX - * @since 2019-02-13 - */ -public interface IBlogService extends IService { - - /** - * 自定义分页 - * - * @param page - * @param blog - * @return - */ - IPage selectBlogPage(IPage page, BlogVO blog); - -} diff --git a/src/main/java/org/springblade/demo/service/impl/BlogServiceImpl.java b/src/main/java/org/springblade/demo/service/impl/BlogServiceImpl.java deleted file mode 100644 index e27f53f..0000000 --- a/src/main/java/org/springblade/demo/service/impl/BlogServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.service.impl; - -import org.springblade.demo.entity.Blog; -import org.springblade.demo.vo.BlogVO; -import org.springblade.demo.mapper.BlogMapper; -import org.springblade.demo.service.IBlogService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * 服务实现类 - * - * @author BladeX - * @since 2019-02-13 - */ -@Service -public class BlogServiceImpl extends ServiceImpl implements IBlogService { - - @Override - public IPage selectBlogPage(IPage page, BlogVO blog) { - return page.setRecords(baseMapper.selectBlogPage(page, blog)); - } - -} diff --git a/src/main/java/org/springblade/demo/vo/BlogVO.java b/src/main/java/org/springblade/demo/vo/BlogVO.java deleted file mode 100644 index 76a6bf7..0000000 --- a/src/main/java/org/springblade/demo/vo/BlogVO.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.vo; - -import org.springblade.demo.entity.Blog; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; - -/** - * 视图实体类 - * - * @author BladeX - * @since 2019-02-13 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "BlogVO对象", description = "BlogVO对象") -public class BlogVO extends Blog { - private static final long serialVersionUID = 1L; - -} diff --git a/src/main/java/org/springblade/demo/wrapper/BlogWrapper.java b/src/main/java/org/springblade/demo/wrapper/BlogWrapper.java deleted file mode 100644 index 04ee121..0000000 --- a/src/main/java/org/springblade/demo/wrapper/BlogWrapper.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * 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.demo.wrapper; - -import lombok.AllArgsConstructor; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.modules.system.service.IDictService; -import org.springblade.demo.entity.Blog; -import org.springblade.demo.vo.BlogVO; - -/** - * 包装类,返回视图层所需的字段 - * - * @author BladeX - * @since 2019-02-13 - */ -@AllArgsConstructor -public class BlogWrapper extends BaseEntityWrapper { - - private IDictService dictService; - - @Override - public BlogVO entityVO(Blog blog) { - BlogVO blogVO = BeanUtil.copy(blog, BlogVO.class); - - /*R dict = dictService.getValue("blog" , blogVO.getCategory()); - if (dict.isSuccess()) { - String categoryName = dict.getData(); - blogVO.setCategoryName(categoryName); - }*/ - - return blogVO; - } - -}