SysUserUniteController.java 1.56 KB
package com.chinagas.modules.system.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.chinagas.api.system.domain.SysUserUnite;
import com.chinagas.api.system.domain.SysUserUnite;

import com.chinagas.common.core.domain.R;
import com.chinagas.common.core.utils.StringUtils;
import com.chinagas.common.log.annotation.Log;
import com.chinagas.common.log.enums.BusinessType;
import com.chinagas.modules.system.service.ISysUserUniteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sysUserUnite")
public class SysUserUniteController {
    @Autowired
    private ISysUserUniteService iSysUserUniteService;

    @Log(title = "用户钉钉信息", businessType = BusinessType.INSERT)
    @PostMapping("/saveOrUpdate")
    public R<Boolean> saveOrUpdate(@RequestBody SysUserUnite sysUserUnite){
        if (sysUserUnite == null
                || StringUtils.isEmpty(sysUserUnite.getDingTalkUnionId())
                || StringUtils.isEmpty(sysUserUnite.getDingTalkUserId())
                || sysUserUnite.getUserId() == null) {
            return R.ok(false);
        }
        iSysUserUniteService.remove(Wrappers.<SysUserUnite>lambdaQuery().eq(SysUserUnite::getUserId,sysUserUnite.getUserId()));
        return R.ok(iSysUserUniteService.save(sysUserUnite));
    }

}