feat(file): 优化文件上传下载功能并重构文件日志实体

- 重构OmsFileLog实体类,添加文件路径、大小、类型等属性
- 更新文件上传接口,使用OmsFileLog对象存储文件信息并返回完整对象
- 修改文件下载接口,使用正确的文件路径和文件名进行下载
- 优化前端文件上传组件,统一处理单文件和多文件上传返回格式
- 添加文件列表变化事件监听,完善文件上传成功回调逻辑
- 在采购订单中集成文件上传功能,支持附件关联和展示
- 修复流程审批中的版本判断逻辑,优化任务处理流程
- 添加导出功能的数据权限验证,确保数据安全性
master
chenhao 2025-12-23 15:59:21 +08:00
parent 71095c9f3b
commit 4f781c9f2b
15 changed files with 305 additions and 119 deletions

View File

@ -29,9 +29,9 @@
<!-- 文件列表 -->
<transition-group ref="uploadFileList" class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
<li :key="file.id" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${baseUrl}${file.filePath}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.fileName) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled"></el-link>
@ -112,6 +112,7 @@ export default {
const movedItem = this.fileList.splice(evt.oldIndex, 1)[0]
this.fileList.splice(evt.newIndex, 0, movedItem)
this.$emit("input", this.listToString(this.fileList))
this.$emit("file-list-changed", this.fileList)
}
})
})
@ -188,8 +189,8 @@ export default {
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName })
if (res.code === 0) {
this.uploadList.push({ ...res.data })
this.uploadedSuccessfully()
} else {
this.number--
@ -203,6 +204,7 @@ export default {
handleDelete(index) {
this.fileList.splice(index, 1)
this.$emit("input", this.listToString(this.fileList))
this.$emit("file-list-changed", this.fileList)
},
//
uploadedSuccessfully() {
@ -211,6 +213,7 @@ export default {
this.uploadList = []
this.number = 0
this.$emit("input", this.listToString(this.fileList))
this.$emit("file-list-changed", this.fileList)
this.$modal.closeLoading()
}
},

View File

@ -107,6 +107,12 @@
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="附件" prop="fileId">
<file-upload :value="fileList" @file-list-changed="handleFileListChanged" :limit="1"
:file-type="['png', 'jpg', 'jpeg', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf']"/>
</el-form-item>
</el-col>
</el-row>
<el-divider content-position="left">采购列表</el-divider>
<el-table :data="form.omsPurchaseOrderItemList" style="width: 100%">
@ -196,13 +202,15 @@ import { getPurchaseorder, addPurchaseorder, updatePurchaseorder } from "@/api/s
import { listAllVendor } from "@/api/base/vendor";
import SelectUser from "@/views/system/user/selectUser";
import SelectProduct from "@/views/system/product/selectProduct";
import FileUpload from "@/components/FileUpload";
import { getDicts } from "@/api/system/dict/data";
import TaxRateInput from "@/components/TaxRateInput/TaxInput.vue";
import request from '@/utils/request'
export default {
name: "PurchaseOrderDetail",
components: {TaxRateInput, SelectUser, SelectProduct },
components: {TaxRateInput, SelectUser, SelectProduct, FileUpload},
props: {
orderData: {
type: Object,
@ -228,6 +236,7 @@ export default {
purchaserSelectOpen: false,
//
ownerSelectOpen: false,
fileList: [],
//
form: {
id: null,
@ -245,6 +254,7 @@ export default {
ownerId: null,
ownerName: null,
remark: null,
fileId: null,
totalAmount: null,
status: 0,
approveStatus: 0,
@ -305,6 +315,12 @@ export default {
// vendorOptions
this.$nextTick(() => {
this.handleVendorChange(this.form.vendorId);
// fileList
if (this.form.fileLog) {
this.fileList = [{...this.form.fileLog}]
} else {
this.fileList = [];
}
// omsPurchaseOrderItemList
if (this.form.omsPurchaseOrderItemList && this.form.omsPurchaseOrderItemList.length === 0) {
this.form.omsPurchaseOrderItemList.push(this.getNewPurchaseOrderItem());
@ -328,6 +344,11 @@ export default {
if (this.orderData) {
this.form = JSON.parse(JSON.stringify(this.orderData));
this.handleVendorChange(this.form.vendorId);
if (this.form.fileLog) {
this.fileList = [{...this.form.fileLog}]
} else {
this.fileList = [];
}
if (this.form.omsPurchaseOrderItemList && this.form.omsPurchaseOrderItemList.length === 0) {
this.form.omsPurchaseOrderItemList.push(this.getNewPurchaseOrderItem());
}
@ -443,6 +464,10 @@ export default {
this.$set(this.form, 'ownerName', user.userName);
this.ownerSelectOpen = false;
},
handleFileListChanged(fileList) {
this.fileList = fileList;
this.form.fileId = this.fileList.map(f => f.id).filter(id => !!id).join(',')
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@ -480,6 +505,7 @@ export default {
ownerId: null,
ownerName: null,
remark: null,
fileId: null,
totalAmount: null,
status: 0,
approveStatus: 0,
@ -503,6 +529,7 @@ export default {
this.purchaserSelectOpen = false;
this.ownerSelectOpen = false;
this.productSelectOpen = false;
this.fileList = [];
this.editingProductIndex = -1;
this.currentProductType = null;
if (this.$refs.form) {

View File

@ -105,6 +105,12 @@
<span>{{ form.remark }}</span>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.fileLog">
<el-form-item label="附件" prop="annex">
<el-link :href="getFileUrl(form.fileLog.filePath)" target="_blank" type="primary" style="margin-right: 10px">{{ form.fileLog.fileName }}</el-link>
<el-button size="mini" type="text" icon="el-icon-download" @click="downloadFile(form.fileLog)"></el-button>
</el-form-item>
</el-col>
</el-row>
<el-divider content-position="left">采购列表</el-divider>
<el-table :data="form.omsPurchaseOrderItemList" style="width: 100%">
@ -236,6 +242,7 @@ import {getDicts} from "@/api/system/dict/data";
export default {
name: "PurchaseOrderDetailView",
dicts: ['approve_status'],
components: {},
props: {
orderData: {
type: Object,
@ -267,6 +274,7 @@ export default {
ownerId: null,
ownerName: null,
remark: null,
annex: null,
totalAmount: null,
status: 0,
approveStatus: 0,
@ -279,6 +287,9 @@ export default {
};
},
computed: {
annexList() {
return this.form.annex ? this.form.annex.split(',') : [];
},
totalAmountWithTax() {
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => acc + (cur.amountTotal || 0), 0);
return this.$calc.toFixed(total) || 0;
@ -365,6 +376,7 @@ export default {
ownerId: null,
ownerName: null,
remark: null,
annex: null,
totalAmount: null,
status: 0,
approveStatus: 0,
@ -387,6 +399,22 @@ export default {
handleViewHistoryDetail(row) {
this.$emit('view-history-detail', row);
this.showHistoryDialog = false; //
},
getFileUrl(url) {
if (url && (url.indexOf('http://') === 0 || url.indexOf('https://') === 0)) {
return url;
}
return process.env.VUE_APP_BASE_API + url;
},
getFileName(url) {
if (url) {
return url.substring(url.lastIndexOf('/') + 1);
}
return '';
},
downloadFile(file) {
const url = `${process.env.VUE_APP_BASE_API}/project/order/file/download?filePath=${encodeURIComponent(file.filePath)}&fileName=${encodeURIComponent(file.fileName)}`;
window.location.href = url;
}
}
};

View File

@ -87,23 +87,16 @@ public class CommonController
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
OmsFileLog omsFileLog =OmsFileLog.builder()
.url(url)
.fileName(fileName)
.newFilename(FileUtils.getName(fileName))
.originalFilename(file.getOriginalFilename())
.createBy(ShiroUtils.getUserId().toString())
.createTime(DateUtil.date())
.build();
OmsFileLog omsFileLog = new OmsFileLog();
omsFileLog.setFilePath(fileName);
omsFileLog.setNewFilename(FileUtils.getName(fileName));
omsFileLog.setFileName(file.getOriginalFilename());
omsFileLog.setFileSize(file.getSize());
omsFileLog.setFileType(file.getContentType());
omsFileLog.setCreateBy(ShiroUtils.getUserId().toString());
omsFileLog.setCreateTime(DateUtil.date());
fileLogService.insert(omsFileLog);
AjaxResult ajax = AjaxResult.success();
ajax.put("id", omsFileLog.getId());
ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
return AjaxResult.success(omsFileLog);
}
catch (Exception e)
{
@ -117,9 +110,9 @@ public class CommonController
String localPath = RuoYiConfig.getProfile();
OmsFileLog omsFileLog = fileLogService.queryById(id);
// 下载名称
String downloadPath = omsFileLog.getFileName().replace(Constants.RESOURCE_PREFIX,localPath);
String downloadPath = omsFileLog.getFilePath().replace(Constants.RESOURCE_PREFIX,localPath);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, StringUtils.isEmpty(omsFileLog.getOriginalFilename()) ? omsFileLog.getNewFilename() : omsFileLog.getOriginalFilename());
FileUtils.setAttachmentResponseHeader(response, StringUtils.isEmpty(omsFileLog.getFileName()) ? omsFileLog.getFileName() : omsFileLog.getNewFilename());
FileUtils.writeBytes(downloadPath, response.getOutputStream());
} catch (Exception e) {
log.error("下载文件失败", e);
@ -137,25 +130,22 @@ public class CommonController
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
List<OmsFileLog> resultList=new ArrayList<>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
urls.add(url);
fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
OmsFileLog omsFileLog = new OmsFileLog();
omsFileLog.setFilePath(fileName);
omsFileLog.setNewFilename(FileUtils.getName(fileName));
omsFileLog.setFileName(file.getOriginalFilename());
omsFileLog.setFileSize(file.getSize());
omsFileLog.setFileType(file.getContentType());
omsFileLog.setCreateBy(ShiroUtils.getUserId().toString());
omsFileLog.setCreateTime(DateUtil.date());
resultList.add(omsFileLog);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
AjaxResult ajax = AjaxResult.success(resultList);
return ajax;
}
catch (Exception e)

View File

@ -122,6 +122,14 @@ public class VueDeliveryController extends BaseController {
@Log(title = "发货记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public AjaxResult export(@RequestBody InventoryDelivery inventoryDelivery) {
inventoryDelivery.setDeliveryStatus(InventoryDelivery.DeliveryStatusEnum.CONFIRM_DELIVERY.getCode());
if (!inventoryAuthService.authAll()) {
List<String> productCodeList = inventoryAuthService.authProductCode();
if (CollUtil.isEmpty(productCodeList)) {
return error("数据为空");
}
inventoryDelivery.setProductCodeList(productCodeList);
}
List<InventoryDelivery> list = inventoryDeliveryService.selectInventoryDeliveryList(inventoryDelivery);
ExcelUtil<InventoryDelivery> util = new ExcelUtil<>(InventoryDelivery.class);
return util.exportExcel(list, "发货记录数据");

View File

@ -1,9 +1,11 @@
package com.ruoyi.sip.controller.vue;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.sip.domain.InventoryOuter;
@ -131,4 +133,25 @@ public class VueInventoryOuterController extends BaseController
}
}
/**
*
*/
@RequiresPermissions("inventory:outer:export")
@Log(title = "出库单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(InventoryOuter inventoryOuter)
{
inventoryOuter.setOuterStatusList(Arrays.asList(InventoryOuter.OuterStatusEnum.WAIT_RECEIVE.getCode(), InventoryOuter.OuterStatusEnum.RECEIVED.getCode()));
if (!inventoryAuthService.authAll()){
List<String> productCodeList = inventoryAuthService.authProductCode();
if (CollUtil.isEmpty(productCodeList)){
return error("数据为空");
}
inventoryOuter.setProductCodeList(productCodeList);
}
List<InventoryOuter> list = inventoryOuterService.selectInventoryOuterList(inventoryOuter);
ExcelUtil<InventoryOuter> util = new ExcelUtil<InventoryOuter>(InventoryOuter.class);
return util.exportExcel(list, "出库单数据");
}
}

View File

@ -1,11 +1,13 @@
package com.ruoyi.sip.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* (OmsFileLog)
*
@ -13,31 +15,55 @@ import java.util.Date;
* @since 2025-08-27 18:01:33
*/
@Data
@Builder
public class OmsFileLog {
public class OmsFileLog extends BaseEntity {
/**
* ID
*/
private Integer id;
private String url;
private String fileName;
/**
*
*/
private String newFilename;
private String originalFilename;
/**
*
*/
private String fileName;
/**
*
*/
private String filePath;
/**
*
*/
private Long fileSize;
/**
* MIME
*/
private String fileType;
/**
*
*/
private String createBy;
private String updateBy;
/**
*
*/
private Date updateTime;
private Date createTime;
/**
*
*/
private String remark;
}

View File

@ -103,6 +103,8 @@ public class OmsPurchaseOrder extends BaseEntity
private String processKey;
private String todoId;
private String taskId;
private Integer fileId;
private OmsFileLog fileLog;
/** 采购单明细表信息 */

View File

@ -89,6 +89,7 @@ public class OmsPurchaseOrderHistory extends BaseEntity
/** 版本号 */
private Integer version;
private Integer fileId;
private List<OmsPurchaseOrderItemHistory> omsPurchaseOrderItemList;
}

View File

@ -19,9 +19,7 @@ import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.mapper.OmsPurchaseOrderItemHistoryMapper;
import com.ruoyi.sip.mapper.OmsPurchaseOrderHistoryMapper;
import com.ruoyi.sip.service.ICnareaService;
import com.ruoyi.sip.service.IInventoryAuthService;
import com.ruoyi.sip.service.IVendorInfoService;
import com.ruoyi.sip.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.flowable.engine.ManagementService;
@ -35,7 +33,6 @@ import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.sip.mapper.OmsPurchaseOrderMapper;
import com.ruoyi.sip.service.IOmsPurchaseOrderService;
import javax.annotation.Resource;
@ -69,6 +66,8 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
private TodoService todoService;
@Autowired
protected ManagementService managementService;
@Autowired
private IOmsFileLogService omsFileLogService;
/**
*
*
@ -79,9 +78,15 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
public OmsPurchaseOrder selectOmsPurchaseOrderById(Long id)
{
OmsPurchaseOrder omsPurchaseOrder = omsPurchaseOrderMapper.selectOmsPurchaseOrderById(id);
if (omsPurchaseOrder == null) {
return null;
}
List<OmsPurchaseOrderItem> omsPurchaseOrderItems = omsPurchaseOrderMapper.listItemByPurchaseId(id);
omsPurchaseOrder.setOmsPurchaseOrderItemList(omsPurchaseOrderItems);
if (omsPurchaseOrder.getFileId() != null) {
OmsFileLog omsFileLog = omsFileLogService.queryById(omsPurchaseOrder.getFileId());
omsPurchaseOrder.setFileLog(omsFileLog);
}
return omsPurchaseOrder;
}
@ -353,8 +358,15 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
@Override
public OmsPurchaseOrder selectOmsPurchaseOrderByNo(String purchaseNo) {
OmsPurchaseOrder omsPurchaseOrder = omsPurchaseOrderMapper.selectByNo(purchaseNo);
if (omsPurchaseOrder == null){
return null;
}
List<OmsPurchaseOrderItem> omsPurchaseOrderItems = omsPurchaseOrderMapper.listItemByPurchaseId(omsPurchaseOrder.getId());
omsPurchaseOrder.setOmsPurchaseOrderItemList(omsPurchaseOrderItems);
if (omsPurchaseOrder.getFileId() != null) {
OmsFileLog omsFileLog = omsFileLogService.queryById(omsPurchaseOrder.getFileId());
omsPurchaseOrder.setFileLog(omsFileLog);
}
return omsPurchaseOrder;
}

View File

@ -1176,6 +1176,8 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
String taskName = todo.getTaskName();
String businessKey = todo.getBusinessKey();
ProcessInstance processInstance = todoService.getProcessInstance(getFlowBusinessKey(businessKey, null));
Integer processDefinitionVersion = processInstance.getProcessDefinitionVersion();
// 审批驳回处理
if (approveBtn.equals(0)) {
handleRejectOrder(taskName, businessKey);
@ -1187,7 +1189,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
handleBusinessApproval(businessKey);
} else if ("省代".equals(taskName)) {
handlePartnerApproval(businessKey);
} else if ("领导1".equals(taskName) && todo.getApplyTime().compareTo(DateUtils.parseDate("2025-12-19"))>0){
} else if ("领导1".equals(taskName) && processDefinitionVersion>9){
ProjectOrderInfo orderInfo = selectProjectOrderInfoByOrderCode(businessKey);
String amountConfig = configService.selectConfigByKey("order.approve.amount.config");
BigDecimal amountConfigNumber = new BigDecimal(amountConfig);
@ -1196,7 +1198,6 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
//查询对应的数据 插入已办数据
List<Long> approveUserList = approveConfigService.listByProcessKeyAndTaskName(todo.getProcessKey(), "公司领导");
for (Long l : approveUserList) {
todoService.completed(new HashMap<>(), todo.getTaskId(), businessKey);
todo.setApproveUser(l.toString());
todo.setTaskName("公司领导");
todo.setApproveUserName(userService.selectUserById(l).getUserName());

View File

@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)</if>
<if test="approveUserName != null and approveUserName != ''">and approve_user_name = #{approveUserName}
</if>
<if test="approveUser != null and approveUser != ''">and approve_user = #{approveUser}</if>
<if test="applyUserName != null and applyUserName != ''">and apply_user_name like concat('%',
#{applyUserName}, '%')
</if>

View File

@ -1,23 +1,27 @@
<?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.ruoyi.sip.mapper.OmsFileLogMapper">
<resultMap type="com.ruoyi.sip.domain.OmsFileLog" id="OmsFileLogMap">
<result property="id" column="id"/>
<result property="url" column="url"/>
<result property="fileName" column="file_name"/>
<result property="newFilename" column="new_filename"/>
<result property="originalFilename" column="original_filename"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="id" column="id"/>
<result property="newFilename" column="new_filename"/>
<result property="fileName" column="file_name"/>
<result property="filePath" column="file_path"/>
<result property="fileSize" column="file_size"/>
<result property="fileType" column="file_type"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<!-- 基本字段 -->
<!-- 基本字段 -->
<sql id="Base_Column_List">
id, url, file_name, new_filename, original_filename, create_by, create_time
id, new_filename, file_name, file_path, file_size, file_type, create_by, create_time, update_by, update_time, remark
</sql>
<!--通过实体作为筛选条件查询-->
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="OmsFileLogMap">
select
<include refid="Base_Column_List" />
@ -26,17 +30,20 @@ id, url, file_name, new_filename, original_filename, create_by, create_time
<if test="id != null">
and id = #{id}
</if>
<if test="url != null and url != ''">
and url = #{url}
<if test="newFilename != null and newFilename != ''">
and new_filename = #{newFilename}
</if>
<if test="fileName != null and fileName != ''">
and file_name = #{fileName}
</if>
<if test="newFilename != null and newFilename != ''">
and new_filename = #{newFilename}
<if test="filePath != null and filePath != ''">
and file_path = #{filePath}
</if>
<if test="originalFilename != null and originalFilename != ''">
and original_filename = #{originalFilename}
<if test="fileSize != null">
and file_size = #{fileSize}
</if>
<if test="fileType != null and fileType != ''">
and file_type = #{fileType}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
@ -44,34 +51,46 @@ id, url, file_name, new_filename, original_filename, create_by, create_time
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
</where>
</select>
<!--根据ID查详情-->
<select id="queryById" parameterType="Integer" resultMap="OmsFileLogMap">
SELECT
id, url, file_name, new_filename, original_filename, create_by, create_time
<include refid="Base_Column_List" />
FROM oms_file_log
WHERE id = #{id} LIMIT 1
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO oms_file_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="url != null and url != ''">
url,
<if test="newFilename != null and newFilename != ''">
new_filename,
</if>
<if test="fileName != null and fileName != ''">
file_name,
</if>
<if test="newFilename != null and newFilename != ''">
new_filename,
<if test="filePath != null and filePath != ''">
file_path,
</if>
<if test="originalFilename != null and originalFilename != ''">
original_filename,
<if test="fileSize != null">
file_size,
</if>
<if test="fileType != null and fileType != ''">
file_type,
</if>
<if test="createBy != null and createBy != ''">
create_by,
@ -79,19 +98,31 @@ id, url, file_name, new_filename, original_filename, create_by, create_time
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="url != null and url != ''">
#{url},
<if test="newFilename != null and newFilename != ''">
#{newFilename},
</if>
<if test="fileName != null and fileName != ''">
#{fileName},
</if>
<if test="newFilename != null and newFilename != ''">
#{newFilename},
<if test="filePath != null and filePath != ''">
#{filePath},
</if>
<if test="originalFilename != null and originalFilename != ''">
#{originalFilename},
<if test="fileSize != null">
#{fileSize},
</if>
<if test="fileType != null and fileType != ''">
#{fileType},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
@ -99,24 +130,36 @@ id, url, file_name, new_filename, original_filename, create_by, create_time
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
</trim>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE oms_file_log
<trim prefix="SET" suffixOverrides=",">
<if test="url != null and url != ''">
url = #{url},
<if test="newFilename != null and newFilename != ''">
new_filename = #{newFilename},
</if>
<if test="fileName != null and fileName != ''">
file_name = #{fileName},
</if>
<if test="newFilename != null and newFilename != ''">
new_filename = #{newFilename},
<if test="filePath != null and filePath != ''">
file_path = #{filePath},
</if>
<if test="originalFilename != null and originalFilename != ''">
original_filename = #{originalFilename},
<if test="fileSize != null">
file_size = #{fileSize},
</if>
<if test="fileType != null and fileType != ''">
file_type = #{fileType},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
@ -124,23 +167,32 @@ id, url, file_name, new_filename, original_filename, create_by, create_time
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
</trim>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE FROM oms_file_log WHERE id = #{id}
DELETE FROM oms_file_log WHERE id = #{id}
</delete>
<!--通过id批量删除-->
<delete id="batchRemove">
delete from oms_file_log where id in
delete from oms_file_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</foreach>
</delete>
</mapper>

View File

@ -36,10 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="fileId" column="file_id" />
</resultMap>
<sql id="selectOmsPurchaseOrderHistoryVo">
select id, purchase_id, purchase_no, buyer_name, buyer_address, vendor_id, vendor_name, vendor_user, vendor_phone, currency, purchaser_id, purchaser_name, purchaser_mobile, purchaser_email, warehouse_id, pay_method, owner_id, owner_name, total_amount, status, approve_status, approve_time, approve_node, confirm_status, del_flag, version, create_by, create_time, update_by, update_time, remark from oms_purchase_order_history
select id, purchase_id, purchase_no, buyer_name, buyer_address, vendor_id, vendor_name, vendor_user, vendor_phone, currency, purchaser_id, purchaser_name, purchaser_mobile, purchaser_email, warehouse_id, pay_method, owner_id, owner_name, total_amount, status, approve_status, approve_time, approve_node, confirm_status, del_flag, version, create_by, create_time, update_by, update_time, remark, file_id from oms_purchase_order_history
</sql>
<insert id="insertOmsPurchaseOrderHistory" parameterType="OmsPurchaseOrderHistory" useGeneratedKeys="true" keyProperty="id">
@ -76,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="flowType != null">flow_type,</if>
<if test="fileId != null">file_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseId != null">#{purchaseId},</if>
@ -104,11 +106,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
<if test="version != null">#{version},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">create_time,</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">update_time,</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="flowType != null">#{flowType},</if>
<if test="fileId != null">#{fileId},</if>
</trim>
</insert>

View File

@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="fileId" column="file_id" />
</resultMap>
<resultMap type="OmsPurchaseOrderItem" id="OmsPurchaseOrderItemResult">
@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version,t1.flow_type
, t1.file_id
from oms_purchase_order t1
</sql>
<sql id="selectOmsPurchaseOrderItemVo">
@ -69,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount,t1.flow_type
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version
, t1.file_id
,t2.vendor_name,t2.vendor_user,t2.vendor_phone,t3.warehouse_name
from oms_purchase_order t1
left join oms_vendor_info t2 on t1.vendor_id = t2.vendor_id
@ -111,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount,t1.flow_type
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version
, t1.file_id
,t2.vendor_name,t2.vendor_user,t2.vendor_phone
,t3.apply_time,t3.process_key,t3.todo_id,t3.task_id
<if test="'bu_todo_completed'.equals(tableName)">
@ -257,6 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</if>
<if test="version != null">version,</if>
<if test="flowType != null">flow_type,</if>
<if test="fileId != null">file_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseNo != null">#{purchaseNo},</if>
@ -284,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
<if test="version != null">#{version},</if>
<if test="flowType != null">#{flowType},</if>
<if test="fileId != null">#{fileId},</if>
</trim>
</insert>
@ -315,6 +321,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="version != null">version = #{version},</if>
<if test="flowType != null">flow_type=#{flowType},</if>
<if test="fileId != null">file_id = #{fileId},</if>
</trim>
where id = #{id}
</update>
@ -346,6 +353,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="version != null">version = #{version},</if>
<if test="flowType != null">flow_type=#{flowType},</if>
<if test="fileId != null">file_id = #{fileId},</if>
</trim>
where purchase_no = #{purchaseNo}
</update>
@ -377,6 +385,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="version != null">version = #{version},</if>
<if test="flowType != null">flow_type=#{flowType},</if>
<if test="fileId != null">file_id = #{fileId},</if>
</trim>
where purchase_no = #{purchaseNo}
</update>