<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__7XRdNXdA39ye8hQpb12">
  <name>查找保安员证书</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>post</requestType>
  <requestUrl>/selectSecurityCertificate</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[/*(function(){      

    var result = new Packages.java.util.HashMap(); //创建指定类对象
    var content = getParameter("_content");
    var JSONObject = new Packages.net.sf.json.JSONObject();
    var json = JSONObject.fromObject(content);
  
    var number = json.get("number");    
    var sql="  SELECT uc.number AS item_certificateno, uct.fzrq AS item_certificatedatefrom, uc.address AS item_certificatefrom from tenant_user_credentials uc JOIN tenant_user_credential_details uct on uc.id = uct.id WHERE uc.credential_type = '7' where uc.tenant_user_id = (SELECT u.id from tenant_employees e join tenant_users u on e.tenant_user_id = u.id and e.id = '"+getWebUser().getId()+"')";
    if(isNotNull(number)){
        sql+= "  and number = '"+number+"'";
    }
    var datas = queryByDSName("obpm2",sql);
  
    var result = new Packages.java.util.HashMap(); //创建指定类对象
   
    result.put("data",datas);;
    return result;
  
  })();*/
//结果返回对象，会自动转成json格式
(function(){      

    var result = new Packages.java.util.HashMap(); //创建指定类对象
    var content = getParameter("_content");
    var JSONObject = new Packages.net.sf.json.JSONObject();
    var json = JSONObject.fromObject(content);
  
    var number = json.get("number");    //页码
   var credentialYype = json.get("credentialYype");
    var sql="  SELECT uc.number AS item_certificateno, DATE_FORMAT(uct.fzrq, '%Y-%m-%d' ) AS item_certificatedatefrom, uc.address AS item_certificatefrom from tenant_user_credentials uc left JOIN tenant_user_credential_details uct on uc.id = uct.id WHERE uc.credential_type = '"+credentialYype+"' and uc.tenant_user_id in (SELECT u.id from tenant_employees e join tenant_users u on e.tenant_user_id = u.id and e.id = '"+getWebUser().getId()+"')";
  
  if(isNotNull(number)){
        sql+= "  and number = '"+number+"'";
    }
   var datas = queryByDSName("obpm2",sql);
   result.put("data",datas);;
    return result;
  
  })();



]]></responseScript>
</Api>