【Java菜鸟笔记】
想要的效果
SELECT
jst_record_file_id,
jst_interface_file_id,
jst_record_id,
jst_record_person_id,
app_code,
file_content,
file_name,
ref_type,
file_no,
file_name_code,
file_type,
ori_file_name,
remark,
url,
create_id,
create_time,
update_id,
update_time
FROM
jst_enterprise_record_file
WHERE
jst_record_id = 'WX_WXHWYSSBQD'
AND ( file_name_code = 'WX_WXHWYSSBQD' OR file_name_code = 'WX_WXSBQD'
错误代码
List<String> wxhwyssbqd = jstEnterpriseRecordFileExtDao.selectList(Wrappers.<JstEnterpriseRecordFile>lambdaQuery()
.eq(JstEnterpriseRecordFile::getJstRecordId, jstRecordId)
.eq(JstEnterpriseRecordFile::getFileNameCode, "WX_WXHWYSSBQD")
.or()
.eq(JstEnterpriseRecordFile::getFileNameCode, "WX_WXSBQD"))
.stream()
.map(JstEnterpriseRecordFile::getUrl)
.collect(Collectors.toList());
控制台打印的sql日志(错误)
==> Preparing: SELECT jst_record_file_id,jst_interface_file_id,jst_record_id,jst_record_person_id,app_code,file_content,file_name,ref_type,file_no,file_name_code,file_type,ori_file_name,remark,url,create_id,create_time,update_id,update_time FROM jst_enterprise_record_file WHERE jst_record_id = ? AND file_name_code = ? OR file_name_code = ?
==> Parameters: 85C823FB0BE94F6983138DC57DB1705F(String), WX_WXHWYSSBQD(String), WX_WXSBQD(String)
<== Columns: jst_record_file_id, jst_interface_file_id, jst_record_id, jst_record_person_id, app_code, file_content, file_name, ref_type, file_no, file_name_code, file_type, ori_file_name, remark, url, create_id, create_time, update_id, update_time
<== Row: 5B184B5F1EEF467B9ED6A25CE3A1277D, 251175, 70D62AB468CA4D69BC564F4212A34E83, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险品车间.jpg, null, http://gdsz.qxjgxt.com/ftp//1612346783229.jpg, null, 2021-02-03 04:06:23, null, null
<== Row: A0C40C01DDEB4BCDB2FAF14C9500B429, 259332, 85C823FB0BE94F6983138DC57DB1705F, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险货物车辆维修设备清单.jpg, null, http://gdsz.qxjgxt.com/ftp//1612336559538.jpg, null, 2021-02-03 01:16:00, null, null
<== Row: AF9B7019B6CD402699A6B420578FEA64, 259332, 85C823FB0BE94F6983138DC57DB1705F, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险货物车辆维修设备清单.jpg, null, http://gdsz.qxjgxt.com/ftp//1612336559570.jpg, null, 2021-02-03 01:16:00, null, null
<== Row: F590FCE632B147049BBCE1A3F1A933A2, 251175, 70D62AB468CA4D69BC564F4212A34E83, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险品车间.jpg, null, http://gdsz.qxjgxt.com/ftp//1612346782989.jpg, null, 2021-02-03 04:06:23, null, null
<== Total: 4
正确代码
List<String> wxhwyssbqd = jstEnterpriseRecordFileExtDao.selectList(Wrappers.<JstEnterpriseRecordFile>lambdaQuery()
.eq(JstEnterpriseRecordFile::getJstRecordId, jstRecordId)
.and(item->item.eq(JstEnterpriseRecordFile::getFileNameCode, "WX_WXHWYSSBQD")
.or()
.eq(JstEnterpriseRecordFile::getFileNameCode, "WX_WXSBQD"))
)
.stream()
.map(JstEnterpriseRecordFile::getUrl)
.collect(Collectors.toList());
控制台打印的sql日志(正确)
==> Preparing: SELECT jst_record_file_id,jst_interface_file_id,jst_record_id,jst_record_person_id,app_code,file_content,file_name,ref_type,file_no,file_name_code,file_type,ori_file_name,remark,url,create_id,create_time,update_id,update_time FROM jst_enterprise_record_file WHERE jst_record_id = ? AND ( file_name_code = ? OR file_name_code = ? )
==> Parameters: 85C823FB0BE94F6983138DC57DB1705F(String), WX_WXHWYSSBQD(String), WX_WXSBQD(String)
<== Columns: jst_record_file_id, jst_interface_file_id, jst_record_id, jst_record_person_id, app_code, file_content, file_name, ref_type, file_no, file_name_code, file_type, ori_file_name, remark, url, create_id, create_time, update_id, update_time
<== Row: A0C40C01DDEB4BCDB2FAF14C9500B429, 259332, 85C823FB0BE94F6983138DC57DB1705F, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险货物车辆维修设备清单.jpg, null, http://gdsz.qxjgxt.com/ftp//1612336559538.jpg, null, 2021-02-03 01:16:00, null, null
<== Row: AF9B7019B6CD402699A6B420578FEA64, 259332, 85C823FB0BE94F6983138DC57DB1705F, null, null, <<BLOB>>, 危险货物车辆维修设备清单, APPLY_BASE_INFO, null, WX_WXSBQD, WX_WXSBQD, 危险货物车辆维修设备清单.jpg, null, http://gdsz.qxjgxt.com/ftp//1612336559570.jpg, null, 2021-02-03 01:16:00, null, null
<== Total: 2