| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package restcontroller.webmanage.sale.agentscope;
- import java.util.HashMap;
- import com.alibaba.fastjson2.JSONArray;
- import com.alibaba.fastjson2.JSONObject;
- import common.Controller;
- import common.YosException;
- import common.annotation.API;
- import common.annotation.CACHEING;
- import common.annotation.CACHEING_CLEAN;
- import common.annotation.cm;
- import common.data.QuerySQL;
- import common.data.Rows;
- import common.data.SQLFactory;
- import restcontroller.R;
- @API(title = "经销商省市县明细管理")
- public class agentscope extends Controller {
- public agentscope(JSONObject arg0) throws YosException {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
- @API(title = "经销商省市县明细查询", apiversion = R.ID2025071615124203.v1.class)
- @CACHEING
- public String query_areascope() throws YosException {
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents_salescope", "sa_agents_salescopeid", "sa_agentsid","province","city","county");
- querySQL.setTableAlias("t1");
- querySQL.setSiteid(siteid);
- querySQL.setWhere("t1.sa_agentsid",content.getString("sa_agentsid"));
- querySQL.setPage(pageSize, pageNumber);
- Rows rows = querySQL.query();
- return getSucReturnObject().setData(rows).toString();
- }
- @API(title = "经销商省市县新增修改", apiversion = R.ID2025071615130703.v1.class)
- @CACHEING_CLEAN(cms = {@cm(clazz = agentscope.class, method = {"query_areascope"})})
- public String insertormodify_areascope() throws YosException {
- long sa_agentsid = content.getLongValue("sa_agentsid");//区域id
- long sa_agents_salescopeid = content.getLongValue("sa_agents_salescopeid");//新增时传0
- String province = content.getString("province");
- String city = content.getString("city");
- String county = content.getString("county");
- SQLFactory sqlFactory;
- if (sa_agents_salescopeid <= 0 || dbConnect.runSqlQuery("select sa_agents_salescopeid from sa_agents_salescope where sa_agents_salescopeid=" + sa_agents_salescopeid).isEmpty()) {
- sa_agents_salescopeid = createTableID("sa_agents_salescope");
- sqlFactory = new SQLFactory(this, "经销商省市县新增");
- sqlFactory.addParameter("siteid", siteid);
- sqlFactory.addParameter("sa_agentsid", sa_agentsid);
- sqlFactory.addParameter("sa_agents_salescopeid", sa_agents_salescopeid);
- sqlFactory.addParameter("province", province);
- sqlFactory.addParameter("city", city);
- sqlFactory.addParameter("county", county);
- } else {
- sqlFactory = new SQLFactory(this, "经销商省市县修改");
- sqlFactory.addParameter("siteid", siteid);
- sqlFactory.addParameter("sa_agentsid", sa_agentsid);
- sqlFactory.addParameter("sa_agents_salescopeid", sa_agents_salescopeid);
- sqlFactory.addParameter("province", province);
- sqlFactory.addParameter("city", city);
- sqlFactory.addParameter("county", county);
- }
- dbConnect.runSqlUpdate(sqlFactory);
- return query_areascope();
- }
- @API(title = "经销商省市县明细删除", apiversion = R.ID2025071615133603.v1.class)
- @CACHEING_CLEAN(cms = {@cm(clazz = agentscope.class, method = {"query_areascope"})})
- public String delete_areascope() throws YosException {
- long sa_agents_salescopeid = content.getLongValue("sa_agents_salescopeid");
- Rows rows=dbConnect.runSqlQuery("select sa_agentsid from sa_agents_salescope where siteid='" + siteid + "' and sa_agents_salescopeid=" + sa_agents_salescopeid);
- if(!rows.isEmpty()) {
- content.put("sa_agentsid", rows.get(0).getLong("sa_agentsid"));
- }else {
- content.put("sa_agentsid", 0);
- }
- dbConnect.runSqlUpdate("delete from sa_agents_salescope where siteid='" + siteid + "' and sa_agents_salescopeid=" + sa_agents_salescopeid);
- return getSucReturnObject().toString();
- }
- }
|