fix: 修改收藏品文件上传接口。
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
package com.intc.collect.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.intc.common.core.domain.R;
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.system.api.RemoteFileService;
|
||||
import com.intc.system.api.domain.SysFile;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.intc.common.log.annotation.Log;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.common.security.annotation.RequiresPermissions;
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import com.intc.collect.domain.vo.CollectFileVo;
|
||||
import com.intc.collect.domain.dto.CollectFileDto;
|
||||
import com.intc.collect.service.ICollectFileService;
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 收藏品文件Controller
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
@Api(tags=" 收藏品文件")
|
||||
@RestController
|
||||
@RequestMapping("/collectFile")
|
||||
public class CollectFileController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private ICollectFileService collectFileService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询收藏品文件列表
|
||||
*/
|
||||
@ApiOperation(value="查询收藏品文件列表",response = CollectFileVo.class)
|
||||
@RequiresPermissions("collect:collectFile:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CollectFileDto collectFileDto)
|
||||
{
|
||||
startPage();
|
||||
List<CollectFileVo> list = collectFileService.selectCollectFileList(collectFileDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出收藏品文件列表
|
||||
*/
|
||||
@ApiOperation(value="导出收藏品文件列表")
|
||||
@RequiresPermissions("collect:collectFile:export")
|
||||
@Log(title = "收藏品文件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CollectFileDto collectFileDto)
|
||||
{
|
||||
List<CollectFileVo> list = collectFileService.selectCollectFileList(collectFileDto);
|
||||
ExcelUtil<CollectFileVo> util = new ExcelUtil<CollectFileVo>(CollectFileVo.class);
|
||||
util.exportExcel(response, list, "收藏品文件数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收藏品文件详细信息
|
||||
*/
|
||||
@ApiOperation(value="获取收藏品文件详细信息")
|
||||
@RequiresPermissions("collect:collectFile:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(collectFileService.selectCollectFileById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增收藏品文件
|
||||
*/
|
||||
@ApiOperation(value="新增收藏品文件")
|
||||
@RequiresPermissions("collect:collectFile:add")
|
||||
@Log(title = "收藏品文件", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CollectFile collectFile)
|
||||
{
|
||||
return toAjax(collectFileService.insertCollectFile(collectFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收藏品文件
|
||||
*/
|
||||
@ApiOperation(value="修改收藏品文件")
|
||||
@RequiresPermissions("collect:collectFile:edit")
|
||||
@Log(title = "收藏品文件", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CollectFile collectFile)
|
||||
{
|
||||
return toAjax(collectFileService.updateCollectFile(collectFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收藏品文件
|
||||
*/
|
||||
@ApiOperation(value="删除收藏品文件")
|
||||
@RequiresPermissions("collect:collectFile:remove")
|
||||
@Log(title = "收藏品文件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(collectFileService.deleteCollectFileByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传收藏品图片
|
||||
*/
|
||||
@ApiOperation(value="上传收藏品图片")
|
||||
@PostMapping("/uploadFile")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file)
|
||||
{
|
||||
R<SysFile> sysFileR = remoteFileService.upload(file);
|
||||
SysFile sysFile = sysFileR.getData();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("catalog", DateUtils.datePath());
|
||||
map.put("fileName",file.getOriginalFilename());
|
||||
map.put("name",sysFile.getName());
|
||||
map.put("url",sysFile.getUrl());
|
||||
|
||||
return AjaxResult.success(map);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增配电柜图片
|
||||
*/
|
||||
@ApiOperation(value="新增收藏品图片")
|
||||
@Log(title = "收藏品图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addFile")
|
||||
public AjaxResult addFile(@Validated @RequestBody CollectFile collectFile)
|
||||
{
|
||||
return toAjax(collectFileService.insertCollectFile(collectFile));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.intc.collect.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.intc.common.core.annotation.Excel;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.constraints.*;
|
||||
/**
|
||||
* 收藏品文件对象 col_collect_file
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
@ApiModel("收藏品文件对象")
|
||||
@Data
|
||||
public class CollectFile extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
/** 收藏品id */
|
||||
@ApiModelProperty(value="收藏品id")
|
||||
@Excel(name = "收藏品id")
|
||||
private Long collectId;
|
||||
|
||||
/** 目录 */
|
||||
@ApiModelProperty(value="目录")
|
||||
@Excel(name = "目录")
|
||||
private String catelog;
|
||||
|
||||
/** 源文件名 */
|
||||
@ApiModelProperty(value="源文件名")
|
||||
@Excel(name = "源文件名")
|
||||
private String fileName;
|
||||
|
||||
/** 文件名 */
|
||||
@ApiModelProperty(value="文件名")
|
||||
@Excel(name = "文件名")
|
||||
private String name;
|
||||
|
||||
/** url */
|
||||
@ApiModelProperty(value="url")
|
||||
@Excel(name = "url")
|
||||
private String url;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("collectId", getCollectId())
|
||||
.append("catelog", getCatelog())
|
||||
.append("fileName", getFileName())
|
||||
.append("name", getName())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("url", getUrl())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.intc.collect.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -77,6 +79,9 @@ public class CommemorativeCoin extends BaseEntity
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 文件信息 */
|
||||
private List<CollectFile> collectFileList;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -97,6 +102,7 @@ public class CommemorativeCoin extends BaseEntity
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("remark", getRemark())
|
||||
.append("collectFileList", getCollectFileList())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.intc.collect.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
/**
|
||||
* 收藏品文件Dto对象 col_collect_file
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
@ApiModel("收藏品文件Dto对象")
|
||||
@Data
|
||||
public class CollectFileDto implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 收藏品id */
|
||||
@ApiModelProperty(value="收藏品id")
|
||||
private Long collectId;
|
||||
|
||||
/** 目录 */
|
||||
@ApiModelProperty(value="目录")
|
||||
private String catelog;
|
||||
|
||||
/** 源文件名 */
|
||||
@ApiModelProperty(value="源文件名")
|
||||
private String fileName;
|
||||
|
||||
/** 文件名 */
|
||||
@ApiModelProperty(value="文件名")
|
||||
private String name;
|
||||
|
||||
/** url */
|
||||
@ApiModelProperty(value="url")
|
||||
private String url;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.intc.collect.domain.vo;
|
||||
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
/**
|
||||
* 收藏品文件Vo对象 col_collect_file
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
@ApiModel("收藏品文件Vo对象")
|
||||
@Data
|
||||
public class CollectFileVo extends CollectFile
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.intc.collect.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import com.intc.collect.domain.dto.CollectFileDto;
|
||||
import com.intc.collect.domain.vo.CollectFileVo;
|
||||
|
||||
/**
|
||||
* 收藏品文件Mapper接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
public interface CollectFileMapper
|
||||
{
|
||||
/**
|
||||
* 查询收藏品文件
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 收藏品文件
|
||||
*/
|
||||
public CollectFileVo selectCollectFileById(Long id);
|
||||
|
||||
/**
|
||||
* 查询收藏品文件列表
|
||||
*
|
||||
* @param collectFileDto 收藏品文件
|
||||
* @return 收藏品文件集合
|
||||
*/
|
||||
public List<CollectFileVo> selectCollectFileList(CollectFileDto collectFileDto);
|
||||
|
||||
/**
|
||||
* 新增收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCollectFile(CollectFile collectFile);
|
||||
|
||||
/**
|
||||
* 修改收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCollectFile(CollectFile collectFile);
|
||||
|
||||
/**
|
||||
* 删除收藏品文件
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCollectFileById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除收藏品文件
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCollectFileByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 逻辑删除收藏品文件
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeCollectFileById(Long id);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除收藏品文件
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeCollectFileByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增信息
|
||||
*
|
||||
* @param collectFileList 信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertCollectFile(List<CollectFile> collectFileList);
|
||||
|
||||
/**
|
||||
* 通过主键删除信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCollectFileByCollectId(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.intc.collect.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import com.intc.collect.domain.dto.CollectFileDto;
|
||||
import com.intc.collect.domain.vo.CollectFileVo;
|
||||
|
||||
/**
|
||||
* 收藏品文件Service接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
public interface ICollectFileService
|
||||
{
|
||||
/**
|
||||
* 查询收藏品文件
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 收藏品文件
|
||||
*/
|
||||
public CollectFileVo selectCollectFileById(Long id);
|
||||
|
||||
/**
|
||||
* 查询收藏品文件列表
|
||||
*
|
||||
* @param collectFileDto 收藏品文件
|
||||
* @return 收藏品文件集合
|
||||
*/
|
||||
public List<CollectFileVo> selectCollectFileList(CollectFileDto collectFileDto);
|
||||
|
||||
/**
|
||||
* 新增收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCollectFile(CollectFile collectFile);
|
||||
|
||||
/**
|
||||
* 修改收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCollectFile(CollectFile collectFile);
|
||||
|
||||
/**
|
||||
* 批量删除收藏品文件
|
||||
*
|
||||
* @param ids 需要删除的收藏品文件主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCollectFileByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除收藏品文件信息
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCollectFileById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.intc.collect.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.collect.mapper.CollectFileMapper;
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import com.intc.collect.domain.dto.CollectFileDto;
|
||||
import com.intc.collect.domain.vo.CollectFileVo;
|
||||
import com.intc.collect.service.ICollectFileService;
|
||||
|
||||
/**
|
||||
* 收藏品文件Service业务层处理
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2026-02-21
|
||||
*/
|
||||
@Service
|
||||
public class CollectFileServiceImpl implements ICollectFileService
|
||||
{
|
||||
@Resource
|
||||
private CollectFileMapper collectFileMapper;
|
||||
|
||||
/**
|
||||
* 查询收藏品文件
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 收藏品文件
|
||||
*/
|
||||
@Override
|
||||
public CollectFileVo selectCollectFileById(Long id)
|
||||
{
|
||||
return collectFileMapper.selectCollectFileById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收藏品文件列表
|
||||
*
|
||||
* @param collectFileDto 收藏品文件
|
||||
* @return 收藏品文件
|
||||
*/
|
||||
@Override
|
||||
public List<CollectFileVo> selectCollectFileList(CollectFileDto collectFileDto)
|
||||
{
|
||||
return collectFileMapper.selectCollectFileList(collectFileDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCollectFile(CollectFile collectFile)
|
||||
{
|
||||
collectFile.setId(IdWorker.getId());
|
||||
collectFile.setCreateTime(DateUtils.getNowDate());
|
||||
collectFile.setCreateBy(SecurityUtils.getUsername());
|
||||
return collectFileMapper.insertCollectFile(collectFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收藏品文件
|
||||
*
|
||||
* @param collectFile 收藏品文件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCollectFile(CollectFile collectFile)
|
||||
{
|
||||
return collectFileMapper.updateCollectFile(collectFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除收藏品文件
|
||||
*
|
||||
* @param ids 需要删除的收藏品文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCollectFileByIds(Long[] ids)
|
||||
{
|
||||
return collectFileMapper.removeCollectFileByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收藏品文件信息
|
||||
*
|
||||
* @param id 收藏品文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCollectFileById(Long id)
|
||||
{
|
||||
return collectFileMapper.removeCollectFileById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.intc.collect.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.intc.collect.domain.CollectFile;
|
||||
import com.intc.collect.mapper.CollectFileMapper;
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import javax.annotation.Resource;
|
||||
@@ -24,6 +29,9 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService
|
||||
@Resource
|
||||
private CommemorativeCoinMapper commemorativeCoinMapper;
|
||||
|
||||
@Resource
|
||||
private CollectFileMapper collectFileMapper;
|
||||
|
||||
/**
|
||||
* 查询流通纪念币
|
||||
*
|
||||
@@ -60,7 +68,36 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService
|
||||
commemorativeCoin.setId(IdWorker.getId());
|
||||
commemorativeCoin.setCreateBy(SecurityUtils.getUsername());
|
||||
commemorativeCoin.setCreateTime(DateUtils.getNowDate());
|
||||
return commemorativeCoinMapper.insertCommemorativeCoin(commemorativeCoin);
|
||||
int rows =commemorativeCoinMapper.insertCommemorativeCoin(commemorativeCoin);
|
||||
insertCollectFile(commemorativeCoin);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件信息
|
||||
*
|
||||
* @param commemorativeCoin 对象
|
||||
*/
|
||||
public void insertCollectFile(CommemorativeCoin commemorativeCoin)
|
||||
{
|
||||
List<CollectFile> collectFileList = commemorativeCoin.getCollectFileList();
|
||||
Long id = commemorativeCoin.getId();
|
||||
if (StringUtils.isNotNull(collectFileList))
|
||||
{
|
||||
List<CollectFile> list = new ArrayList<CollectFile>();
|
||||
for (CollectFile collectFile : collectFileList)
|
||||
{
|
||||
collectFile.setCollectId(id);
|
||||
collectFile.setCreateTime(DateUtils.getNowDate());
|
||||
collectFile.setCreateBy(SecurityUtils.getUsername());
|
||||
collectFile.setId(IdWorker.getId());
|
||||
list.add(collectFile);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
collectFileMapper.batchInsertCollectFile(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +111,7 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService
|
||||
{
|
||||
commemorativeCoin.setUpdateBy(SecurityUtils.getUsername());
|
||||
commemorativeCoin.setUpdateTime(DateUtils.getNowDate());
|
||||
insertCollectFile(commemorativeCoin);;
|
||||
return commemorativeCoinMapper.updateCommemorativeCoin(commemorativeCoin);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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.intc.collect.mapper.CollectFileMapper">
|
||||
|
||||
<resultMap type="CollectFileVo" id="CollectFileResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="collectId" column="collect_id" />
|
||||
<result property="catelog" column="catelog" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="name" column="name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="url" column="url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCollectFileVo">
|
||||
select a.id, a.collect_id, a.catelog, a.file_name, a.name, a.create_time, a.create_by, a.url from col_collect_file a
|
||||
</sql>
|
||||
|
||||
<select id="selectCollectFileList" parameterType="CollectFileDto" resultMap="CollectFileResult">
|
||||
<include refid="selectCollectFileVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="collectId != null "> and a.collect_id = #{collectId}</if>
|
||||
<if test="catelog != null and catelog != ''"> and a.catelog = #{catelog}</if>
|
||||
<if test="fileName != null and fileName != ''"> and a.file_name like '%'|| #{fileName}||'%'</if>
|
||||
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
|
||||
<if test="url != null and url != ''"> and a.url = #{url}</if>
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCollectFileById" parameterType="Long" resultMap="CollectFileResult">
|
||||
<include refid="selectCollectFileVo"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCollectFile" parameterType="CollectFile">
|
||||
insert into col_collect_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="collectId != null">collect_id,</if>
|
||||
<if test="catelog != null">catelog,</if>
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="url != null">url,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="collectId != null">#{collectId},</if>
|
||||
<if test="catelog != null">#{catelog},</if>
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="url != null">#{url},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCollectFile" parameterType="CollectFile">
|
||||
update col_collect_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="collectId != null">collect_id = #{collectId},</if>
|
||||
<if test="catelog != null">catelog = #{catelog},</if>
|
||||
<if test="fileName != null">file_name = #{fileName},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="url != null">url = #{url},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCollectFileById" parameterType="Long">
|
||||
delete from col_collect_file where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCollectFileByIds" parameterType="String">
|
||||
delete from col_collect_file where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<update id="removeCollectFileById" parameterType="Long">
|
||||
update col_collect_file set del_flag='1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeCollectFileByIds" parameterType="String">
|
||||
update col_collect_file set del_flag='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="batchInsertCollectFile">
|
||||
insert into col_collect_file( id, collect_id, catelog, file_name, name, create_time, create_by,url) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.collectId}, #{item.catelog}, #{item.fileName}, #{item.name}, #{item.createTime}, #{item.createBy}, #{item.url})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteCollectFileByCollectId" parameterType="Long">
|
||||
delete from col_collect_file where collect_id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -24,8 +24,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="CommemorativeCoinCollectFileResult" type="CommemorativeCoinVo" extends="CommemorativeCoinResult">
|
||||
<collection property="collectFileList" notNullColumn="sub_id" javaType="java.util.List" resultMap="CollectFileResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="CollectFileVo" id="CollectFileResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="collectId" column="collect_id" />
|
||||
<result property="catelog" column="catelog" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="name" column="name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="url" column="url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCommemorativeCoinVo">
|
||||
select a.id, a.type, a.full_name, a.short_name, a.face_value, a.issue_date, a.issue_year, a.series, a.set_number, a.block_type, a.shape, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark from col_commemorative_coin a
|
||||
select a.id, a.type, a.full_name, a.short_name, a.face_value, a.issue_date,
|
||||
a.issue_year, a.series, a.set_number, a.block_type, a.shape, a.create_by,
|
||||
a.create_time, a.update_by, a.update_time, a.del_flag, a.remark,
|
||||
b.id as sub_id, b.collect_id as sub_collect_id, b.catelog as sub_catelog, b.file_name as sub_file_name,
|
||||
b.name as sub_name, b.create_by as sub_create_by, b.create_time as sub_create_time, b.url as sub_url
|
||||
from col_commemorative_coin a
|
||||
left join col_collect_file b on b.collect_id=a.id
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectCommemorativeCoinList" parameterType="CommemorativeCoinDto" resultMap="CommemorativeCoinResult">
|
||||
@@ -41,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="blockType != null and blockType != ''"> and a.block_type = #{blockType}</if>
|
||||
<if test="shape != null and shape != ''"> and a.shape = #{shape}</if>
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
order by a.issue_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectCommemorativeCoinById" parameterType="Long" resultMap="CommemorativeCoinResult">
|
||||
|
||||
Reference in New Issue
Block a user