var Service = require('../../../../common/Service');
var utils = require('../../../../common/utils');
var RoleType = require('../../dao/role_type');
var util = require('util');

/**
 * 获得用户类型列表
 */
var GetTypeList = function () {
  Service.call(this);
};

util.inherits(GetTypeList, Service);

module.exports = GetTypeList;

/**
 * 处理服务请求
 * @param {Object} req 服务请求对象
 * @param {Object} res 服务响应对象
 */
GetTypeList.prototype.process = function (req, res) {
  var self = this;
  var userType = new RoleType(this);
  userType.query({
    field: 'id,name,code',
    where: 'org_id=' + req.session.orgId,
    order: 'code asc'
  }, function (rows) {
    res.data = rows;
    self.end(res);
  });
};