/**
 * @author 龙喜<xiaolong.lxl@alibaba-inc.com>
 * @description employee service
 */

'use strict';

const Sequelize = require('sequelize');
const sq = require('../db').sequelize;
const employee = require('./model/employee');
const exam = require('./model/exam');
const normalize = require('./lib/data-normalize');

module.exports = {
  create: function* (workerId, nick, name, email, account, tbww) {
    return normalize(
      yield employee.create({
        employeeId: workerId,
        nick: nick,
        name: name,
        email: email,
        account: account,
        tbww: tbww
      })
    );
  },
  get: function* (workerId) {
    return normalize(
      yield employee.findOne({
        where: {
          employeeId: workerId
        }
      })
    );
  },
  getList: function* () {
    /*return employee.findAll({
      order: [
        // Will order by max(age) DESC
        [sequelize.fn('max', sequelize.col('eId')), 'DESC']
      ]
    });*/
  }
};

@@ -104,211 +104,43 @@
 nst 
-Sequelize = require('sequelize');%0Aconst sq = require('../db').sequelize;%0Aconst employee = require('./model/employee');%0Aconst exam = require('./model/exam');%0Aconst normalize = require('./lib/data-normaliz
+employee = require('./model/employe
 e');
@@ -169,16 +169,22 @@
  create:
+ async
  functio
@@ -176,34 +176,32 @@
 : async function
-* 
 (workerId, nick,
@@ -225,14 +225,8 @@
 ount
-, tbww
 ) %7B%0A
@@ -236,38 +236,21 @@
  return 
-normalize(%0A      yield
+await
  employe
@@ -262,26 +262,24 @@
 ate(%7B%0A      
- 
- 
 employeeId: 
@@ -294,18 +294,16 @@
 ,%0A      
-  
 nick: ni
@@ -312,18 +312,16 @@
 ,%0A      
- 
- 
 name: na
@@ -324,18 +324,16 @@
 : name,%0A
-  
       em
@@ -344,18 +344,16 @@
  email,%0A
-  
       ac
@@ -370,242 +370,214 @@
 ount
-,%0A        tbww: tbww%0A      %7D)%0A    );%0A  %7D,%0A  get: function* (workerId) %7B%0A    return normalize(%0A      yield employee.findOne(%7B%0A        where: %7B%0A          employeeId: workerId%0A        %7D%0A      %7D)%0A    );%0A  %7D,%0A  getList: function* (
+%0A    %7D);%0A  %7D,%0A  /**%0A   * %E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E4%B8%80%E4%B8%AA plain object http://docs.sequelizejs.com/class/lib/model.js~Model.html#instance-method-get%0A   * @param workerId%0A   * @returns %7B*%7D%0A   */%0A  get: async function(workerId
 ) %7B%0A    
 /*re
@@ -576,17 +576,21 @@
     
-/*
 return 
+await 
 empl
@@ -602,11 +602,11 @@
 find
-All
+One
 (%7B%0A 
@@ -614,16 +614,16 @@
     
-ord
+wh
 er
+e
 : 
-%5B
+%7B
 %0A   
@@ -631,114 +631,44 @@
     
-// Will order by max(age) DESC%0A        %5Bsequelize.fn('max', sequelize.col('eId')), 'DESC'%5D
+employeeId: workerId
 %0A      
-%5D
+%7D
 %0A    %7D);
 */%0A 
@@ -663,18 +663,16 @@
 %0A    %7D);
-*/
 %0A  %7D%0A%7D;%0A

add services