示例#1
0
  /**
   * 广播所有消息班级关联的家长(教育机构)
   *
   * @param msg
   * @return
   */
  public void pushMsgToParentByPxStudent(
      int type, String type_uuid, String student_uuids, String msg) throws Exception {
    String title = getPushMsgTitleByType(type);

    Session s = this.nSimpleHibernateDao.getHibernateTemplate().getSessionFactory().openSession();

    // from StudentContactRealation where student_uuid in( select uuid from
    // Student where classuuid =?)
    String sql =
        "select DISTINCT parent_uuid from px_pxstudentcontactrealation  where student_uuid in ("
            + DBUtil.stringsToWhereInValue(student_uuids)
            + ")";
    Query q = s.createSQLQuery(sql);
    List<String> parentuuidlist = q.list();
    pushMsgToParentByParentuuidList(type, type_uuid, parentuuidlist, msg);
  }
  @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
  public String get(@PathVariable String uuid, ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    PxStudent s;
    try {
      if (DBUtil.isSqlInjection(uuid, responseMessage)) return "";

      s = pxStudentService.get(uuid);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage("服务器异常:" + e.getMessage());
      return "";
    }
    model.addAttribute(RestConstants.Return_G_entity, s);
    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }