<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__PYOaMx1VQdtah6Pp4cn">
  <name>课程节进度查询</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>get</requestType>
  <requestUrl>/lesson/personSection</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function(){
  var result = new Packages.java.util.HashMap();
  var idCardNo = getParameter("idCardNo");                     
  var sectionId = getParameter("sectionId"); 
  var authLessonId = getParameter("authLessonId");  
  var whereStr = " where 1=1 ";         
  if(isNotNull(idCardNo)){            
    whereStr += "and a.ITEM_AUTHUSERID = '"+idCardNo+"' ";            
  }            
  if(isNotNull(sectionId)){            
    whereStr += "and c.ID = '"+sectionId+"' ";            
  }    
  if(isNotNull(authLessonId)){            
    whereStr += "and  a.ITEM_authLessonId= '"+authLessonId+"' ";            
  }      


  var sql = "select '"+getDomainid()+"' as domainid,"+
      "a.ITEM_LEARNSTYLE,"+
      "a.ITEM_authLessonId,"+
      "a.ITEM_AUTHUSERNAME," + //授权姓名
      "a.ITEM_AUTHUSERID," + //授权人员Id
      "c.ITEM_SECTIONNAME," + //节名称
      "ifnull( d.ITEM_NEW_PROGRESS, '0' ) ITEM_NEW_PROGRESS," + //学习进度
      "ifnull( d.ITEM_NEW_ISEND, '0' ) ITEM_NEW_ISEND," + //是否完成
      "CASE d.ITEM_ISFACETRUE WHEN '0' THEN '认证不成功' WHEN '1' THEN '认证成功' END AS ITEM_ISFACETRUET," + //人脸认证是否通过
      "d.ITEM_ISFACETRUE," + //人脸认证是否通过
      "d.ITEM_SINCETHEPHOTO," + //自拍照
      "c.ID,"+ //节ID
      "c.ITEM_SECTIONRESURL," + //节资源url
      "c.ITEM_isOnFace," + //是否人脸  
      "c.ITEM_COVERURL" + //课程封面   
      " from tms.tlk_lesson_auth_base_info a"+
      " LEFT JOIN "+
      "tlk_lesson_chapter b on b.ITEM_LESSONID = a.ITEM_AUTHLESSONID"+
      " LEFT JOIN "+
      "tlk_lesson_section c on b.ID = c.ITEM_LESSONCHAPTERID"+
      " LEFT JOIN "+
      "tms.tlk_sectionInfo d on d.ITEM_NEW_SECTIONID = c.ID and ifnull(d.item_isstudy,'') != '1' AND d.ITEM_NEW_IDCARD = a.ITEM_AUTHUSERID"+whereStr+""+" and ifnull(a.item_isdelete,'') != '1' "+
      " union all "+
      "select '"+getDomainid()+"' as domainid,"+
      "a.ITEM_LEARNSTYLE,"+
      "a.ITEM_authLessonId,"+
      "a.ITEM_AUTHUSERNAME," + //授权姓名
      "a.ITEM_AUTHUSERID," + //授权人员Id
      "c.ITEM_SECTIONNAME," + //节名称
      "ifnull( d.ITEM_NEW_PROGRESS, '0' ) ITEM_NEW_PROGRESS," + //学习进度
      "ifnull( d.ITEM_NEW_ISEND, '0' ) ITEM_NEW_ISEND," + //是否完成
      "CASE d.ITEM_ISFACETRUE WHEN '0' THEN '认证不成功' WHEN '1' THEN '认证成功' END AS ITEM_ISFACETRUET," + //人脸认证是否通过
      "d.ITEM_ISFACETRUE," + //人脸认证是否通过
      "d.ITEM_SINCETHEPHOTO," + //自拍照
      "c.ID,"+ //节ID
      "c.ITEM_SECTIONRESURL," + //节资源url
      "c.ITEM_isOnFace," + //是否人脸  
      "c.ITEM_COVERURL" + //课程封面   
      " from organizationAuth.tlk_innerLesson a"+
      " LEFT JOIN "+
      "tlk_lesson_chapter b on b.ITEM_LESSONID = a.ITEM_AUTHLESSONID"+
      " LEFT JOIN "+
      "tlk_lesson_section c on b.ID = c.ITEM_LESSONCHAPTERID"+
      " LEFT JOIN "+
      "tms.tlk_sectionInfo d on d.ITEM_NEW_SECTIONID = c.ID AND d.ITEM_NEW_IDCARD = a.ITEM_AUTHUSERID"+whereStr+""+" and ifnull(a.item_isdelete,'') != '1' ";
  sql += " limit 1000"

  println("lygy----------------->"+sql)
  var sqlDatas = queryByDSName("organizationAuth", sql);
  return sqlDatas;
})()]]></responseScript>
</Api>