package org.springblade.modules.business.controller;
|
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.AllArgsConstructor;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.utils.Func;
|
import org.springblade.modules.business.entity.Business;
|
import org.springblade.modules.business.service.BusinessService;
|
import org.springblade.modules.business.vo.BusinessVo;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* @author zhongrj
|
* @time 2021-12-25
|
* @desc 工商信息控制层
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/business")
|
public class BusinessController {
|
|
private final BusinessService businessService;
|
|
|
// /**
|
// * 自定义分页
|
// * @param query page,size
|
// * @param business 工商信息信息对象
|
// */
|
// @GetMapping("/page")
|
// public R<IPage<SecurityPaperVo>> page(SecurityPaperVo business, Query query) {
|
// IPage<SecurityPaperVo> pages = businessService.selectSecurityPaperPage(Condition.getPage(query), business);
|
// return R.data(pages);
|
// }
|
|
/**
|
* 新增
|
* @param business 工商信息信息对象
|
*/
|
@PostMapping("/save")
|
@ApiOperation(value = "新增", notes = "传入business")
|
public R save(@RequestBody Business business){
|
return R.data(businessService.save(business));
|
}
|
|
|
/**
|
* 修改
|
* @param business 工商信息信息对象
|
*/
|
@PostMapping("/update")
|
public R update(@RequestBody Business business){
|
return R.status(businessService.updateById(business));
|
}
|
|
/**
|
* 新增或修改
|
* @param business 工商信息信息对象
|
*/
|
@PostMapping("/submit")
|
public R submit(@RequestBody Business business){
|
if (null==business.getId()){
|
businessService.save(business);
|
}else {
|
businessService.updateById(business);
|
}
|
return R.data(business);
|
}
|
|
/**
|
* 删除
|
* @param ids 工商信息信息ids 数组
|
*/
|
@PostMapping("/remove")
|
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
|
return R.status(businessService.removeByIds(Func.toLongList(ids)));
|
}
|
|
/**
|
* 详情
|
* @param business 工商信息信息对象
|
*/
|
@GetMapping("/detail")
|
@ApiOperation(value = "详情", notes = "传入business")
|
public R<Business> detail(Business business) {
|
Business detail = businessService.getOne(Condition.getQueryWrapper(business));
|
return R.data(detail);
|
}
|
|
/**
|
* 详情(包含分公司工商信息)
|
* @param business 工商信息信息对象
|
*/
|
@GetMapping("/getBusinessInfo")
|
public R<BusinessVo> getBusinessInfo(Business business) {
|
return R.data(businessService.getBusinessInfo(business));
|
}
|
|
}
|