<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__ZOMSwk37nIFtG8Bsy1Y">
  <name>授权记录查询</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>get</requestType>
  <requestUrl>/lesson/authLesson</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[#include "sysfunction";
(function(){        
  var authLessonId = getParameter("authLessonId");                    
  var authUserId = getParameter("idCardNo"); 
  var lessonName = getParameter("lessonName"); 
  var playset = getParameter("playset"); 


  var whereStr = "where 1=1 ";           

  if(isNotNull(authLessonId)){              
    whereStr += "and a.ITEM_AUTHLESSONID ='"+authLessonId+"' ";              
  }   
  if(isNotNull(playset)){              
    whereStr += "and b.item_playset ='"+playset+"' ";              
  }  
  if(isNotNull(lessonName)){              
    whereStr += "and b.ITEM_LESSONNAME like '%"+lessonName+"%' ";              
  }  

  if(isNotNull(authUserId)){              
    whereStr += "and a.ITEM_AUTHUSERID ='"+authUserId+"' ";             
  }              

  var sql="select "+        
      "'"+ getDomainid() +"' as domainid,"+      
      "b.ITEM_LESSONNAME," + //授权课程	   
      "b.item_playset," +   
      "a.ITEM_AUTHLESSONID," + //授权课程Id	        
      "a.ITEM_AUTHUSERID," + //授权人员Id	        
      "a.ITEM_AUTHUSERNAME," + //授权人员名称	        
      "a.ITEM_AUTHRECORDID," + //授权记录Id    
      "a.ITEM_PROGRESS,"+ //学习进度
      "a.ITEM_STUDIED,"+ //已学习节id 
      "a.ITEM_ISNEXTC,"+ //是否下一章
      "a.ITEM_ISNEXTS,"+ //是否下一节
      "SUBSTRING_INDEX(a.ITEM_validityDate ,'~',-1) ITEM_validityDate," + //有效期   
      "b.ITEM_URL," + //授权课程封面 
      "a.ITEM_AUTHLESSONCOVER,"+   
      "a.ID AS ITEM_ID,"+      
      "b.item_description,"+
      "a.ID "+           
      "from tlk_lesson_auth_base_info a "+        
      "INNER JOIN "+sysfunction.DS_ORGANIZATIONAUTH+  
      ".tlk_lesson_base_info b on a.ITEM_AUTHLESSONID = b.ID and ifnull(a.item_ispass,'') != '1' and ifnull(a.item_isDelete,'')!='1' "+whereStr+
      " union all "+
      "select "+        
      "'"+ getDomainid() +"' as domainid,"+      
      "b.ITEM_LESSONNAME," + //授权课程	    
      "b.item_playset," +   
      "a.ITEM_AUTHLESSONID," + //授权课程Id	        
      "a.ITEM_AUTHUSERID," + //授权人员Id	        
      "a.ITEM_AUTHUSERNAME," + //授权人员名称	        
      "a.ITEM_AUTHRECORDID," + //授权记录Id    
      "a.ITEM_PROGRESS,"+ //学习进度
      "a.ITEM_STUDIED,"+ //已学习节id 
      "a.ITEM_ISNEXTC,"+ //是否下一章
      "a.ITEM_ISNEXTS,"+ //是否下一节
      "SUBSTRING_INDEX(a.ITEM_validityDate ,'~',-1) ITEM_validityDate," + //有效期   
      "b.ITEM_URL," + //授权课程封面 
      "a.ITEM_AUTHLESSONCOVER,"+   
      "a.ID AS ITEM_ID,"+      
      "b.item_description,"+
      "a.ID "+           
      "from organizationAuth.tlk_innerLesson a "+
      "INNER JOIN "+
      "organizationAuth.tlk_lesson_base_info b on a.ITEM_AUTHLESSONID = b.ID  and ifnull(a.item_isDelete,'')!='1' "+whereStr; 
  sql += " limit 1000"
  var datas = queryByDSName("tms",sql);
  return datas;     
})()]]></responseScript>
</Api>