pull/3/head
Anayigeren 1 month ago
parent 894d6e99a9
commit 5629dcfa3d

@ -17,22 +17,44 @@ public
@Data
class ExpressReport implements Serializable {
// 物流公司
// 物流公司
@Excel(name = "物流公司")
// 订单号
private String expressName;
// 订单号
// 总箱数
@Excel(name = "订单号", width = 20)
private String orderNo;
// 出库时间
// 总箱数
@Excel(name = "总箱数")
// 收货时间
private int totalBoxNum;
// 出库时间
// 二次配送
@Excel(name = "出库时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss")
// 收货时间
// 正常配送
private Date outDate;
@Excel(name = "收货时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss")
// 异常配送
// 二次配送
// 正常配送
// 物流代收款
private Date shouHuoDate;
@Excel(name = "二次配送", type = 10)
// 损失承担
// 异常配送
private int isTwoSend;
// 物流代收款
// 是否拒收
@Excel(name = "正常配送", type = 10)
// 损失承担
private int isNormal;
@Excel(name = "异常配送", type = 10)
private int isNoNormal;
// 是否拒收
@Excel(name = "物流代收款", width = 15, type = 10)
private double expressAmount;
@Excel(name = "损失承担", type = 10)

@ -11,53 +11,57 @@ import java.io.Serializable;
public
@Data
class FinanceReport implements Serializable {
//公司ID
private int cdCompanyId;
//客户经理
@Excel(name = "客户经理")
private String managerName;
//单位/个人
@Excel(name = "单位/个人")
private String companyName;
//用户ID
private int cdUserId;
//总张数
//总张数(预付款)
@Excel(name = "总张数(预付款)", type = 10)
private int beforeCouponCount;
//总金额
//总金额(预付款)
@Excel(name = "总金额(预付款)", type = 10)
private double beforeTotalValue;
//充值金额
//充值金额(预付款)
@Excel(name = "充值金额(预付款)", type = 10)
private double beforeTotalRechargeValue;
//已付
//已付(预付款)
@Excel(name = "已付(预付款)", type = 10)
private double beforeTotalYesValue;
// 未付
// 未付(预付款)
@Excel(name = "未付(预付款)", type = 10)
private double beforeTotalNoValue;
// 余额
// 余额(预付款)
@Excel(name = "余额(预付款)", type = 10)
private double beforeUserTotalValue;
// 回馈总金额
// 回馈总金额(预付款)
@Excel(name = "回馈总金额(预付款)", type = 10)
private double beforeGiftTotalValue;
// 回馈剩余金额
// 回馈剩余金额(预付款)
@Excel(name = "回馈剩余金额(预付款)", type = 10)
private double beforeGiftUserTotalValue;
// 总张数
// 总张数(后付款)
@Excel(name = "总张数(后付款)", type = 10)
private int afterCouponCount;
// 总金额
// 总金额(后付款)
@Excel(name = "总金额(后付款)", type = 10)
private double afterTotalValue;
// 充值金额
// 充值金额(后付款)
@Excel(name = "充值金额(后付款)", type = 10)
private double afterTotalRechargeValue;
// 已付
// 已付(后付款)
@Excel(name = "已付(后付款)", type = 10)
private double afterTotalYesValue;
// 未付
// 未付(后付款)
@Excel(name = "未付(后付款)", type = 10)
private double afterTotalNoValue;
// 余额
// 余额(后付款)
@Excel(name = "余额(后付款)", type = 10)
private double afterUserTotalValue;
// 回馈总金额(后付款)
@ -78,12 +82,16 @@ class FinanceReport implements Serializable {
//回馈总金额
@Excel(name = "回馈总金额", type = 10)
private double giftOrderTotal;
//客户经理代收
@Excel(name = "客户经理代收", type = 10)
private double managerAmount;
//POS
@Excel(name = "POS", type = 10)
private double posAmount;
//转账
@Excel(name = "转账", type = 10)
private double zhuanAmount;
//物流代收
@Excel(name = "物流代收", type = 10)
private double expressAmount;
}

@ -16,33 +16,49 @@ import java.util.Date;
public @Data
class OrderDeliveryReport implements Serializable {
// 下单日期
@Excel(name = "下单日期" , exportFormat="yyyy-MM-dd", importFormat = "yyyy-MM-dd")
private Date createTime;
// 订单号
@Excel(name = "订单号",width = 20)
private String orderNo;
// 快递商
@Excel(name="快递商")
private String expressName;
// 收货人姓名
@Excel(name = "收货人姓名",width = 15)
private String consigneeName;
// 收货人电话
@Excel(name = "收货人电话",width = 15)
private String consigneePhone;
// 收货人地址
@Excel(name = "收货人地址",width = 30)
private String consigneeAddress;
// 金额
@Excel(name = "金额")
private double totalAmount;
// 付款方式
@Excel(name = "付款方式")
private String paymentModeDesc;
// 付款金额
@Excel(name = "付款金额",type = 10)
private double payAmount;
// 附加付款方式
@Excel(name = "附加付款方式")
private String otherPaymentModeDesc;
// 附加付款金额
@Excel(name = "附加付款金额",type = 10)
private double otherPayAmount;
// 送货日期
@Excel(name = "送货日期" , exportFormat="yyyy-MM-dd", importFormat = "yyyy-MM-dd")
private Date appointmentTime;
// 备注
@Excel(name = "备注",width = 30)
private String remark;
// 订单状态描述
private String orderStatusDesc;
// 总箱数
private int totalBoxNum;
// 快递扫描箱数
private int expressScanBoxNum;
}

@ -17,45 +17,67 @@ public
@Data
class OrderReport implements Serializable {
// 支付方式
private String paymentMode;
// 支付金额
private double payAmount;
// 其他支付方式
private String otherPaymentMode;
// 其他支付金额
private double otherPayAmount;
// 订单类型
@Excel(name = "订单类型")
private String orderType;
// 订单号
@Excel(name = "订单号", width = 20)
private String orderNo;
// 客户姓名
@Excel(name = "客户姓名")
private String consigneeName;
// 电话
@Excel(name = "电话", width = 15)
private String consigneePhone;
// 单位/个人
@Excel(name = "单位/个人")
private String companyName;
// 客户经理
@Excel(name = "客户经理")
private String managerName;
// 物流公司
@Excel(name = "物流公司")
private String expressName;
// 总金额
@Excel(name = "总金额")
private double totalAmount;
// 折扣金额
@Excel(name = "折扣金额")
private double discountPrice;
// 客户经理代收
@Excel(name = "客户经理代收", width = 15, type = 10)
private double managerAmount;
// 物流代收
@Excel(name = "物流代收", type = 10)
private double expressAmount;
// 卡类扣款
@Excel(name = "卡类扣款", type = 10)
private double couponAmount;
// 券类扣款
@Excel(name = "券类扣款", type = 10)
private double quanAmount;
// 刷POS
@Excel(name = "刷POS", type = 10)
private double posAmount;
// 转账
@Excel(name = "转账", type = 10)
private double zhuanZhanAmount;
// 其它
@Excel(name = "其它", type = 10)
private double otherAmount;
// 回馈
@Excel(name = "回馈", type = 10)
private double huiKuiAmount;
// 退货金额
@Excel(name = "退货金额", type = 10)
private double returnTotalAmount;
}

@ -5,11 +5,16 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*/
public @Data
class ReportQuery implements Serializable {
// 开始时间
private String beginTime;
// 结束时间
private String endTime;
// 管理员ID
private Integer managerId;
// 公司ID
private Integer companyId;
}

@ -5,14 +5,14 @@ import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
*
*/
public
@Data
class StockDailyReport implements Serializable {
// 商品名称
@Excel(name = "商品名称")
private String itemName;
// 商品编码
@Excel(name = "商品编码")
private String itemCode;
/**

@ -41,9 +41,13 @@ public class ReportOrderService {
* @return
*/
public List<OrderReport> getOrderReportList(ReportQuery reportQuery) {
//查询订单报表
List<OrderReport> orderReportList = mybatisDao.getSqlSessionTemplate().selectList(ReportOrderMapper.REPORT_ORDER_MAPPER_NAMESPACE + "getReportOrderList", reportQuery);
//遍历订单报表
for (OrderReport orderReport : orderReportList) {
//判断付款方式
if ("0".equals(orderReport.getPaymentMode())) {
//如果是汇款
orderReport.setHuiKuiAmount(orderReport.getPayAmount());
}
if ("1".equals(orderReport.getPaymentMode())) {

@ -1,38 +1,66 @@
package com.xmomen.module.resource.api;
/**
* DfsException RuntimeExceptionDFS
*/
public class DfsException extends RuntimeException {
// 序列化版本号,用于确保在反序列化时类的版本一致性
private static final long serialVersionUID = 1497374765949093902L;
/**
* IOException 100
* FileNotFoundException 200
* Exception from DFS (example: from FastDFS, MyException) 300
* OtherException 400
*
*
* - IOException 100
* - FileNotFoundException 200
* - DFS FastDFS MyException 300
* - 400
*/
private String code;
// 异常的详细描述信息
private String message;
/**
* DfsException
* @param code
* @param message
*/
public DfsException(String code, String message) {
this.code = code;
this.message = message;
}
/**
*
* @return
*/
public String getCode() {
return code;
}
/**
*
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
*
* @return
*/
public String getMessage() {
return message;
}
/**
*
* @param message
*/
public void setMessage(String message) {
this.message = message;
}
}
}

@ -2,32 +2,45 @@ package com.xmomen.module.resource.api;
import java.util.Map;
/**
* DfsFile DFS
*
*/
public class DfsFile {
/**
* file data
*
*
*/
private byte[] data;
/**
* key,not used in FastDfs
*
* FastDFS 使
*/
private String key;
/**
* metadata for file
*
*
*
*/
private Map<String, String> metadata;
/**
*
* DfsFile null
*/
public DfsFile() {
}
/**
* constructor with data, key and metadata
* DfsFile
*
* @param key key,not used in FastDfs
* @param data file data
* @param metadata metadata for file
* @param key FastDFS 使
* @param data
* @param metadata
*/
public DfsFile(String key, byte[] data, Map<String, String> metadata) {
this.key = key;
@ -35,28 +48,58 @@ public class DfsFile {
this.metadata = metadata;
}
/**
*
*
* @return
*/
public byte[] getData() {
return data;
}
/**
*
*
* @param data
*/
public void setData(byte[] data) {
this.data = data;
}
/**
*
*
* @return
*/
public String getKey() {
return key;
}
/**
*
*
* @param key
*/
public void setKey(String key) {
this.key = key;
}
/**
*
*
* @return
*/
public Map<String, String> getMetadata() {
return metadata;
}
/**
*
*
* @param metadata
*/
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
}
}

@ -1,45 +1,74 @@
package com.xmomen.module.resource.api;
/**
* DfsPath DFS
* HTTP 访
*/
public class DfsPath {
/**
* whole url, just like http://.../bucketName/remotePath
* HTTP 访 http://.../bucketName/remotePath。
* 访
*/
private String httpPath;
/**
* file path on storage server
*
*
*/
private String remotePath;
/**
* DfsPath null
*/
public DfsPath() {
}
/**
* Constructor with httpPath and remotePath
* HTTP DfsPath
*
* @param httpPath
* @param remotePath
* @param httpPath HTTP 访
* @param remotePath
*/
public DfsPath(String httpPath, String remotePath) {
this.httpPath = httpPath;
this.remotePath = remotePath;
}
/**
* HTTP 访
*
* @return HTTP 访
*/
public String getHttpPath() {
return httpPath;
}
/**
* HTTP 访
*
* @param httpPath HTTP 访
*/
public void setHttpPath(String httpPath) {
this.httpPath = httpPath;
}
/**
*
*
* @return
*/
public String getRemotePath() {
return remotePath;
}
/**
*
*
* @param remotePath
*/
public void setRemotePath(String remotePath) {
this.remotePath = remotePath;
}
}
}

@ -4,7 +4,9 @@ import java.io.File;
public class DfsSdk {
// 根据dfsType和bucketName获取DfsService实例
public static DfsService getDfsInstance(String dfsType, String bucketName) {
// 如果dfsType为FastDFS则获取FastDfsService实例
if ("FastDFS".equalsIgnoreCase(dfsType)) {
DfsService dfsService = FastDfsService.getInstance(bucketName);
return dfsService;
@ -12,6 +14,7 @@ public class DfsSdk {
return null;
}
// 默认获取FastDFS的DfsService实例
public static DfsService getDfsInstance() {
return getDfsInstance("FastDFS", "group1");
}

@ -4,73 +4,91 @@ import java.io.File;
import java.util.List;
import java.util.Map;
/**
* DfsService DFS
*
*/
public interface DfsService {
/**
* Upload file to file system.
*
*
* @param filePath local file path
* @param key Key
* @param metadata metadata for the file
* @return DfsPath object or null if fail
* @param filePath
* @param key
* @param metadata
* @return DFS DfsPath null
*/
public DfsPath putObject(String filePath, String key, Map<String, String> metadata);
/**
* Upload file to file system
* File
*
* @param file file
* @param key Key
* @param metadata metadata for the file
* @return DfsPath object or null if fail
* @param file
* @param key
* @param metadata
* @return DFS DfsPath null
*/
public DfsPath putObject(File file, String key, Map<String, String> metadata);
/**
* Upload file to file system
*
*
* @param bytes file
* @param key Key
* @param metadata metadata for the file
* @param extName ext name of file
* @return DfsPath object or null if fail
* @param bytes
* @param key
* @param metadata
* @param extName
* @return DFS DfsPath null
*/
public DfsPath putObject(byte[] bytes, String key, Map<String, String> metadata, String extName);
/**
* Get file from file system with remotePath
*
*
* @param remotePath remote file path on file system
* @param key Key
* @return DfsPath object or null if fail
* @param remotePath
* @param key
* @return DfsFile null
*/
public DfsFile getObject(String remotePath, String key);
/**
* Delete the file on file system
*
*
* @param remotePath remote file path on file system
* @param key Key
* @return true||false
* @param remotePath
* @param key
* @return true false
*/
public boolean deleteObject(String remotePath, String key);
/**
* Get the list of the file on file system
*
*
* @return List<DfsFile>
* @return DfsFile
*/
public List<DfsFile> listObjects();
/**
* Get the whole url
* HTTP 访
*
* @param remotePath
* @return whole url
* @param remotePath
* @return HTTP 访访
*/
public String getHttpPath(String remotePath);
/**
* DMS HTTP 访
* DMS
*
* @param dmsFilePath DMS
* @return HTTP 访
*/
public String getDmsHttpPath(String dmsFilePath);
/**
*
*
*
* @param type
* @return
*/
public String getDefaultPath(String type);
}
}

@ -19,58 +19,77 @@ import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
/**
* FastDfsService DfsService FastDFS
* FastDFS
*/
public class FastDfsService implements DfsService {
// 单例实例
private static FastDfsService instance = null;
// 基础 URL用于构建文件的完整 HTTP 访问路径
private String baseUrl = "";
// DMS 基础 URL用于构建 DMS 文件的完整 HTTP 访问路径
private String dmsBaseUrl = "";
// 默认图片 URL
private String defaultPicUrl = "";
//private static Logger logger = Logger.getLogger(FastDfsService.class.getName());
// 配置文件中基础 URL 的键名
private static String BASE_URL = "httpBaseUrl";
// 配置文件中 DMS 基础 URL 的键名
private static String DMS_BASE_URL = "dmsBaseUrl";
// 配置文件中默认图片 URL 的键名
private static String DEFAULT_PIC_URL = "defaultPicUrl";
// FastDFS 键名,用于元数据中存储文件的唯一标识
private static String FAST_DFS_KEY = "FastDfsKey";
/**
* bucket name
*
*/
private final String bucketName;
/**
* constructor with bucketName
* FastDfsService
* FastDFS
*
* @param bucketName bucket name
* @param bucketName
*/
private FastDfsService(String bucketName) {
this.bucketName = bucketName;
String configFilePath = null;
try {
configFilePath = FastDfsService.class.getResource("/").toURI().getPath() + "fdfs_client.conf";
} catch (URISyntaxException e1) {
Exception e = new Exception("Cann't found fdfs_client.conf file under " + FastDfsService.class.getResource("/"));
handleException(e);
}
try {
// 获取 FastDFS 配置文件的路径
configFilePath = FastDfsService.class.getResource("/").toURI().getPath() + "fdfs_client.conf";
} catch (URISyntaxException e1) {
// 若无法找到配置文件,抛出异常并处理
Exception e = new Exception("Cann't found fdfs_client.conf file under " + FastDfsService.class.getResource("/"));
handleException(e);
}
try {
// 初始化 FastDFS 客户端全局配置
ClientGlobal.init(configFilePath);
// 读取配置文件
IniFileReader reader = new IniFileReader(configFilePath);
// 设置基础 URL
setBaseUrl(reader.getStrValue(BASE_URL));
// 设置 DMS 基础 URL
setDmsBaseUrl(reader.getStrValue(DMS_BASE_URL));
// 设置默认图片 URL
setDefaultPicUrl(reader.getStrValue(DEFAULT_PIC_URL));
} catch (Exception e) {
// 处理初始化过程中出现的异常
handleException(e);
}
}
/**
* Get instance of FastDfsService, for Singleton
* @param bucketName bucket name
* @return instance of FastDfsService
* FastDfsService
* 线
*
* @param bucketName
* @return FastDfsService
*/
public static synchronized FastDfsService getInstance(String bucketName) {
if (null == instance) {
@ -80,11 +99,11 @@ public class FastDfsService implements DfsService {
}
/**
* Delete file on file system.
*
*
* @param remotePath remote file path
* @param key Key, not used in FastDFS
* @return true|false
* @param remotePath
* @param key FastDFS 使
* @return true false
*/
@Override
public boolean deleteObject(String remotePath, String key) {
@ -92,21 +111,28 @@ public class FastDfsService implements DfsService {
TrackerClient trackerClient = new TrackerClient();
TrackerServer trackerServer = null;
try {
// 获取 Tracker 服务器连接
trackerServer = trackerClient.getConnection();
// 创建存储客户端
StorageClient storageClient = new StorageClient(trackerServer, null);
// 调用 FastDFS API 删除文件
result = storageClient.delete_file(bucketName, remotePath);
} catch(Exception e) {
} catch (Exception e) {
// 处理删除过程中出现的异常
handleException(e);
} finally {
if (null != trackerServer) {
try {
// 关闭 Tracker 服务器连接
trackerServer.close();
} catch (Exception e) {
// 处理关闭连接时出现的异常
handleException(e);
}
}
}
if (0 != result) {
// 删除失败,记录日志并返回 false
//logger.info("delete faild, the faild code is: " + result);
return false;
}
@ -114,26 +140,33 @@ public class FastDfsService implements DfsService {
}
/**
* Find the whole url
* HTTP 访
*
* @param remotePath remote path
* @return the whole url
* @param remotePath
* @return HTTP 访
*/
@Override
public String getHttpPath(String remotePath) {
return baseUrl + "/" + bucketName + "/" + remotePath;
}
/**
* DMS HTTP 访
*
* @param dmsFilePath DMS
* @return DMS HTTP 访
*/
@Override
public String getDmsHttpPath(String dmsFilePath) {
return dmsBaseUrl + dmsFilePath;
return dmsBaseUrl + dmsFilePath;
}
/**
* Get the file, and return DfsFile object
*
*
* @param remotePath remote path
* @param key Key, not used in FastDFS, can be null
* @return DfsFile object or null if fail
* @param remotePath
* @param key FastDFS 使 null
* @return DfsFile null
*/
@Override
public DfsFile getObject(String remotePath, String key) {
@ -141,59 +174,75 @@ public class FastDfsService implements DfsService {
TrackerServer trackerServer = null;
StorageServer storageServer = null;
try {
// 获取 Tracker 服务器连接
trackerServer = trackerClient.getConnection();
// 获取存储服务器
storageServer = trackerClient.getFetchStorage(trackerServer, bucketName, remotePath);
// 创建存储客户端
StorageClient storageClient = new StorageClient(trackerServer, storageServer);
// 下载文件
byte[] bytes = storageClient.download_file(this.bucketName, remotePath);
if (null != bytes) {
// 获取文件的元数据
NameValuePair[] value_pairs = storageClient.get_metadata(bucketName, remotePath);
Map<String, String> metadata = new HashMap<String, String>();
for (int i = 0; i < value_pairs.length; i++) {
// 将元数据存储到 Map 中
metadata.put(value_pairs[i].getName(), value_pairs[i].getValue());
}
// 创建 DfsFile 对象
DfsFile dfsFile = new DfsFile(metadata.get(FAST_DFS_KEY), bytes, metadata);
return dfsFile;
}
} catch (Exception e){
} catch (Exception e) {
// 处理获取文件过程中出现的异常
handleException(e);
} finally {
if (null != storageServer) {
try {
// 关闭存储服务器连接
storageServer.close();
} catch (Exception e) {
// 处理关闭连接时出现的异常
handleException(e);
}
}
if (null != trackerServer) {
try {
// 关闭 Tracker 服务器连接
trackerServer.close();
} catch (Exception e) {
// 处理关闭连接时出现的异常
handleException(e);
}
}
}
// 获取文件失败,记录日志并返回 null
//logger.info("Get object failed, get null object");
return null;
}
/**
* Get the file list of file system.
* Not implement at the moment, because FastDFS API not support.
*
* FastDFS API
*
* @return null
*/
@Override
public List<DfsFile> listObjects() {
//to do
//Because fastDFS api do not support list object method.
// 待实现
// 因为 FastDFS API 不支持列出对象的方法
return null;
}
/**
* Upload the file to file system by file path
*
* File putObject(File file, String key, Map<String, String> metadata)
*
* @param filePath local file path.
* @param key Key, not used in FastDFS, can be null
* @param metadata metadata for file, can be null
* @return DfsFile object or null if fail
* @param filePath
* @param key FastDFS 使 null
* @param metadata null
* @return DfsPath null
*/
@Override
public DfsPath putObject(String filePath, String key, Map<String, String> metadata) {
@ -202,13 +251,13 @@ public class FastDfsService implements DfsService {
}
/**
* Upload the file to file system by bytes
*
*
* @param bytes bytes
* @param key Key, not used in FastDFS
* @param metadata metadata for file, can be null
* @param extName extName for file, can be null
* @return DfsPath object or null if fail
* @param bytes
* @param key FastDFS 使
* @param metadata null
* @param extName null
* @return DfsPath null
*/
@Override
public DfsPath putObject(byte[] bytes, String key, Map<String, String> metadata, String extName) {
@ -216,147 +265,215 @@ public class FastDfsService implements DfsService {
TrackerServer trackerServer = null;
StorageServer storageServer = null;
try {
// 获取 Tracker 服务器连接
trackerServer = trackerClient.getConnection();
// 获取存储服务器列表
StorageServer[] storageServers = trackerClient.getStoreStorages(trackerServer, bucketName);
if (null != storageServers) {
// 选择第一个存储服务器
storageServer = storageServers[0];
// 创建存储客户端
StorageClient storageClient = new StorageClient(trackerServer, storageServer);
NameValuePair[] meta_list;
int i = 0;
if (null == metadata) {
// 若元数据为空,创建一个包含一个元素的元数据数组
meta_list = new NameValuePair[1];
} else {
// 若元数据不为空,创建一个包含元数据和 FastDFS 键的数组
meta_list = new NameValuePair[metadata.size() + 1];
for (Map.Entry<String, String> entry : metadata.entrySet()) {
meta_list[i++] = new NameValuePair(entry.getKey(), entry.getValue());
}
}
// 添加 FastDFS 键到元数据数组
meta_list[i] = new NameValuePair(FAST_DFS_KEY, key);
// 调用 FastDFS API 上传文件
String[] results = storageClient.upload_file(bytes, extName, meta_list);
if (null == results) {
// 上传失败,记录日志并返回 null
//logger.info("upload file fail, error codes: " + storageClient.getErrorCode());
return null;
} else {
// 获取远程文件名
String remote_fileName = results[1];
// 构建文件的完整 HTTP 访问路径
String httpPath = this.getHttpPath(remote_fileName);
// 创建 DfsPath 对象
DfsPath dfsPath = new DfsPath(httpPath, remote_fileName);
return dfsPath;
}
}
} catch (Exception e) {
// 处理上传过程中出现的异常
handleException(e);
} finally {
if (null != storageServer) {
try {
// 关闭存储服务器连接
storageServer.close();
} catch (Exception e) {
// 处理关闭连接时出现的异常
handleException(e);
}
}
if (null != trackerServer) {
try {
// 关闭 Tracker 服务器连接
trackerServer.close();
} catch (Exception e) {
// 处理关闭连接时出现的异常
handleException(e);
}
}
}
// 上传失败,记录日志并返回 null
//logger.info("Upload file faild, because can not get storage servers!");
return null;
}
/**
* Upload the file to file system
*
* putObject(byte[] bytes, String key, Map<String, String> metadata, String extName)
*
* @param file file
* @param key Key, not used in FastDFS, can be null
* @param metadata metadata for file , can be null
* @return DfsPath object or null if fail
* @param file
* @param key FastDFS 使 null
* @param metadata null
* @return DfsPath null
*/
@Override
public DfsPath putObject(File file, String key, Map<String, String> metadata) {
FileInputStream in = null;
byte[] file_buff = null;
try {
// 打开文件输入流
in = new FileInputStream(file);
if (null != in) {
// 获取文件长度
int len = in.available();
// 创建字节数组
file_buff = new byte[len];
// 读取文件内容到字节数组
in.read(file_buff);
}
} catch (Exception e) {
// 处理读取文件过程中出现的异常
handleException(e);
} finally {
if (null != in) {
try {
// 关闭文件输入流
in.close();
} catch (Exception e) {
// 处理关闭流时出现的异常
handleException(e);
}
}
}
String file_ext_name = "";
if (file.getName().lastIndexOf(".") > 0) {
// 获取文件扩展名
file_ext_name = file.getName().substring(file.getName().lastIndexOf(".") + 1);
}
// 调用 putObject(byte[] bytes, String key, Map<String, String> metadata, String extName) 方法上传文件
return putObject(file_buff, key, metadata, file_ext_name);
}
/**
* URL
*
* @return URL
*/
public String getBaseUrl() {
return baseUrl;
}
/**
* URL
*
* @param baseUrl URL
*/
private void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
/**
* DMS URL
*
* @return DMS URL
*/
public String getDmsBaseUrl() {
return dmsBaseUrl;
return dmsBaseUrl;
}
/**
* DMS URL
*
* @param dmsBaseUrl DMS URL
*/
public void setDmsBaseUrl(String dmsBaseUrl) {
this.dmsBaseUrl = dmsBaseUrl;
this.dmsBaseUrl = dmsBaseUrl;
}
/**
* URL
*
* @return URL
*/
public String getDefaultPicUrl() {
return defaultPicUrl;
return defaultPicUrl;
}
/**
* URL
*
* @param defaultPicUrl URL
*/
public void setDefaultPicUrl(String defaultPicUrl) {
this.defaultPicUrl = defaultPicUrl;
this.defaultPicUrl = defaultPicUrl;
}
/**
* Handle Exception
* @param e exception
*
* DfsException
*
* @param e
*/
private void handleException(Exception e) {
if (e instanceof IOException) {
// 处理 IOException抛出 DfsException错误码为 100
//logger.error("Exception occured : DFSException code: 100," + " exception message :" + e.getMessage());
throw new DfsException("100", e.getMessage());
} else if (e instanceof FileNotFoundException) {
// 处理 FileNotFoundException抛出 DfsException错误码为 200
//logger.error("Exception occured : DFSException code: 200," + " exception message : file not found." + e.getMessage());
throw new DfsException("200", e.getMessage());
} else if (e instanceof MyException) {
// 处理 MyException抛出 DfsException错误码为 300
//logger.error("Exception occured : DFSException code: 300," + " exception message :" + e.getMessage());
throw new DfsException("300", e.getMessage());
} else if (e instanceof Exception) {
// 处理其他异常,抛出 DfsException错误码为 400
//logger.error("Exception occured : DFSException code: 400," + " exception message :" + e.getMessage());
throw new DfsException("400", e.getMessage());
}
}
@Override
public String getDefaultPath(String type) {
if("PICTURE".equalsIgnoreCase(type)) {
return defaultPicUrl;
}
return defaultPicUrl;
}
}
/**
*
* "PICTURE" URL URL
*
* @param type
* @return
*/
@Override
public String getDefaultPath(String type) {
if ("PICTURE".equalsIgnoreCase(type)) {
return defaultPicUrl;
}
return defaultPicUrl;
}
}

@ -1,130 +1,203 @@
// 声明该类所在的包,此包为资源控制器相关的包
package com.xmomen.module.resource.controller;
// 导入自定义框架中的业务异常类,用于处理业务逻辑中出现的异常
import com.xmomen.framework.exception.BusinessException;
// 导入自定义框架中 MyBatis 分页相关的 Page 类,用于处理分页查询结果
import com.xmomen.framework.mybatis.page.Page;
// 导入自定义模块中的日志注解,用于记录操作日志
import com.xmomen.module.logger.Log;
// 导入资源查询模型类,用于封装资源查询的条件
import com.xmomen.module.resource.model.ResourceQuery;
// 导入资源数据模型类,用于封装资源的相关数据
import com.xmomen.module.resource.model.ResourceModel;
// 导入资源服务类,该类包含资源相关的业务逻辑
import com.xmomen.module.resource.service.ResourceService;
// 导入 Apache Commons IO 工具类,用于处理输入输出流
import org.apache.commons.io.IOUtils;
// 导入 Jeecg 框架中 Excel 导入工具类,用于从 Excel 文件中导入数据
import org.jeecgframework.poi.excel.ExcelImportUtil;
// 导入 Jeecg 框架中 Excel 导出参数类,用于配置 Excel 导出的参数
import org.jeecgframework.poi.excel.entity.ExportParams;
// 导入 Jeecg 框架中 Excel 导入参数类,用于配置 Excel 导入的参数
import org.jeecgframework.poi.excel.entity.ImportParams;
// 导入 Jeecg 框架中 Excel 导入结果类,用于封装 Excel 导入的结果
import org.jeecgframework.poi.excel.entity.result.ExcelImportResult;
// 导入 Jeecg 框架中普通 Excel 常量类,包含一些 Excel 操作的常量
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
// 导入 Jeecg 框架中 Excel 导入异常类,用于处理 Excel 导入过程中出现的异常
import org.jeecgframework.poi.exception.excel.ExcelImportException;
// 导入 Spring 框架中的自动装配注解,用于自动注入依赖的 Bean
import org.springframework.beans.factory.annotation.Autowired;
// 导入 Spring 框架中的模型映射类,用于在控制器和视图之间传递数据
import org.springframework.ui.ModelMap;
// 导入 Spring 框架中的数据绑定结果类,用于处理数据绑定过程中的错误信息
import org.springframework.validation.BindingResult;
// 导入 Spring 框架中的请求映射相关注解,用于处理 HTTP 请求
import org.springframework.web.bind.annotation.*;
// 导入 Spring 框架中用于处理多部分文件上传的类
import org.springframework.web.multipart.MultipartFile;
// 导入 Spring 框架中的模型和视图类,用于返回包含模型数据和视图名称的对象
import org.springframework.web.servlet.ModelAndView;
// 导入 JSR-303 验证框架中的有效注解,用于对请求参数进行验证
import javax.validation.Valid;
// 导入 Java 序列化接口,用于支持对象的序列化和反序列化
import java.io.Serializable;
// 导入 Java 输入输出异常类,用于处理输入输出操作中出现的异常
import java.io.IOException;
// 导入 Java 输入流类,用于读取数据
import java.io.InputStream;
// 导入 Java 列表接口,用于存储多个元素
import java.util.List;
/**
* HTTP
*
* @author tanxinzheng
* @version 1.0.0
* @date 2017-4-10 23:26:20
*/
// 标记该类为 RESTful 风格的控制器,会自动将方法返回值转换为 JSON 格式
@RestController
// 定义该控制器处理的请求路径前缀为 /resource
@RequestMapping(value = "/resource")
public class ResourceController {
// 使用自动装配注解将 ResourceService 注入到当前类中,用于调用资源相关的业务逻辑
@Autowired
ResourceService resourceService;
/**
*
*
*
* @param limit
* @param offset
* @param id
* @param ids
* @param excludeIds
* @return Page<ResourceModel>
* @param limit
* @param offset
* @param id
* @param entityType
* @param entityId ID
* @param ids
* @param excludeIds
* @return
*/
// 映射 HTTP GET 请求到该方法
@RequestMapping(method = RequestMethod.GET)
// 使用日志注解记录该操作的名称为查询资源目录列表
@Log(actionName = "查询资源目录列表")
public Page<ResourceModel> getResourceList(@RequestParam(value = "limit") Integer limit,
@RequestParam(value = "offset") Integer offset,
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "entityType", required = false) String entityType,
@RequestParam(value = "entityId", required = false) String entityId,
@RequestParam(value = "ids", required = false) String[] ids,
@RequestParam(value = "excludeIds", required = false) String[] excludeIds) {
public Page<ResourceModel> getResourceList(
// 从请求参数中获取每页结果数
@RequestParam(value = "limit") Integer limit,
// 从请求参数中获取页码
@RequestParam(value = "offset") Integer offset,
// 从请求参数中获取资源主键,该参数可选
@RequestParam(value = "id", required = false) String id,
// 从请求参数中获取资源所属的实体类型,该参数可选
@RequestParam(value = "entityType", required = false) String entityType,
// 从请求参数中获取资源所属的实体 ID该参数可选
@RequestParam(value = "entityId", required = false) String entityId,
// 从请求参数中获取资源主键数组,该参数可选
@RequestParam(value = "ids", required = false) String[] ids,
// 从请求参数中获取不包含的资源主键数组,该参数可选
@RequestParam(value = "excludeIds", required = false) String[] excludeIds) {
// 创建资源查询对象
ResourceQuery resourceQuery = new ResourceQuery();
// 设置查询条件:资源主键
resourceQuery.setId(id);
// 设置查询条件:不包含的资源主键数组
resourceQuery.setExcludeIds(excludeIds);
// 设置查询条件:资源主键数组
resourceQuery.setIds(ids);
// 设置查询条件:资源所属的实体类型
resourceQuery.setEntityType(entityType);
// 设置查询条件:资源所属的实体 ID
resourceQuery.setEntityId(entityId);
// 调用资源服务的方法,根据分页信息和查询条件获取资源目录分页数据
return resourceService.getResourceModelPage(limit, offset, resourceQuery);
}
/**
*
*
*
* @param id
* @return ResourceModel
* @param id
* @return
*/
// 映射形如 /resource/{id} 的 HTTP GET 请求到该方法
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
// 使用日志注解记录该操作的名称为查询资源目录
@Log(actionName = "查询资源目录")
public ResourceModel getResourceById(@PathVariable(value = "id") String id) {
public ResourceModel getResourceById(
// 从路径中获取资源主键
@PathVariable(value = "id") String id) {
// 调用资源服务的方法,根据主键获取单个资源目录的数据
return resourceService.getOneResourceModel(id);
}
/**
*
*
*
* @param resourceModel
* @return ResourceModel
* @param resourceModel
* @return
*/
// 映射 HTTP POST 请求到该方法
@RequestMapping(method = RequestMethod.POST)
// 使用日志注解记录该操作的名称为新增资源目录
@Log(actionName = "新增资源目录")
public ResourceModel createResource(@RequestBody @Valid ResourceModel resourceModel) {
public ResourceModel createResource(
// 从请求体中获取新增资源目录的数据,并进行数据验证
@RequestBody @Valid ResourceModel resourceModel) {
// 调用资源服务的方法,创建新的资源目录
return resourceService.createResource(resourceModel);
}
/**
*
*
*
* @param id
* @param resourceModel
* @param id
* @param resourceModel
*/
// 映射形如 /resource/{id} 的 HTTP PUT 请求到该方法
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
// 使用日志注解记录该操作的名称为更新资源目录
@Log(actionName = "更新资源目录")
public void updateResource(@PathVariable(value = "id") String id,
@RequestBody @Valid ResourceModel resourceModel) {
public void updateResource(
// 从路径中获取要更新的资源主键
@PathVariable(value = "id") String id,
// 从请求体中获取更新后的资源目录数据,并进行数据验证
@RequestBody @Valid ResourceModel resourceModel) {
// 调用资源服务的方法,更新资源目录信息
resourceService.updateResource(resourceModel);
}
/**
*
*
*
* @param id
* @param id
*/
// 映射形如 /resource/{id} 的 HTTP DELETE 请求到该方法
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
// 使用日志注解记录该操作的名称为删除单个资源目录
@Log(actionName = "删除单个资源目录")
public void deleteResource(@PathVariable(value = "id") String id) {
public void deleteResource(
// 从路径中获取要删除的资源主键
@PathVariable(value = "id") String id) {
// 调用资源服务的方法,删除指定主键的资源目录
resourceService.deleteResource(id);
}
/**
*
*
*
* @param ids
* @param ids
*/
// 映射 HTTP DELETE 请求到该方法
@RequestMapping(method = RequestMethod.DELETE)
// 使用日志注解记录该操作的名称为批量删除资源目录
@Log(actionName = "批量删除资源目录")
public void deleteResources(@RequestParam(value = "ids") String[] ids) {
public void deleteResources(
// 从请求参数中获取要删除的资源主键数组
@RequestParam(value = "ids") String[] ids) {
// 调用资源服务的方法,批量删除指定主键的资源目录
resourceService.deleteResource(ids);
}
}
}

@ -1,4 +1,4 @@
package com.xmomen.module.resource.entity;
Xpackage com.xmomen.module.resource.entity;
import com.xmomen.framework.mybatis.model.BaseMybatisModel;
import javax.persistence.Column;

@ -1,7 +1,15 @@
<?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.xmomen.module.resource.entity.mapper.ResourceMapper" >
<resultMap id="BaseResultMap" type="com.xmomen.module.resource.entity.Resource" >
<?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.xmomen.module.resource.entity.mapper.ResourceMapper">
<!--
定义结果映射,将数据库查询结果映射到 Java 对象。
id: 结果映射的唯一标识。
type: 要映射的 Java 实体类的全限定名。
-->
<resultMap id="BaseResultMap" type="com.xmomen.module.resource.entity.Resource">
<!-- 映射数据库表中的主键列到实体类的属性 -->
<id column="ID" property="id" jdbcType="VARCHAR" />
<result column="ENTITY_TYPE" property="entityType" jdbcType="VARCHAR" />
<result column="ENTITY_ID" property="entityId" jdbcType="VARCHAR" />
@ -9,25 +17,37 @@
<result column="RESOURCE_TYPE" property="resourceType" jdbcType="VARCHAR" />
<result column="IS_DEFAULT" property="isDefault" jdbcType="INTEGER" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
<!--
定义 SQL 片段,用于生成 WHERE 子句。
此片段根据传入的查询条件动态生成 WHERE 子句,支持多种条件类型(无值、单值、范围值、列表值)。
-->
<sql id="Example_Where_Clause">
<where>
<!-- 遍历所有的查询条件组 -->
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<!-- 去除开头多余的 "and" -->
<trim prefix="(" suffix=")" prefixOverrides="and">
<!-- 遍历每个查询条件组中的具体条件 -->
<foreach collection="criteria.criteria" item="criterion">
<choose>
<!-- 处理无值条件 -->
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
<!-- 处理单值条件 -->
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
<!-- 处理范围值条件 -->
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
<!-- 处理列表值条件 -->
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator=",">
#{listItem}
</foreach>
</when>
@ -38,25 +58,30 @@
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
<!--
定义 SQL 片段,用于生成 UPDATE 语句的 WHERE 子句。
逻辑与 Example_Where_Clause 类似,用于根据条件更新数据。
-->
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator=",">
#{listItem}
</foreach>
</when>
@ -67,100 +92,148 @@
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
<!-- 定义 SQL 片段,列出表中的基本列名 -->
<sql id="Base_Column_List">
ID, ENTITY_TYPE, ENTITY_ID, PATH, RESOURCE_TYPE, IS_DEFAULT
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.resource.entity.ResourceExample" >
<!--
定义查询语句,根据条件查询资源数据。
id: 语句的唯一标识。
resultMap: 引用前面定义的结果映射,用于将查询结果映射到实体类。
parameterType: 传入的参数类型,这里是查询条件对象。
-->
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.resource.entity.ResourceExample">
select
<if test="distinct" >
<!-- 如果需要去重,添加 distinct 关键字 -->
<if test="distinct">
distinct
</if>
<!-- 引入基本列名片段 -->
<include refid="Base_Column_List" />
from cd_resource
<if test="_parameter != null" >
<!-- 如果传入了查询参数,引入 WHERE 子句片段 -->
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
<!-- 如果有排序条件,添加排序子句 -->
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="com.xmomen.module.resource.entity.ResourceExample" >
<!--
定义删除语句,根据条件删除资源数据。
id: 语句的唯一标识。
parameterType: 传入的参数类型,这里是查询条件对象。
-->
<delete id="deleteByExample" parameterType="com.xmomen.module.resource.entity.ResourceExample">
delete from cd_resource
<if test="_parameter != null" >
<!-- 如果传入了查询参数,引入 WHERE 子句片段 -->
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insertSelective" parameterType="com.xmomen.module.resource.entity.Resource" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
<selectKey resultType="java.lang.String" keyProperty="id" order="BEFORE" >
<!--
定义插入语句,选择性插入资源数据(只插入非空字段)。
id: 语句的唯一标识。
parameterType: 传入的参数类型,这里是要插入的实体类对象。
useGeneratedKeys: 是否使用数据库生成的主键。
keyProperty: 实体类中表示主键的属性名。
keyColumn: 数据库表中主键列的名称。
-->
<insert id="insertSelective" parameterType="com.xmomen.module.resource.entity.Resource" useGeneratedKeys="true" keyProperty="id" keyColumn="ID">
<!-- 在插入前生成主键值,这里使用 UUID 并去除连字符 -->
<selectKey resultType="java.lang.String" keyProperty="id" order="BEFORE">
SELECT replace(UUID(),'-','')
</selectKey>
insert into cd_resource
<trim prefix="(" suffix=")" suffixOverrides="," >
<!-- 动态生成插入的列名,只包含非空字段 -->
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="entityType != null" >
<if test="entityType != null">
ENTITY_TYPE,
</if>
<if test="entityId != null" >
<if test="entityId != null">
ENTITY_ID,
</if>
<if test="path != null" >
<if test="path != null">
PATH,
</if>
<if test="resourceType != null" >
<if test="resourceType != null">
RESOURCE_TYPE,
</if>
<if test="isDefault != null" >
<if test="isDefault != null">
IS_DEFAULT,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<!-- 动态生成插入的值,只包含非空字段 -->
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=VARCHAR},
<if test="entityType != null" >
<if test="entityType != null">
#{entityType,jdbcType=VARCHAR},
</if>
<if test="entityId != null" >
<if test="entityId != null">
#{entityId,jdbcType=VARCHAR},
</if>
<if test="path != null" >
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="resourceType != null" >
<if test="resourceType != null">
#{resourceType,jdbcType=VARCHAR},
</if>
<if test="isDefault != null" >
<if test="isDefault != null">
#{isDefault,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.xmomen.module.resource.entity.ResourceExample" resultType="java.lang.Integer" >
<!--
定义统计语句,根据条件统计资源数据的数量。
id: 语句的唯一标识。
parameterType: 传入的参数类型,这里是查询条件对象。
resultType: 返回的结果类型,这里是整数类型。
-->
<select id="countByExample" parameterType="com.xmomen.module.resource.entity.ResourceExample" resultType="java.lang.Integer">
select count(*) from cd_resource
<if test="_parameter != null" >
<!-- 如果传入了查询参数,引入 WHERE 子句片段 -->
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
<!--
定义更新语句,根据条件选择性更新资源数据(只更新非空字段)。
id: 语句的唯一标识。
parameterType: 传入的参数类型,这里是一个包含实体类对象和查询条件的 Map。
-->
<update id="updateByExampleSelective" parameterType="map">
update cd_resource
<set >
<if test="record.id != null" >
<!-- 动态生成 SET 子句,只包含非空字段 -->
<set>
<if test="record.id != null">
ID = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.entityType != null" >
<if test="record.entityType != null">
ENTITY_TYPE = #{record.entityType,jdbcType=VARCHAR},
</if>
<if test="record.entityId != null" >
<if test="record.entityId != null">
ENTITY_ID = #{record.entityId,jdbcType=VARCHAR},
</if>
<if test="record.path != null" >
<if test="record.path != null">
PATH = #{record.path,jdbcType=VARCHAR},
</if>
<if test="record.resourceType != null" >
<if test="record.resourceType != null">
RESOURCE_TYPE = #{record.resourceType,jdbcType=VARCHAR},
</if>
<if test="record.isDefault != null" >
<if test="record.isDefault != null">
IS_DEFAULT = #{record.isDefault,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null" >
<!-- 如果传入了查询参数,引入 UPDATE 的 WHERE 子句片段 -->
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>

Loading…
Cancel
Save