|
|
@@ -219,44 +219,48 @@ public class EquipmentResourceLibrary extends Controller {
|
|
|
@API(title = "图片新增或编辑", apiversion = R.ID20240407135802.v1.class)
|
|
|
public String attachmentInsertOrUpdate() throws YosException {
|
|
|
|
|
|
- Long sys_attachment_linksid = content.getLongValue("sys_attachment_linksid");
|
|
|
+ Long linksid = content.getLongValue("linksid");
|
|
|
|
|
|
- if (sys_attachment_linksid <= 0) {
|
|
|
- sys_attachment_linksid = createTableID("sys_attachment_links");
|
|
|
+ if (linksid <= 0) {
|
|
|
+ linksid = createTableID("sys_attachment_links");
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_attachment_links");
|
|
|
insertSQL.setSiteid(siteid);
|
|
|
- insertSQL.setUniqueid(sys_attachment_linksid);
|
|
|
+ insertSQL.setUniqueid(linksid);
|
|
|
insertSQL.setValue("usetype", "sat_sharematerial");
|
|
|
- insertSQL.setValue("linksid", 0);
|
|
|
insertSQL.setValue("attachmentid", content.getLongValue("attachmentid"));
|
|
|
insertSQL.setValue("jumpurl", content.getStringValue("jumpurl", true));
|
|
|
- insertSQL.setValue("sequence", content.getLongValue("attachmentid"));
|
|
|
+ insertSQL.setValue("sequence", content.getLongValue("sequence"));
|
|
|
insertSQL.setValue("ownertable", content.getStringValue("ownertable"));
|
|
|
insertSQL.setValue("ownerid", content.getLongValue("ownerid"));
|
|
|
insertSQL.insert();
|
|
|
}
|
|
|
- if (sys_attachment_linksid > 0) {
|
|
|
+ if (linksid > 0) {
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_attachment_links");
|
|
|
updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setUniqueid(sys_attachment_linksid);
|
|
|
+ updateSQL.setUniqueid(linksid);
|
|
|
updateSQL.setValue("jumpurl", content.getStringValue("jumpurl", true));
|
|
|
- updateSQL.setValue("sequence", content.getLongValue("attachmentid"));
|
|
|
+ updateSQL.setValue("sequence", content.getLongValue("sequence"));
|
|
|
updateSQL.update();
|
|
|
}
|
|
|
|
|
|
- String sql ="SELECT * from sys_attachment_links WHERE sys_attachment_linksid=" + sys_attachment_linksid + " and siteid='" + siteid + "'";
|
|
|
+ String sql = "SELECT * from sys_attachment_links WHERE linksid=" + linksid + " and siteid='" + siteid + "'";
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
|
|
|
|
|
|
- return getSucReturnObject().setData(rows.get(0)).toString();
|
|
|
+ return getSucReturnObject().setData(rows.isNotEmpty() ? rows.get(0) : new Row()).toString();
|
|
|
}
|
|
|
|
|
|
@API(title = "图片删除", apiversion = R.ID20240407135902.v1.class)
|
|
|
- public String attachmentDelete() {
|
|
|
+ public String attachmentDelete() throws YosException {
|
|
|
|
|
|
+ JSONArray linksids = content.getJSONArray("linksids");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sys_attachment_links");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("linksid", linksids);
|
|
|
+ deleteSQL.delete();
|
|
|
|
|
|
- return getSucReturnObject().setData("").toString();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
@API(title = "图片列表", apiversion = R.ID20240407140002.v1.class)
|