|
|
|
|
@ -37,7 +37,11 @@ import org.springblade.core.secure.annotation.IsAdmin; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.modules.jinchao.constant.BaseCol; |
|
|
|
|
import org.springblade.modules.jinchao.pojo.request.CustomerSearch; |
|
|
|
|
import org.springblade.modules.jinchao.pojo.request.CustomerSubmit; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
@ -49,10 +53,10 @@ import org.springblade.modules.jinchao.service.ICustomerService; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
@ -68,7 +72,7 @@ import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
@Tag(name = "[客户]", description = "[客户]接口") |
|
|
|
|
public class CustomerController extends BladeController { |
|
|
|
|
|
|
|
|
|
private final ICustomerService customerService; |
|
|
|
|
private final ICustomerService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [客户] 详情 |
|
|
|
|
@ -77,7 +81,7 @@ public class CustomerController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@Operation(summary = "详情", description = "传入customer") |
|
|
|
|
public R<CustomerVO> detail(CustomerEntity customer) { |
|
|
|
|
CustomerEntity detail = customerService.getOne(Condition.getQueryWrapper(customer)); |
|
|
|
|
CustomerEntity detail = service.getOne(Condition.getQueryWrapper(customer)); |
|
|
|
|
return R.data(CustomerWrapper.build().entityVO(detail)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -86,10 +90,18 @@ public class CustomerController extends BladeController { |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@Operation(summary = "分页", description = "传入customer") |
|
|
|
|
public R<IPage<CustomerVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> customer, Query query) { |
|
|
|
|
IPage<CustomerEntity> pages = customerService.page(Condition.getPage(query), Condition.getQueryWrapper(customer, CustomerEntity.class)); |
|
|
|
|
return R.data(CustomerWrapper.build().pageVO(pages)); |
|
|
|
|
@Operation(summary = "list分页", description = "传入customer") |
|
|
|
|
public R<IPage<CustomerVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> customer |
|
|
|
|
, Query query) { |
|
|
|
|
IPage<CustomerEntity> pages = service.page( |
|
|
|
|
Condition.getPage(query), |
|
|
|
|
Condition.getQueryWrapper(customer, CustomerEntity.class) |
|
|
|
|
.orderByDesc(BaseCol.UPDATE_TIME) |
|
|
|
|
.orderByDesc(BaseCol.CREATE_TIME) |
|
|
|
|
); |
|
|
|
|
IPage<CustomerVO> pagesVo = CustomerWrapper.build().pageVO(pages); |
|
|
|
|
pagesVo.getRecords().stream().peek(service::setVoValue).collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -97,21 +109,21 @@ public class CustomerController extends BladeController { |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
|
@Operation(summary = "分页", description = "传入customer") |
|
|
|
|
@Operation(summary = "page分页", description = "传入customer") |
|
|
|
|
public R<IPage<CustomerVO>> page(CustomerVO customer, Query query) { |
|
|
|
|
IPage<CustomerVO> pages = customerService.selectCustomerPage(Condition.getPage(query), customer); |
|
|
|
|
IPage<CustomerVO> pages = service.selectCustomerPage(Condition.getPage(query), customer); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [客户] 新增 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "新增", description = "传入customer") |
|
|
|
|
public R save(@Valid @RequestBody CustomerEntity customer) { |
|
|
|
|
customer.setId(null); |
|
|
|
|
return R.status(customerService.save(customer)); |
|
|
|
|
@Operation(summary = "新增", description = "") |
|
|
|
|
public R save(@Valid @RequestBody CustomerSubmit submit) { |
|
|
|
|
return service.save(submit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -119,9 +131,9 @@ public class CustomerController extends BladeController { |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@Operation(summary = "修改", description = "传入customer") |
|
|
|
|
public R update(@Valid @RequestBody CustomerEntity customer) { |
|
|
|
|
return R.status(customerService.updateById(customer)); |
|
|
|
|
@Operation(summary = "修改", description = "") |
|
|
|
|
public R update(@Valid @RequestBody CustomerSubmit submit) { |
|
|
|
|
return service.update(submit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -131,7 +143,7 @@ public class CustomerController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@Operation(summary = "新增或修改", description = "传入customer") |
|
|
|
|
public R submit(@Valid @RequestBody CustomerEntity customer) { |
|
|
|
|
return R.status(customerService.saveOrUpdate(customer)); |
|
|
|
|
return R.status(service.saveOrUpdate(customer)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -141,7 +153,7 @@ public class CustomerController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids") |
|
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(customerService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
return R.status(service.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -158,8 +170,25 @@ public class CustomerController extends BladeController { |
|
|
|
|
// queryWrapper.lambda().eq(Customer::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(CustomerEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<CustomerExcel> list = customerService.exportCustomer(queryWrapper); |
|
|
|
|
List<CustomerExcel> list = service.exportCustomer(queryWrapper); |
|
|
|
|
ExcelUtil.export(response, "[客户]数据" + DateUtil.time(), "[客户]数据表", list, CustomerExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [客户] search分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/search") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "search分页", description = "") |
|
|
|
|
public R<IPage<CustomerVO>> page(CustomerSearch search, Query query) { |
|
|
|
|
IPage<CustomerVO> pages = service.search(Condition.getPage(query), search); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/listForSelect") |
|
|
|
|
@ApiOperationSupport(order = 11) |
|
|
|
|
@Operation(summary = "[客户]选择", description = "") |
|
|
|
|
public R<List<CustomerEntity>> listForSelect() { |
|
|
|
|
return service.listForSelect(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|