我的收藏模块
This commit is contained in:
+131
@@ -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<OnlCgformCollection, IOnlCgformCollectionService> {
|
||||
@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<OnlCgformCollection> queryWrapper = QueryGenerator.initQueryWrapper(onlCgformCollection, req.getParameterMap());
|
||||
Page<OnlCgformCollection> page = new Page<OnlCgformCollection>(pageNo, pageSize);
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-列表查询")
|
||||
@ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OnlCgformCollection>> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> 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);
|
||||
}
|
||||
}
|
||||
+67
@@ -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;
|
||||
|
||||
}
|
||||
+14
@@ -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<OnlCgformCollection> {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?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.jero.modules.collection.mapper.OnlCgformCollectionMapper">
|
||||
<resultMap id="OnlCgformCollectionResultMap" type="com.jero.modules.collection.entity.OnlCgformCollection">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="state" property="state" />
|
||||
<result column="serial_number" property="serialNumber" />
|
||||
<result column="title" property="title" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+54
@@ -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<OnlCgformCollection> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
void add(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
OnlCgformCollection queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection);
|
||||
}
|
||||
+81
@@ -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<OnlCgformCollectionMapper, OnlCgformCollection> 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<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OnlCgformCollection queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper=new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformCollection::getCreateBy,onlCgformCollection.getCreateBy());
|
||||
return list();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user