package beilv.web.controller.system;

import beilv.common.annotation.Log;
import beilv.common.core.controller.BaseController;
import beilv.common.core.domain.AjaxResult;
import beilv.common.core.page.TableDataInfo;
import beilv.common.enums.BusinessType;
import beilv.common.utils.poi.ExcelUtil;
import beilv.system.domain.SysMember;
import beilv.system.service.ISysMemberService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 小程序用户信息Controller
 *
 * @author ruoyi
 * @date 2025-01-02
 */
@RestController
@RequestMapping("/app-api/member")
public class AppMemberController extends BaseController {

    @Autowired
    private ISysMemberService sysMemberService;


    /**
     * app查询会员用户信息
     */
    @Log(title = "app查询用户信息", businessType = BusinessType.UPDATE)
    @GetMapping("/getById/{id}")
    public AjaxResult getById(@PathVariable("id") Long id) {
        return AjaxResult.success(sysMemberService.selectSysMemberById(id));
    }

    /**
     * app修改保存会员用户信息
     */
    @Log(title = "app修改保存用户信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(@RequestBody SysMember sysMember) {
        return toAjax(sysMemberService.updateSysMember(sysMember));
    }
}
