|
|
@@ -1,5 +1,6 @@
|
|
|
package restcontroller.webmanage.saletool.sharematerial;
|
|
|
|
|
|
+import beans.attachment.Attachment;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import common.Controller;
|
|
|
@@ -76,9 +77,12 @@ public class Renderings extends Controller {
|
|
|
@API(title = "效果图详情", apiversion = R.ID20240415164302.v1.class)
|
|
|
public String detail() throws YosException {
|
|
|
Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
+ String ownertable = "sat_sharematerial";
|
|
|
|
|
|
QuerySQL querySQ = SQLFactory.createQuerySQL(this, "sat_sharematerial")
|
|
|
.setTableAlias("t1");
|
|
|
+ querySQ.addJoinTable(JOINTYPE.left, "sys_datacollect", "t2", "t2.siteid=t1.siteid and t2.ownertable='sat_sharematerial' and t2.ownerid=t1.sat_sharematerialid and t2.userid='" + userid + "'");
|
|
|
+ querySQ.addQueryFields("iscollect", "CASE WHEN t2.sys_datacollectid>0 THEN 1 ELSE 0 END");
|
|
|
querySQ.setSiteid(siteid);
|
|
|
querySQ.setWhere("sat_sharematerialid", sat_sharematerialid);
|
|
|
|
|
|
@@ -96,6 +100,32 @@ public class Renderings extends Controller {
|
|
|
detailRow.put("ispanorama", 1);
|
|
|
}
|
|
|
|
|
|
+ QuerySQL attachmentQuery = SQLFactory.createQuerySQL(this, "sys_attachment_links").setTableAlias("t1");
|
|
|
+ attachmentQuery.setSiteid(detailRow.getString("siteid"));
|
|
|
+ attachmentQuery.setWhere("ownertable", ownertable);
|
|
|
+ attachmentQuery.setWhere("ownerid", sat_sharematerialid);
|
|
|
+ attachmentQuery.setWhere("usetype", ownertable);
|
|
|
+ attachmentQuery.setOrderBy("t1.sequence");
|
|
|
+ Rows attachmentRows = attachmentQuery.query();
|
|
|
+
|
|
|
+
|
|
|
+ ArrayList<Long> ids = attachmentRows.toArrayList("attachmentid", new ArrayList<>());
|
|
|
+
|
|
|
+ RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
|
|
|
+
|
|
|
+ for (Row row : attachmentRows) {
|
|
|
+ Rows attPicRows = new Rows();
|
|
|
+ Rows tempAttRows = attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows());
|
|
|
+ for (Row tempAttRow : tempAttRows) {
|
|
|
+ if (tempAttRow.getString("usetype").equals(ownertable)) {
|
|
|
+ attPicRows.add(tempAttRow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.put("attinfos", attPicRows);
|
|
|
+ }
|
|
|
+
|
|
|
+ detailRow.put("attinfos_pic", attachmentRows);
|
|
|
+
|
|
|
|
|
|
return getSucReturnObject().setData(detailRow).toString();
|
|
|
}
|
|
|
@@ -142,15 +172,15 @@ public class Renderings extends Controller {
|
|
|
where.append(")");
|
|
|
}
|
|
|
if (whereObject.containsKey("ispanorama") && !"".equals(whereObject.getString("ispanorama"))) {
|
|
|
- if(whereObject.getString("ispanorama").equals("1")){
|
|
|
- where.append(" and (");
|
|
|
- where.append("LENGTH(t1.panoramaurl)>0 ");
|
|
|
- where.append(")");
|
|
|
- }else{
|
|
|
- where.append(" and (");
|
|
|
- where.append("LENGTH(t1.panoramaurl)=0 or t1.panoramaurl is null ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
+ if (whereObject.getString("ispanorama").equals("1")) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("LENGTH(t1.panoramaurl)>0 ");
|
|
|
+ where.append(")");
|
|
|
+ } else {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("LENGTH(t1.panoramaurl)=0 or t1.panoramaurl is null ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
}
|
|
|
if (whereObject.containsKey("renderingstype") && !"".equals(whereObject.getString("renderingstype"))) {
|
|
|
where.append(" and (");
|
|
|
@@ -160,19 +190,19 @@ public class Renderings extends Controller {
|
|
|
|
|
|
if (whereObject.containsKey("style") && !"".equals(whereObject.getString("style"))) {
|
|
|
where.append(" and (");
|
|
|
- where.append("JSON_CONTAINS(t1.renderingsclass->'$.style', '\""+whereObject.getString("style")+"\"')");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.style', '\"" + whereObject.getString("style") + "\"')");
|
|
|
where.append(")");
|
|
|
|
|
|
}
|
|
|
if (whereObject.containsKey("space") && !"".equals(whereObject.getString("space"))) {
|
|
|
where.append(" and (");
|
|
|
- where.append("JSON_CONTAINS(t1.renderingsclass->'$.space', '\""+whereObject.getString("space")+"\"')");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.space', '\"" + whereObject.getString("space") + "\"')");
|
|
|
where.append(")");
|
|
|
|
|
|
}
|
|
|
if (whereObject.containsKey("spec") && !"".equals(whereObject.getString("spec"))) {
|
|
|
where.append(" and (");
|
|
|
- where.append("JSON_CONTAINS(t1.renderingsclass->'$.spec', '\""+whereObject.getString("spec")+"\"')");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.spec', '\"" + whereObject.getString("spec") + "\"')");
|
|
|
where.append(")");
|
|
|
|
|
|
}
|
|
|
@@ -180,18 +210,14 @@ public class Renderings extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
- boolean isDataAuth = content.getBooleanValue("isDataAuth");
|
|
|
|
|
|
QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, sat_sharematerial,
|
|
|
- "sat_sharematerialid", "title", "status", "renderingstype", "readcount", "sequence", "createdate", "checkdate","renderingsclass")
|
|
|
+ "sat_sharematerialid", "title", "status", "renderingstype", "readcount", "readcount_start", "sequence", "createdate", "checkdate", "renderingsclass")
|
|
|
.setTableAlias("t1");
|
|
|
sqlFactory.setSiteid(siteid);
|
|
|
sqlFactory.setWhere("classid", 4);
|
|
|
sqlFactory.setWhere(where.toString());
|
|
|
sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
- if (isDataAuth) {
|
|
|
- sqlFactory.setDataAuth(true);
|
|
|
- }
|
|
|
Rows rows = sqlFactory.query();
|
|
|
|
|
|
ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
|