package com.ruoyi.web.controller.zhang;
|
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.domain.ZInfoUser;
|
import com.ruoyi.domain.ZfShareOther;
|
import com.ruoyi.domain.ZfShareData;
|
import com.ruoyi.service.ZInfoUserService;
|
import com.ruoyi.service.ZfClanService;
|
import com.ruoyi.service.ZfShareDataService;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
|
@RestController
|
@RequestMapping("/zfShareData")
|
public class ZfShareDataController extends BaseController {
|
@Resource
|
private ZfShareDataService zfShareDataService;
|
|
@Resource
|
private ZInfoUserService zInfoUserService;
|
|
@Resource
|
private ZfClanService zfClanService;
|
|
/**
|
* 共享给了谁
|
* @param zfShareData
|
* @return
|
*/
|
@GetMapping("/all")
|
public List<ZfShareOther> listAll(ZfShareData zfShareData) {
|
List<ZfShareData> zfShareData2 = zfShareDataService.selectList();
|
List<ZfShareOther> zfShareOtherList = new ArrayList<>();
|
for (ZfShareData zfShareData1 :zfShareData2){
|
System.out.println("1111111111111111111111");
|
ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getSharedId().longValue());
|
ZfShareOther zfShareOther = new ZfShareOther();
|
zfShareOther.setUserId(infoBysysId.getSysId().intValue());
|
zfShareOther.setUserName(infoBysysId.getNickName());
|
zfShareOther.setClanId(infoBysysId.getClanId());
|
zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
|
zfShareOtherList.add(zfShareOther);
|
}
|
return zfShareOtherList;
|
}
|
/**
|
* 通过id查找
|
*/
|
|
@GetMapping(value = "/{id}")
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
return success(zfShareDataService.getById(id));
|
}
|
|
/**
|
* 新增共享
|
*/
|
// @PreAuthorize("@ss.hasPermi('system:property:add')")
|
@Log(title = "共享记录", businessType = BusinessType.INSERT)
|
@PostMapping
|
public AjaxResult add(@RequestBody ZfShareOther zfShareData) {
|
return zfShareDataService.addData(zfShareData.getIds());
|
}
|
|
/**
|
* 批量删除家庭大事件记录
|
*/
|
@Log(title = "共享记录", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
return zfShareDataService.deleteData(ids);
|
}
|
|
/**
|
* 共享者 输入userid
|
* @param
|
* @return
|
*/
|
@GetMapping("/come/{id}")
|
public List<ZfShareOther> list(@PathVariable Long id) {
|
List<ZfShareData> shareId = zfShareDataService.getShareId(id);
|
List<ZfShareOther> zfShareOtherList = new ArrayList<>();
|
for (ZfShareData zfShareData1 : shareId){
|
System.out.println("1111111111111111111111");
|
ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getUserId().longValue());
|
ZfShareOther zfShareOther = new ZfShareOther();
|
zfShareOther.setUserId(infoBysysId.getSysId().intValue());
|
zfShareOther.setUserName(infoBysysId.getNickName());
|
zfShareOther.setClanId(infoBysysId.getClanId());
|
zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
|
zfShareOtherList.add(zfShareOther);
|
}
|
return zfShareOtherList;
|
}
|
/**
|
* 设置主账户 修改MasterAccount值
|
*/
|
@Log(title = "共享记录", businessType = BusinessType.UPDATE)
|
@PutMapping("/setAdminAccount")
|
public AjaxResult edit(@RequestBody ZfShareData zfShareData) {
|
return zfShareDataService.setAdmin(zfShareData.getUserId().longValue(),zfShareData.getMasterAccount().longValue());
|
}
|
//
|
|
/**
|
* 设置为所有用户可以查看 传入userid
|
*/
|
@Log(title = "共享记录", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public AjaxResult edit2(@RequestBody ZfShareData zfShareData) {
|
return zfShareDataService.allUser(zfShareData.getUserId().longValue());
|
}
|
//
|
}
|