feat():添加导出接口

master
zhang chengzhi 2024-08-09 20:22:11 +08:00
parent b2c38d4c11
commit 13b2163d57
2 changed files with 62 additions and 30 deletions

View File

@ -7,9 +7,15 @@ import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
import com.muyu.cloud.pay.domain.resp.CustomerResp; import com.muyu.cloud.pay.domain.resp.CustomerResp;
import com.muyu.cloud.pay.service.OrderPayCustomerService; import com.muyu.cloud.pay.service.OrderPayCustomerService;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.system.domain.SysRole;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -47,7 +53,9 @@ public class OrderPayCustomerController {
public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq) { public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq) {
return Result.success(orderPayCustomerService.selectList(customerListReq)); return Result.success(orderPayCustomerService.selectList(customerListReq));
}; }
;
/** /**
* *
@ -68,6 +76,7 @@ public class OrderPayCustomerController {
/** /**
* *
*
* @param orderCustomerAddReq * @param orderCustomerAddReq
* @return * @return
*/ */
@ -77,12 +86,16 @@ public class OrderPayCustomerController {
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq)); orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
return Result.success(); return Result.success();
} }
/** /**
* *
*
* @param orderCustomerId * @param orderCustomerId
* @param orderCustomerUpdReq * @param orderCustomerUpdReq
* @return * @return
@ -97,11 +110,16 @@ public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultVal
orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId)); orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId));
return Result.success(null, "操作成功"); return Result.success(null, "操作成功");
} }
/** /**
* *
*
* @param orderCustomerId * @param orderCustomerId
* @return * @return
*/ */
@ -115,6 +133,7 @@ public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultVal
/** /**
* ID * ID
*
* @param orderCustomerId ID * @param orderCustomerId ID
* @return * @return
*/ */
@ -129,6 +148,7 @@ public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultVal
/** /**
* ID * ID
*
* @param orderCustomerId ID * @param orderCustomerId ID
* @return * @return
*/ */
@ -141,9 +161,9 @@ public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultVal
} }
/** /**
* ID * ID
*
* @param orderCustomerId ID * @param orderCustomerId ID
* @return * @return
*/ */
@ -156,5 +176,16 @@ public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultVal
} }
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("pay:user:export")
@PostMapping("/export")
public void export (HttpServletResponse response, @Validated @RequestBody CustomerListReq customerListReq) {
List<CustomerResp> customerRespList = orderPayCustomerService.selectList(customerListReq);
ExcelUtil<CustomerResp> util = new ExcelUtil<CustomerResp>(CustomerResp.class);
util.exportExcel(response, customerRespList, "角色数据");
}
} }

View File

@ -27,6 +27,7 @@ public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, Ord
LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode,appCode); orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode,appCode);
orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime); orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime);
orderPayInfoQueryWrapper.last("limit "+limit); orderPayInfoQueryWrapper.last("limit "+limit);