浏览代码

Merge remote-tracking branch 'origin/develop' into develop-green

hu 1 年之前
父节点
当前提交
64b6c8bfac
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/custom/restcontroller/webmanage/optiontype/custom/customoptiontype.java

+ 11 - 0
src/custom/restcontroller/webmanage/optiontype/custom/customoptiontype.java

@@ -9,6 +9,7 @@ import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.data.Rows;
 import common.data.SQLFactory;
+import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 
 import java.util.ArrayList;
@@ -129,6 +130,16 @@ public class customoptiontype extends Controller {
     @CACHEING_CLEAN(apiversions = {R.ID20220901092501.class})
     public String delete_optiontypemx() throws YosException {
         long optiontypemxid = content.getLong("optiontypemxid");
+
+       Rows rows=dbConnect.runSqlQuery("SELECT VALUE FROM sys_optiontype t1 INNER JOIN sys_optiontypemx t2 ON t2.optiontypeid=t1.optiontypeid WHERE optiontypemxid=1 AND t2.issystem=0 and t1.typename='tradefield'");
+       if(rows.isNotEmpty()){
+           String VALUE=rows.get(0).getString("VALUE");
+           Rows enRows=dbConnect.runSqlQuery("SELECT t2.enterprisename from sys_enterprise_tradefield t1 \n" +
+                   "INNER JOIN sys_enterprise t2 ON t2.sys_enterpriseid=t1.sys_enterpriseid \n" +
+                   "WHERE t1.tradefield='"+VALUE+"' and t1.siteid='"+siteid+"'");
+           return getErrReturnObject().setErrMsg("【"+StringUtils.join(enRows.toArray("enterprisename"),",")+"】经销商已授权,请先取消授权后删除!").toString();
+       }
+
         ArrayList<String> list = new ArrayList<>();
         list.add("delete from sys_optiontypemx where issystem=0 and siteid='" + siteid + "' and optiontypemxid=" + optiontypemxid);
         dbConnect.runSqlUpdate(list);