Ejemplo n.º 1
0
 def find(self, id):
     result = []
     result = MessageEnum.EXCEPTION
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         for row in session.query(TeamInfo.id, TeamInfo.orderId,
                                  TeamInfo.teamName, OrderInfo.name,
                                  OrderInfo.age,
                                  TeamInfo.version).join(OrderInfo).filter(
                                      TeamInfo.orderId == id).all():
             result.append({
                 'id':
                 row.id,
                 'orderId':
                 row.orderId,
                 'age':
                 row.age,
                 'create_time':
                 row.create_time.strftime("%Y-%m-%d %H:%M:%S"),
                 'update_time':
                 row.update_time.strftime("%Y-%m-%d %H:%M:%S"),
                 'version':
                 row.version
             })
         session.commit()
         result = MessageEnum.SUCCESS
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 2
0
 def insert(self, lendUser):
     result = MessageEnum.EXCEPTION
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         session.add(lendUser)
         session.commit()
         result = MessageEnum.SUCCESS
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 3
0
 def insert(self, orderInfo):
     result = OrderEnum.EXCEPTION
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         session.add(orderInfo)
         session.commit()
         result = OrderEnum.SUCCESS
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 4
0
 def find_all(self):
     result_list = []
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         for row in session.query(OrderInfo).all():
             result_list.append(DictUtil.object_as_dict(row))
         session.commit()
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 5
0
 def find_by_params(self, key, value):
     result = []
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         for row in session.query(OrderInfo).filter_by(name=value).all():
             result.append(DictUtil.object_as_dict(row))
             print result
         session.commit()
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 6
0
 def update_params_by_id(self, id, lendDict):
     result = OrderEnum.EXCEPTION
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         session.query(LendInfo).filter(LendInfo.id == id).update(lendDict)
         session.flush()
         session.commit()
         result = OrderEnum.SUCCESS
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 7
0
 def update_by_id(self, id, key, value):
     result = OrderEnum.EXCEPTION
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         session.query(OrderInfo).filter(OrderInfo.id == id).update(
             {key: value})
         session.flush()
         session.commit()
         result = OrderEnum.SUCCESS
     except Exception, e:
         print e
         session.rollback()
Ejemplo n.º 8
0
 def find_by_id(self, id):
     result_list = []
     orderDao = DaoUtil.DaoGeneric()
     session = orderDao.getSession()
     try:
         for row in session.query(OrderInfo).filter_by(id=id).all():
             result_list.append({
                 'id':
                 row.id,
                 'name':
                 row.name,
                 'age':
                 row.age,
                 'create_time':
                 row.create_time.strftime("%Y-%m-%d %H:%M:%S"),
                 'update_time':
                 row.update_time.strftime("%Y-%m-%d %H:%M:%S"),
                 'version':
                 row.version
             })
         session.commit()
     except Exception, e:
         print e
         session.rollback()