package com.starry.admin.modules.weichat.controller;

import com.starry.admin.common.aspect.ClerkUserLogin;
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelGroupInfoEntity;
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
import com.starry.admin.modules.weichat.entity.PlayGroupWagesQueryVo;
import com.starry.admin.modules.weichat.entity.PlayGroupWagesReturnVo;
import com.starry.common.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 微信查询组长工资
 *
 * @author admin
 * @since 2024/7/6 下午3:46
 **/
@Slf4j
@RestController
@RequestMapping("/wx/group")
public class WxPersonnelGroupInfoController {


    @Resource
    private IPlayPersonnelGroupInfoService playClerkGroupInfoService;


    /**
     * 查询组长公工资
     */
    @ClerkUserLogin
    @PostMapping("/wages/listAll")
    public R listGroupWagesAll(@Validated @RequestBody PlayGroupWagesQueryVo vo) {
        List<PlayPersonnelGroupInfoEntity> list = playClerkGroupInfoService.selectAll();
        List<PlayGroupWagesReturnVo> data = new ArrayList<>();
        for (PlayPersonnelGroupInfoEntity entity : list) {
            PlayGroupWagesReturnVo bean = new PlayGroupWagesReturnVo();
            bean.setGroupName(entity.getGroupName());
            data.add(bean);
        }
        return R.ok(data);
    }


}
