package com.mvc.controller.beihai;

import com.mvc.model.beihai.DdUser;
import com.mvc.service.beihai.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@RequestMapping("/user")
@Controller
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 登录ddddddddddddddddddddd
     */
    @RequestMapping("/login")
    @ResponseBody
    public Map<String, Object> login(@RequestBody DdUser ddUser) {
        return userService.login(ddUser);
    }

   /* *//**
     * 查询
     *//*
    @RequestMapping("/list/{companyId}")
    @ResponseBody
    public Map<String, Object> find(DdUser ddUser) {
        return userService.findByCompany(ddUser);
    }

    *//**
     * 保存
     *//*
    @RequestMapping("/save")
    @ResponseBody
    public Map<String, Object> save(@RequestBody DdUser ddUser) {
        return userService.save(ddUser);
    }

    *//**
     * 删除
     *//*
    @RequestMapping("/del/{uid}")
    @ResponseBody
    public Map<String, Object> del(DdUser ddUser) {
        return userService.remove(ddUser);
    }

    *//**
     * 密码变更
     *//*
    @RequestMapping("/password")
    @ResponseBody
    public Map<String, Object> chgPassword(@RequestBody DdUser ddUser) {
        return userService.resetPassword(ddUser);
    }

    *//**
     * 密码重置
     * @param ddUser
     * @return
     *//*
    @RequestMapping("/reset")
    @ResponseBody
    public Map<String, Object> resetPassword(@RequestBody DdUser ddUser) {
        ddUser.setPasswd(userService.defaultPasswd);
        return chgPassword(ddUser);
    }*/
}
