工序3
parent
309f2c2999
commit
2dbf3601f6
@ -0,0 +1,22 @@
|
||||
package com.op.system.api;
|
||||
|
||||
import com.op.common.core.constant.ServiceNameConstants;
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.system.api.factory.RemoteMesFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author OP
|
||||
*/
|
||||
@FeignClient(contextId = "remoteMesService", value = ServiceNameConstants.MES_SERVICE, fallbackFactory = RemoteMesFallbackFactory.class)
|
||||
public interface RemoteMesService {
|
||||
|
||||
@PostMapping("/file/upLoadFile")
|
||||
public R<Boolean> upLoadFile(@RequestBody List<BaseFileData> files);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.op.system.api.factory;
|
||||
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.system.api.RemoteMesService;
|
||||
import com.op.system.api.RemoteUserService;
|
||||
import com.op.system.api.domain.SysUser;
|
||||
import com.op.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author OP
|
||||
*/
|
||||
@Component
|
||||
public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteMesFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteMesService create(Throwable throwable) {
|
||||
log.error("Mes服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteMesService() {
|
||||
@Override
|
||||
public R<Boolean> upLoadFile(List<BaseFileData> files) {
|
||||
return R.fail("上传失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.op.common.core.domain;
|
||||
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 附件对象 base_file
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
public class BaseFileData extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 附件ID */
|
||||
private String fileId;
|
||||
|
||||
/** 附件名称 */
|
||||
@Excel(name = "附件名称")
|
||||
private String fileName;
|
||||
|
||||
/** 附件地址 */
|
||||
@Excel(name = "附件地址")
|
||||
private String fileAddress;
|
||||
|
||||
/** 数据来源 */
|
||||
@Excel(name = "数据来源")
|
||||
private String sourceId;
|
||||
|
||||
/** 预留字段1 */
|
||||
@Excel(name = "预留字段1")
|
||||
private String attr1;
|
||||
|
||||
/** 预留字段2 */
|
||||
@Excel(name = "预留字段2")
|
||||
private String attr2;
|
||||
|
||||
/** 预留字段3 */
|
||||
@Excel(name = "预留字段3")
|
||||
private Long attr3;
|
||||
|
||||
/** 预留字段4 */
|
||||
@Excel(name = "预留字段4")
|
||||
private Long attr4;
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setFileAddress(String fileAddress) {
|
||||
this.fileAddress = fileAddress;
|
||||
}
|
||||
|
||||
public String getFileAddress() {
|
||||
return fileAddress;
|
||||
}
|
||||
public void setSourceId(String sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
public String getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
public void setAttr3(Long attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public Long getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
public void setAttr4(Long attr4) {
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public Long getAttr4() {
|
||||
return attr4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("fileId", getFileId())
|
||||
.append("fileName", getFileName())
|
||||
.append("fileAddress", getFileAddress())
|
||||
.append("sourceId", getSourceId())
|
||||
.append("remark", getRemark())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("attr4", getAttr4())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.op.mes.controller;
|
||||
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.utils.poi.ExcelUtil;
|
||||
import com.op.common.core.web.controller.BaseController;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import com.op.common.core.web.page.TableDataInfo;
|
||||
import com.op.common.log.annotation.Log;
|
||||
import com.op.common.log.enums.BusinessType;
|
||||
import com.op.common.security.annotation.RequiresPermissions;
|
||||
|
||||
import com.op.mes.domain.BaseFile;
|
||||
import com.op.mes.service.IBaseFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Controller
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class BaseFileController extends BaseController {
|
||||
@Autowired
|
||||
private IBaseFileService baseFileService;
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*/
|
||||
@RequiresPermissions("system:file:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BaseFile baseFile) {
|
||||
startPage();
|
||||
List<BaseFile> list = baseFileService.selectBaseFileList(baseFile);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出附件列表
|
||||
*/
|
||||
@RequiresPermissions("system:file:export")
|
||||
@Log(title = "附件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseFile baseFile) {
|
||||
List<BaseFile> list = baseFileService.selectBaseFileList(baseFile);
|
||||
ExcelUtil<BaseFile> util = new ExcelUtil<BaseFile>(BaseFile.class);
|
||||
util.exportExcel(response, list, "附件数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取附件详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:file:query")
|
||||
@GetMapping(value = "/{fileId}")
|
||||
public AjaxResult getInfo(@PathVariable("fileId") String fileId) {
|
||||
return success(baseFileService.selectBaseFileByFileId(fileId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*/
|
||||
@RequiresPermissions("system:file:add")
|
||||
@Log(title = "附件", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseFile baseFile) {
|
||||
return toAjax(baseFileService.insertBaseFile(baseFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*/
|
||||
@RequiresPermissions("system:file:edit")
|
||||
@Log(title = "附件", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseFile baseFile) {
|
||||
return toAjax(baseFileService.updateBaseFile(baseFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*/
|
||||
@RequiresPermissions("system:file:remove")
|
||||
@Log(title = "附件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{fileIds}")
|
||||
public AjaxResult remove(@PathVariable String[] fileIds) {
|
||||
return toAjax(baseFileService.deleteBaseFileByFileIds(fileIds));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "批量上传附件", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/upLoadFile")
|
||||
public Boolean add(@RequestBody List<BaseFileData> baseFiles) {
|
||||
return baseFileService.insertBaseFileBatch(baseFiles);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.op.mes.domain;
|
||||
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 附件对象 base_file
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
public class BaseFile extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 附件ID */
|
||||
private String fileId;
|
||||
|
||||
/** 附件名称 */
|
||||
@Excel(name = "附件名称")
|
||||
private String fileName;
|
||||
|
||||
/** 附件地址 */
|
||||
@Excel(name = "附件地址")
|
||||
private String fileAddress;
|
||||
|
||||
/** 数据来源 */
|
||||
@Excel(name = "数据来源")
|
||||
private String sourceId;
|
||||
|
||||
/** 预留字段1 */
|
||||
@Excel(name = "预留字段1")
|
||||
private String attr1;
|
||||
|
||||
/** 预留字段2 */
|
||||
@Excel(name = "预留字段2")
|
||||
private String attr2;
|
||||
|
||||
/** 预留字段3 */
|
||||
@Excel(name = "预留字段3")
|
||||
private Long attr3;
|
||||
|
||||
/** 预留字段4 */
|
||||
@Excel(name = "预留字段4")
|
||||
private Long attr4;
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setFileAddress(String fileAddress) {
|
||||
this.fileAddress = fileAddress;
|
||||
}
|
||||
|
||||
public String getFileAddress() {
|
||||
return fileAddress;
|
||||
}
|
||||
public void setSourceId(String sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
public String getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
public void setAttr3(Long attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public Long getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
public void setAttr4(Long attr4) {
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public Long getAttr4() {
|
||||
return attr4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("fileId", getFileId())
|
||||
.append("fileName", getFileName())
|
||||
.append("fileAddress", getFileAddress())
|
||||
.append("sourceId", getSourceId())
|
||||
.append("remark", getRemark())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("attr4", getAttr4())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.op.mes.mapper;
|
||||
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.mes.domain.BaseFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Mapper接口
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
@Mapper
|
||||
public interface BaseFileMapper {
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
public BaseFile selectBaseFileByFileId(String fileId);
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 附件集合
|
||||
*/
|
||||
public List<BaseFile> selectBaseFileList(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseFile(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseFile(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFileByFileId(String fileId);
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param fileIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFileByFileIds(String[] fileIds);
|
||||
|
||||
Boolean insertBaseFileBatch(@Param("baseFiles") List<BaseFileData> baseFiles);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.op.mes.service;
|
||||
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.mes.domain.BaseFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Service接口
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
public interface IBaseFileService {
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
public BaseFile selectBaseFileByFileId(String fileId);
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 附件集合
|
||||
*/
|
||||
public List<BaseFile> selectBaseFileList(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseFile(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseFile(BaseFile baseFile);
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param fileIds 需要删除的附件主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFileByFileIds(String[] fileIds);
|
||||
|
||||
/**
|
||||
* 删除附件信息
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFileByFileId(String fileId);
|
||||
|
||||
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles);
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.op.mes.service.impl;
|
||||
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.mes.domain.BaseFile;
|
||||
import com.op.mes.mapper.BaseFileMapper;
|
||||
import com.op.mes.service.IBaseFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Service业务层处理
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
@Service
|
||||
public class BaseFileServiceImpl implements IBaseFileService {
|
||||
@Autowired
|
||||
private BaseFileMapper baseFileMapper;
|
||||
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
public BaseFile selectBaseFileByFileId(String fileId) {
|
||||
return baseFileMapper.selectBaseFileByFileId(fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
public List<BaseFile> selectBaseFileList(BaseFile baseFile) {
|
||||
return baseFileMapper.selectBaseFileList(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseFile(BaseFile baseFile) {
|
||||
baseFile.setCreateTime(DateUtils.getNowDate());
|
||||
return baseFileMapper.insertBaseFile(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseFile(BaseFile baseFile) {
|
||||
baseFile.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseFileMapper.updateBaseFile(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param fileIds 需要删除的附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseFileByFileIds(String[] fileIds) {
|
||||
return baseFileMapper.deleteBaseFileByFileIds(fileIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件信息
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseFileByFileId(String fileId) {
|
||||
return baseFileMapper.deleteBaseFileByFileId(fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFiles 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles) {
|
||||
return baseFileMapper.insertBaseFileBatch(baseFiles);
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
<?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.op.mes.mapper.BaseFileMapper">
|
||||
|
||||
<resultMap type="BaseFile" id="BaseFileResult">
|
||||
<result property="fileId" column="file_id" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="fileAddress" column="file_address" />
|
||||
<result property="sourceId" column="source_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="attr1" column="attr1" />
|
||||
<result property="attr2" column="attr2" />
|
||||
<result property="attr3" column="attr3" />
|
||||
<result property="attr4" column="attr4" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseFileVo">
|
||||
select file_id, file_name, file_address, source_id, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from base_file
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseFileList" parameterType="BaseFile" resultMap="BaseFileResult">
|
||||
<include refid="selectBaseFileVo"/>
|
||||
<where>
|
||||
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="fileAddress != null and fileAddress != ''"> and file_address = #{fileAddress}</if>
|
||||
<if test="sourceId != null and sourceId != ''"> and source_id = #{sourceId}</if>
|
||||
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
||||
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
||||
<if test="attr3 != null "> and attr3 = #{attr3}</if>
|
||||
<if test="attr4 != null "> and attr4 = #{attr4}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseFileByFileId" parameterType="String" resultMap="BaseFileResult">
|
||||
<include refid="selectBaseFileVo"/>
|
||||
where file_id = #{fileId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseFile" parameterType="BaseFile">
|
||||
insert into base_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="fileId != null">file_id,</if>
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="fileAddress != null">file_address,</if>
|
||||
<if test="sourceId != null">source_id,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="attr1 != null">attr1,</if>
|
||||
<if test="attr2 != null">attr2,</if>
|
||||
<if test="attr3 != null">attr3,</if>
|
||||
<if test="attr4 != null">attr4,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="fileId != null">#{fileId},</if>
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="fileAddress != null">#{fileAddress},</if>
|
||||
<if test="sourceId != null">#{sourceId},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="attr4 != null">#{attr4},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertBaseFileBatch">
|
||||
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time)
|
||||
VALUES
|
||||
<foreach collection="baseFiles" index="" item="baseFile" separator=",">
|
||||
(
|
||||
#{baseFile.fileId},
|
||||
#{baseFile.fileName},
|
||||
#{baseFile.fileAddress},
|
||||
#{baseFile.sourceId},
|
||||
#{baseFile.remark},
|
||||
#{baseFile.createBy},
|
||||
#{baseFile.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseFile" parameterType="BaseFile">
|
||||
update base_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="fileName != null">file_name = #{fileName},</if>
|
||||
<if test="fileAddress != null">file_address = #{fileAddress},</if>
|
||||
<if test="sourceId != null">source_id = #{sourceId},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||
<if test="attr4 != null">attr4 = #{attr4},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where file_id = #{fileId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseFileByFileId" parameterType="String">
|
||||
delete from base_file where file_id = #{fileId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseFileByFileIds" parameterType="String">
|
||||
delete from base_file where file_id in
|
||||
<foreach item="fileId" collection="array" open="(" separator="," close=")">
|
||||
#{fileId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue