From 469c190dc152ae96cdb5c8892a963969ee338ee8 Mon Sep 17 00:00:00 2001 From: xiejunyu Date: Tue, 15 Feb 2022 16:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=94=B6=E8=97=8F=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OnlCgformCollectionController.java | 131 ++++++++++++++++++ .../entity/OnlCgformCollection.java | 67 +++++++++ .../mapper/OnlCgformCollectionMapper.java | 14 ++ .../mapper/xml/OnlCgformCollectionMapper.xml | 13 ++ .../service/IOnlCgformCollectionService.java | 54 ++++++++ .../impl/OnlCgformCollectionServiceImpl.java | 81 +++++++++++ 6 files changed, 360 insertions(+) create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java create mode 100644 jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java new file mode 100644 index 000000000..8948a88ec --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java @@ -0,0 +1,131 @@ +package com.jero.modules.collection.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.common.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.collection.entity.OnlCgformCollection; +import com.jero.modules.collection.service.IOnlCgformCollectionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.List; + + + /** + * @Description: 我的收藏 + * @Author: jero-boot + * @Date: 2022-02-15 + * @Version: V1.0 + */ +@Api(tags="我的收藏") +@RestController +@RequestMapping("/collection/onlCgformCollection") +@Slf4j +public class OnlCgformCollectionController extends JeroController { + @Autowired + private IOnlCgformCollectionService onlCgformCollectionService; + + /** + * 分页列表查询 + * + * @param onlCgformCollection + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "我的收藏-分页列表查询") + @ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(OnlCgformCollection onlCgformCollection, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(onlCgformCollection, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = onlCgformCollectionService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "我的收藏-列表查询") + @ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询") + @GetMapping(value = "/list") + public Result> queryList(OnlCgformCollection onlCgformCollection) { + List list = onlCgformCollectionService.queryList(onlCgformCollection); + return Result.OK(list); + } + + /** + * 添加 + * + * @param onlCgformCollection + * @return + */ + @AutoLog(value = "我的收藏-添加") + @ApiOperation(value="我的收藏-添加", notes="我的收藏-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) { + onlCgformCollectionService.add(onlCgformCollection); + return Result.OK("添加成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "我的收藏-通过id删除") + @ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + onlCgformCollectionService.deleteById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "我的收藏-批量删除") + @ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.onlCgformCollectionService.deleteByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "我的收藏-通过id查询") + @ApiOperation(value="我的收藏-通过id查询", notes="我的收藏-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id); + if(onlCgformCollection==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(onlCgformCollection); + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java new file mode 100644 index 000000000..8e76371ef --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java @@ -0,0 +1,67 @@ +package com.jero.modules.collection.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 我的收藏 + * @Author: jero-boot + * @Date: 2022-02-15 + * @Version: V1.0 + */ +@Data +@TableName("onl_cgform_collection") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="onl_cgform_collection对象", description="我的收藏") +public class OnlCgformCollection implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**收藏人*/ + @ApiModelProperty(value = "收藏人") + private String createBy; + + /**收藏日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "收藏日期") + private java.util.Date createTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + /**状态*/ + @Excel(name = "状态", width = 15, dictTable = "buss_document_library", dicText = "state", dicCode = "state") + @Dict(dictTable = "buss_document_library", dicText = "state", dicCode = "state") + private String state; + + /**编号*/ + @Excel(name = "编号", width = 15, dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber") + @Dict(dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber") + private String serialNumber; + + /**标题*/ + @Excel(name = "标题", width = 15, dictTable = "buss_document_library", dicText = "title", dicCode = "title") + @Dict(dictTable = "buss_document_library", dicText = "title", dicCode = "title") + @ApiModelProperty(value = "标题") + private String title; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java new file mode 100644 index 000000000..907455e0c --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java @@ -0,0 +1,14 @@ +package com.jero.modules.collection.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.collection.entity.OnlCgformCollection; + +/** + * @Description: 我的收藏 + * @Author: jero-boot + * @Date: 2022-02-15 + * @Version: V1.0 + */ +public interface OnlCgformCollectionMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml new file mode 100644 index 000000000..fd8e868f7 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java new file mode 100644 index 000000000..01e97fe41 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java @@ -0,0 +1,54 @@ +package com.jero.modules.collection.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.modules.collection.entity.OnlCgformCollection; + +import java.util.List; + +/** + * @Description: 我的收藏 + * @Author: jero-boot + * @Date: 2022-02-15 + * @Version: V1.0 + */ +public interface IOnlCgformCollectionService extends IService { + + /** + * 保存 + * + * @param onlCgformCollection + * @return + */ + void add(OnlCgformCollection onlCgformCollection); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + OnlCgformCollection queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(OnlCgformCollection onlCgformCollection); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java new file mode 100644 index 000000000..4a1642809 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java @@ -0,0 +1,81 @@ +package com.jero.modules.collection.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.modules.collection.entity.OnlCgformCollection; +import com.jero.modules.collection.mapper.OnlCgformCollectionMapper; +import com.jero.modules.collection.service.IOnlCgformCollectionService; +import com.jero.modules.tag.entity.OnlCgformArea; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * @Description: 我的收藏 + * @Author: jero-boot + * @Date: 2022-02-15 + * @Version: V1.0 + */ +@Service +public class OnlCgformCollectionServiceImpl extends ServiceImpl implements IOnlCgformCollectionService { + + /** + * 保存 + * + * @param onlCgformCollection + * @return + */ + @Override + public void add(OnlCgformCollection onlCgformCollection) { + Date now = new Date(); + onlCgformCollection.setCreateTime(now); + save(onlCgformCollection); + } + + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public OnlCgformCollection queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList(OnlCgformCollection onlCgformCollection) { + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(OnlCgformCollection::getCreateBy,onlCgformCollection.getCreateBy()); + return list(); + } +}