虚拟清单--订阅
This commit is contained in:
+15
@@ -172,4 +172,19 @@ public class DummyInventoryBaseEOController extends JeroController<DummyInventor
|
||||
return super.importExcel(request, response, DummyInventoryBaseEO.class);
|
||||
}
|
||||
|
||||
|
||||
@AutoLog(value = "订阅")
|
||||
@ApiOperation(value="订阅", notes="订阅")
|
||||
@GetMapping(value = "/read")
|
||||
public void read(String dummyId){
|
||||
dummyInventoryBaseEOService.read(dummyId);
|
||||
}
|
||||
|
||||
@AutoLog(value = "取消订阅")
|
||||
@ApiOperation(value="取消订阅", notes="取消订阅")
|
||||
@GetMapping(value = "/cancelRead")
|
||||
public void cancelRead(String dummyId){
|
||||
dummyInventoryBaseEOService.cancelRead(dummyId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-4
@@ -75,8 +75,4 @@ public class DummyInventoryBaseEO implements Serializable {
|
||||
@Dict(dicCode ="dummy_inventory_state")
|
||||
private java.lang.String state;
|
||||
|
||||
/**虚拟清单详情id*/
|
||||
@ApiModelProperty(value = "虚拟清单详情id")
|
||||
private java.lang.String dummyInventoryInfoId;
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -11,6 +11,5 @@
|
||||
<result column="name" property="name" />
|
||||
<result column="use_explain" property="useExplain" />
|
||||
<result column="state" property="state" />
|
||||
<result column="dummy_inventory_info_id" property="dummyInventoryInfoId" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
+21
-1
@@ -3,8 +3,9 @@ package com.jero.modules.dummy.service;
|
||||
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.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -62,5 +63,24 @@ public interface IDummyInventoryBaseEOService extends IService<DummyInventoryBas
|
||||
*/
|
||||
List<DummyInventoryBaseEO> queryList();
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
IPage<DummyInventoryBaseEO> getPageInfo(Page<DummyInventoryBaseEO> page,QueryWrapper<DummyInventoryBaseEO> queryWrapper);
|
||||
|
||||
/**
|
||||
* 订阅
|
||||
* @param dummyId
|
||||
*/
|
||||
void read(String dummyId);
|
||||
|
||||
/**
|
||||
* 取消订阅
|
||||
* @param dummyId
|
||||
*/
|
||||
void cancelRead(String dummyId);
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -4,11 +4,15 @@ 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.extension.plugins.pagination.Page;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.mapper.DummyInventoryBaseEOMapper;
|
||||
import com.jero.modules.dummy.service.IDummyInventoryBaseEOService;
|
||||
import com.jero.modules.read.entity.DummyReadEO;
|
||||
import com.jero.modules.read.service.impl.DummyReadEOServiceImpl;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
@@ -28,6 +32,8 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private DummyReadEOServiceImpl dummyReadEOService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -119,4 +125,19 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
||||
}
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String dummyId) {
|
||||
DummyReadEO dummyReadEO = new DummyReadEO();
|
||||
dummyReadEO.setDummyInventoryId(dummyId);
|
||||
dummyReadEOService.add(dummyReadEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelRead(String dummyId) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<DummyReadEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(DummyReadEO::getDummyInventoryId,dummyId).in(DummyReadEO::getCreateBy,sysUser.getUsername());
|
||||
dummyReadEOService.remove(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
package com.jero.modules.read.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.read.entity.DummyReadEO;
|
||||
import com.jero.modules.read.service.IDummyReadEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 虚拟清单订阅表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="虚拟清单订阅表")
|
||||
@RestController
|
||||
@RequestMapping("/read/dummyReadEO")
|
||||
@Slf4j
|
||||
public class DummyReadEOController extends JeroController<DummyReadEO, IDummyReadEOService> {
|
||||
@Autowired
|
||||
private IDummyReadEOService dummyReadEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "虚拟清单订阅表-分页列表查询")
|
||||
@ApiOperation(value="虚拟清单订阅表-分页列表查询", notes="虚拟清单订阅表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(DummyReadEO dummyReadEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<DummyReadEO> queryWrapper = QueryGenerator.initQueryWrapper(dummyReadEO, req.getParameterMap());
|
||||
Page<DummyReadEO> page = new Page<DummyReadEO>(pageNo, pageSize);
|
||||
IPage<DummyReadEO> pageList = dummyReadEOService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "虚拟清单订阅表-列表查询")
|
||||
@ApiOperation(value="虚拟清单订阅表-列表查询", notes="虚拟清单订阅表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<DummyReadEO>> queryList() {
|
||||
List<DummyReadEO> list = dummyReadEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "虚拟清单订阅表-添加")
|
||||
@ApiOperation(value="虚拟清单订阅表-添加", notes="虚拟清单订阅表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody DummyReadEO dummyReadEO) {
|
||||
dummyReadEOService.add(dummyReadEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "虚拟清单订阅表-编辑")
|
||||
@ApiOperation(value="虚拟清单订阅表-编辑", notes="虚拟清单订阅表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody DummyReadEO dummyReadEO) {
|
||||
dummyReadEOService.editById(dummyReadEO);
|
||||
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) {
|
||||
dummyReadEOService.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.dummyReadEOService.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) {
|
||||
DummyReadEO dummyReadEO = dummyReadEOService.queryById(id);
|
||||
if(dummyReadEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(dummyReadEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param dummyReadEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DummyReadEO dummyReadEO) {
|
||||
return super.exportXls(request, dummyReadEO, DummyReadEO.class, "虚拟清单订阅表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DummyReadEO.class);
|
||||
}
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.jero.modules.read.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 虚拟清单订阅表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dummy_read")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="dummy_read对象", description="虚拟清单订阅表")
|
||||
public class DummyReadEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.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 java.lang.String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@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 updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**虚拟清单基础表id*/
|
||||
@Excel(name = "虚拟清单基础表id", width = 15)
|
||||
@ApiModelProperty(value = "虚拟清单基础表id")
|
||||
private java.lang.String dummyInventoryId;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.read.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.read.entity.DummyReadEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟清单订阅表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DummyReadEOMapper extends BaseMapper<DummyReadEO> {
|
||||
|
||||
}
|
||||
+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.read.mapper.DummyReadEOMapper">
|
||||
<resultMap id="DummyReadEOResultMap" type="com.jero.modules.read.entity.DummyReadEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="dummy_inventory_id" property="dummyInventoryId" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.jero.modules.read.service;
|
||||
|
||||
import com.jero.modules.read.entity.DummyReadEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟清单订阅表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDummyReadEOService extends IService<DummyReadEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
void add(DummyReadEO dummyReadEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
void editById(DummyReadEO dummyReadEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
DummyReadEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DummyReadEO> queryList();
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.jero.modules.read.service.impl;
|
||||
|
||||
import com.jero.modules.read.entity.DummyReadEO;
|
||||
import com.jero.modules.read.mapper.DummyReadEOMapper;
|
||||
import com.jero.modules.read.service.IDummyReadEOService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟清单订阅表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DummyReadEOServiceImpl extends ServiceImpl<DummyReadEOMapper, DummyReadEO> implements IDummyReadEOService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(DummyReadEO dummyReadEO) {
|
||||
Date now = new Date();
|
||||
dummyReadEO.setCreateTime(now);
|
||||
dummyReadEO.setUpdateTime(now);
|
||||
save(dummyReadEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param dummyReadEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(DummyReadEO dummyReadEO) {
|
||||
Date now = new Date();
|
||||
dummyReadEO.setUpdateTime(now);
|
||||
saveOrUpdate(dummyReadEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过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 DummyReadEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DummyReadEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user