|
@@ -0,0 +1,84 @@
|
|
|
|
|
+package com.cnd3b.restcontroller.enterprise.system;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.cnd3b.common.Controller;
|
|
|
|
|
+import com.cnd3b.common.D3bException;
|
|
|
|
|
+import com.cnd3b.common.data.Rows;
|
|
|
|
|
+import com.cnd3b.common.data.SQLFactory;
|
|
|
|
|
+import p2.pao.PaoRemote;
|
|
|
|
|
+import p2.pao.PaoSetRemote;
|
|
|
|
|
+import p2.util.P2Exception;
|
|
|
|
|
+
|
|
|
|
|
+public class prodclass extends Controller {
|
|
|
|
|
+ public prodclass(JSONObject content) {
|
|
|
|
|
+ super(content);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 经营类目列表查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String query_typeList() {
|
|
|
|
|
+ SQLFactory sql = new SQLFactory(this, "经营类目查询");
|
|
|
|
|
+ sql.addParameter("siteid", siteid);
|
|
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sql.getSQL());
|
|
|
|
|
+ return getSucReturnObject().setData(rows).saveToDataPool().toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 经营类目新增修改
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String insert_modify_type() throws D3bException, P2Exception {
|
|
|
|
|
+ long ttypedetailid = content.getLongValue("ttypedetailid");//新增为0
|
|
|
|
|
+ String ftype = content.getString("ftype", "ttypedetail.fvalue", "经营类目");
|
|
|
|
|
+ boolean fisused = content.getBoolean("fisused");
|
|
|
|
|
+
|
|
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select * from ttypedetail where siteid='" + siteid + "' and ftype='经营类目' and fvalue='" + ftype + "'");
|
|
|
|
|
+ if (!rows.isEmpty() && rows.get(0).getLong("ttypedetailid") != ttypedetailid) {
|
|
|
|
|
+ return getErrReturnObject().setErrMsg("经营类目不可重复").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ PaoSetRemote ttypedetailSet = getP2ServerSystemPaoSet("ttypedetail", "siteid='" + siteid + "' and ttypedetailid='" + ttypedetailid + "'");
|
|
|
|
|
+ PaoRemote ttypedetail = null;
|
|
|
|
|
+ if (ttypedetailSet.isEmpty()) {
|
|
|
|
|
+ ttypedetail = ttypedetailSet.addAtEnd();
|
|
|
|
|
+ ttypedetail.setValue("siteid", siteid, 11L);//企业ID
|
|
|
|
|
+ ttypedetail.setValue("ftype", "经营类目", 11L);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ttypedetail = ttypedetailSet.getPao(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ ttypedetail.setValue("fvalue", ftype, 11L);
|
|
|
|
|
+ ttypedetail.setValue("fisused", fisused, 11L);
|
|
|
|
|
+ ttypedetailSet.save();
|
|
|
|
|
+ return getSucReturnObject().toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 经营类目删除
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String delete_type() {
|
|
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "经营类目删除");
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter("ttypedetailid", content.getString("ttypedetailid"));
|
|
|
|
|
+ String result = dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
|
|
+ if ("true".equals(result)) {
|
|
|
|
|
+ return getSucReturnObject().toString();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return getErrReturnObject().setErrMsg(result).toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 经营类目选择查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String query_typeselectList() {
|
|
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select fvalue as ftype from ttypedetail where ftype = '经营类目' and siteid ='" + siteid + "' and fisused=1 order by sequence");
|
|
|
|
|
+ return getSucReturnObject().setData(rows.toArray("ftype")).toString();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|