package com.panzhihua.service_community.api;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.api.ApiController;
|
import com.panzhihua.common.model.dtos.property.CommonPage;
|
import com.panzhihua.common.model.vos.R;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.panzhihua.common.model.vos.community.ComActSocialOrgVO;
|
import com.panzhihua.service_community.entity.ComActSocialOrg;
|
import com.panzhihua.service_community.service.ComActSocialOrgService;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.io.Serializable;
|
import java.util.List;
|
|
/**
|
* 社会组织(ComActSocialOrg)表控制层
|
*
|
* @author makejava
|
* @since 2021-09-17 10:45:31
|
*/
|
@RestController
|
@RequestMapping("comActSocialOrg")
|
public class ComActSocialOrgApi {
|
/**
|
* 服务对象
|
*/
|
@Resource
|
private ComActSocialOrgService comActSocialOrgService;
|
|
/**
|
* 分页查询所有数据
|
*
|
* @param commonPage 查询实体
|
* @return 所有数据
|
*/
|
@PostMapping("queryAll")
|
public R selectAll(@RequestBody CommonPage commonPage) {
|
return this.comActSocialOrgService.pageList(commonPage);
|
}
|
|
/**
|
* 通过主键查询单条数据
|
*
|
* @param id 主键
|
* @return 单条数据
|
*/
|
@GetMapping("{id}")
|
public R selectOne(@PathVariable("id") Long id) {
|
return this.comActSocialOrgService.selectById(id);
|
}
|
|
/**
|
* 通过userId查询
|
*
|
* @param userId 主键
|
* @return 单条数据
|
*/
|
@GetMapping("/selectByUserId")
|
public R selectOneByUserId(@RequestParam("userId") Long userId) {
|
return R.ok(this.comActSocialOrgService.getOne(new QueryWrapper<ComActSocialOrg>().lambda().eq(ComActSocialOrg::getUserId,userId)));
|
}
|
/**
|
* 新增数据
|
*
|
* @param comActSocialOrg 实体对象
|
* @return 新增结果
|
*/
|
@PostMapping
|
public R insert(@RequestBody ComActSocialOrgVO comActSocialOrg) {
|
return this.comActSocialOrgService.insert(comActSocialOrg);
|
}
|
|
/**
|
* 修改数据
|
*
|
* @param comActSocialOrg 实体对象
|
* @return 修改结果
|
*/
|
@PostMapping("/update")
|
public R update(@RequestBody ComActSocialOrgVO comActSocialOrg) {
|
return this.comActSocialOrgService.update(comActSocialOrg);
|
}
|
|
/**
|
* 删除数据
|
*
|
* @param id 主键结合
|
* @return 删除结果
|
*/
|
@GetMapping("del")
|
public R delete(@RequestParam("id") Long id) {
|
return this.comActSocialOrgService.delete(id);
|
}
|
}
|