优化
This commit is contained in:
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.customizeExcel;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.business.vo.BusinessPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.business.vo.BusinessRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.business.BusinessDO;
|
||||
import cn.iocoder.yudao.module.member.service.business.BusinessService;
|
||||
import cn.iocoder.yudao.module.member.service.customizeExcel.CustomizeExcelService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 自定义表格导出")
|
||||
@RestController
|
||||
@RequestMapping("/member/export")
|
||||
@Validated
|
||||
public class CustomizeExcelController {
|
||||
|
||||
@Resource
|
||||
private CustomizeExcelService excelService;
|
||||
|
||||
@GetMapping("/orderExcel")
|
||||
@Operation(summary = "导出订单详情")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportBusinessExcel(String startTime,String endTime,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
List<OrderExcelVO> orderExcelVOS = excelService.exportOrderExcel(startTime, endTime);
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "订单详情统计.xls", "数据", OrderExcelVO.class,
|
||||
orderExcelVOS);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class OrderExcelVO {
|
||||
|
||||
@ExcelProperty("日期")
|
||||
private String dayTime;
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String nickname;
|
||||
|
||||
@ExcelProperty("手机")
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty("时间段")
|
||||
private String timeSlot;
|
||||
|
||||
@ExcelProperty("总价")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
@ExcelProperty("菜名")
|
||||
private String dishesName;
|
||||
|
||||
@ExcelProperty("单价(元/50g)")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ExcelProperty("重量(g)")
|
||||
private String weight;
|
||||
|
||||
@ExcelProperty("价格(元)")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
@ -128,7 +128,7 @@ public class OrderController {
|
||||
}
|
||||
|
||||
@GetMapping("/reduction")
|
||||
@Operation(summary = "根据会员编号,获得会员余额,充值金额,消费金额")
|
||||
@Operation(summary = "减免")
|
||||
public CommonResult<Boolean> reduction(Long orderId, BigDecimal money){
|
||||
orderService.reduction(orderId,money);
|
||||
return CommonResult.success(true);
|
||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.order.vo.OrderDetailsReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.order.vo.OrderDetailsRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.order.vo.AppOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.order.vo.AppOrderRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.order.vo.AppOrderSaveReqVO;
|
||||
@ -30,6 +32,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -72,12 +75,7 @@ public class AppOrderController {
|
||||
return success(orderService.getOrder(id));
|
||||
}
|
||||
|
||||
//@GetMapping("/page")
|
||||
//@Operation(summary = "获得会员订单分页")
|
||||
//public CommonResult<PageResult<AppOrderRespVO>> getOrderPage(@Valid AppOrderPageReqVO pageReqVO) {
|
||||
// PageResult<DishOrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
// return success(BeanUtils.toBean(pageResult, AppOrderRespVO.class));
|
||||
//}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员订单 Excel")
|
||||
@ -99,5 +97,18 @@ public class AppOrderController {
|
||||
return success(orderList);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员订单分页")
|
||||
public CommonResult<PageResult<OrderDetailsRespVO>> getPageResult(@Valid OrderDetailsReqVO reqVO){
|
||||
return CommonResult.success(orderService.getPageOrderDetails(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/reduction")
|
||||
@Operation(summary = "减免")
|
||||
public CommonResult<Boolean> reduction(Long orderId, BigDecimal money){
|
||||
orderService.reduction(orderId,money);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -12,4 +12,6 @@ import lombok.Data;
|
||||
public class AppPageVo extends PageParam {
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String mobile;
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ public class OtherVO {
|
||||
private String dishesImageUrl;
|
||||
private String sn;
|
||||
private BigDecimal price;
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "用户 APP - 用户个人信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -58,4 +60,29 @@ public class AppMemberUserInfoRespVO {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 消费类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private BigDecimal giftAmount;
|
||||
|
||||
/**
|
||||
* 现金金额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
|
||||
/**
|
||||
* 微信充值金额
|
||||
*/
|
||||
private BigDecimal wxAmount;
|
||||
|
||||
}
|
||||
|
@ -66,4 +66,9 @@ public class OrderDetailDO extends BaseDO {
|
||||
* 菜品价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 菜品单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
}
|
@ -19,6 +19,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@ -154,4 +155,30 @@ public class MemberUserDO extends TenantBaseDO {
|
||||
*/
|
||||
private Long faceId;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 消费类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private BigDecimal giftAmount;
|
||||
|
||||
/**
|
||||
* 现金金额
|
||||
*/
|
||||
private BigDecimal cashAmount;
|
||||
|
||||
/**
|
||||
* 微信充值金额
|
||||
*/
|
||||
private BigDecimal wxAmount;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.customizeExcel;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CustomizeExcelMapper {
|
||||
|
||||
|
||||
List<OrderExcelVO> selectOrder(@Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
}
|
@ -65,6 +65,7 @@ public class MemberAsyncServiceImpl implements MemberAsyncService{
|
||||
orderDetail.setOrderId(otherVO.getOrderId()).setDishesName(otherVO.getDishesName()).setDishUrl(otherVO.getDishesImageUrl());
|
||||
orderDetail.setSn(otherVO.getSn());
|
||||
orderDetail.setPrice(otherVO.getPrice());
|
||||
orderDetail.setUnitPrice(otherVO.getUnitPrice());
|
||||
orderDetailMapper.insert(orderDetail);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface CustomizeExcelService {
|
||||
|
||||
|
||||
List<OrderExcelVO> exportOrderExcel(String startTime,String endTime);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.member.service.customizeExcel;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.customizeExcel.CustomizeExcelMapper;
|
||||
import cn.iocoder.yudao.module.member.service.devicewarn.DeviceWarnService;
|
||||
import cn.iocoder.yudao.module.system.api.deviceInfo.DeviceInfoApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class CustomizeExcelServiceImpl implements CustomizeExcelService {
|
||||
|
||||
@Resource
|
||||
private CustomizeExcelMapper customizeExcelMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<OrderExcelVO> exportOrderExcel(String startTime, String endTime) {
|
||||
return customizeExcelMapper.selectOrder(startTime,endTime);
|
||||
}
|
||||
}
|
@ -95,6 +95,8 @@ public interface OrderService {
|
||||
List<DishOrderDO> getDishOrderByTime(LocalDateTime startTime ,LocalDateTime endTime );
|
||||
|
||||
PageResult<OrderDetailsRespVO> getPageOrderDetails(OrderDetailsReqVO reqVO);
|
||||
|
||||
|
||||
OrderDetailsRespVO getOrderDetailsAndUser(Long orderId);
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -153,7 +154,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
public PageResult<AppOrderRespVO> getOrderList(AppPageVo vo) {
|
||||
PageResult<DishOrderDO> dishOrderDOPageResult = dishOrderMapper.selectPage(vo, Wrappers.<DishOrderDO>lambdaQuery().eq(DishOrderDO::getUserId, vo.getUserId()).orderByDesc(DishOrderDO::getCreateTime));
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
if(StrUtil.isNotEmpty(vo.getMobile())){
|
||||
List<MemberUserDO> memberUserDOS = memberUserMapper.selectList(Wrappers.<MemberUserDO>lambdaQuery().like(MemberUserDO::getMobile, vo.getMobile()));
|
||||
if(CollectionUtil.isNotEmpty(memberUserDOS)){
|
||||
List<Long> collect = memberUserDOS.stream().map(MemberUserDO::getId).collect(Collectors.toList());
|
||||
ids.addAll(collect);
|
||||
}
|
||||
}
|
||||
if(vo.getUserId()!=null){
|
||||
ids.add(vo.getUserId());
|
||||
}
|
||||
|
||||
PageResult<DishOrderDO> dishOrderDOPageResult = dishOrderMapper.selectPage(vo, Wrappers.<DishOrderDO>lambdaQuery()
|
||||
.in(CollectionUtil.isNotEmpty(ids),DishOrderDO::getUserId, ids)
|
||||
.orderByDesc(DishOrderDO::getCreateTime));
|
||||
PageResult<AppOrderRespVO> appOrderRespVOPageResult = BeanUtils.toBean(dishOrderDOPageResult, AppOrderRespVO.class);
|
||||
List<AppOrderRespVO> list = appOrderRespVOPageResult.getList();
|
||||
for (AppOrderRespVO dishOrderDO : list) {
|
||||
@ -196,7 +211,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
//根据用户属性获取ids
|
||||
List<MemberUserDO> list = memberUserMapper.selectList(new LambdaQueryWrapperX<MemberUserDO>()
|
||||
.likeIfPresent(MemberUserDO::getNickname, reqVO.getUserName())
|
||||
.eqIfPresent(MemberUserDO::getMobile, reqVO.getUserAccount())
|
||||
.likeIfPresent(MemberUserDO::getMobile, reqVO.getUserAccount())
|
||||
.eqIfPresent(MemberUserDO::getCardId, reqVO.getUserJob())
|
||||
.eqIfPresent(MemberUserDO::getId, reqVO.getUserId())
|
||||
.inIfPresent(MemberUserDO::getId, groupMapper.getMemberList(reqVO.getGroupId())));
|
||||
|
@ -91,7 +91,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
otherVO.setDishesName(dish.getDishesName());
|
||||
otherVO.setDishesImageUrl(dish.getDishesImageUrl());
|
||||
otherVO.setPrice(bigDecimal1);
|
||||
|
||||
otherVO.setUnitPrice(dish.getDishesSumPrice());
|
||||
asyncService.createOrderDetail(createReqVO,otherVO);
|
||||
// 返回写死
|
||||
return 0L;
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.member.dal.mysql.customizeExcel.CustomizeExcelMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="selectOrder" resultType="cn.iocoder.yudao.module.member.controller.admin.customizeExcel.vo.OrderExcelVO">
|
||||
select
|
||||
DATE_FORMAT(md.create_time, '%Y-%m-%d') as dayTime,
|
||||
mu.nickname ,
|
||||
mu.mobile ,
|
||||
CASE
|
||||
WHEN HOUR(mo.create_time) BETWEEN 0 AND 9 THEN '早'
|
||||
WHEN HOUR(mo.create_time) BETWEEN 10 AND 15 THEN '中'
|
||||
WHEN HOUR(mo.create_time) BETWEEN 16 AND 23 THEN '晚'
|
||||
ELSE '未知'
|
||||
END AS timeSlot,
|
||||
mo.total_money ,
|
||||
md.dishes_name ,
|
||||
md.unit_price ,
|
||||
md.weight ,
|
||||
md.price
|
||||
from member_order_detail md
|
||||
left join member_dish_order mo on md.order_id = mo.id
|
||||
left join member_user mu on mu.id = mo.user_id
|
||||
where DATE_FORMAT(md.create_time, '%Y%m%d') between #{startTime} and #{endTime}
|
||||
order by mo.user_id,order_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -195,4 +195,5 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode FACE_DEVICE_INFO_EXISTS = new ErrorCode(1_002_040_003, "设备码已存在");
|
||||
|
||||
ErrorCode DISH_IMAGE_NOT_EXISTS = new ErrorCode(1_002_040_004, "本周菜单不存在");
|
||||
}
|
||||
|
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dishimage;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImageRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dishimage.DishImageDO;
|
||||
import cn.iocoder.yudao.module.system.service.dishimage.DishImageService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 本周菜单")
|
||||
@RestController
|
||||
@RequestMapping("/t/dish-image")
|
||||
@Validated
|
||||
public class DishImageController {
|
||||
|
||||
@Resource
|
||||
private DishImageService dishImageService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建本周菜单")
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:create')")
|
||||
public CommonResult<Integer> createDishImage(@Valid @RequestBody DishImageSaveReqVO createReqVO) {
|
||||
return success(dishImageService.createDishImage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新本周菜单")
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:update')")
|
||||
public CommonResult<Boolean> updateDishImage(@Valid @RequestBody DishImageSaveReqVO updateReqVO) {
|
||||
dishImageService.updateDishImage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除本周菜单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:delete')")
|
||||
public CommonResult<Boolean> deleteDishImage(@RequestParam("id") Integer id) {
|
||||
dishImageService.deleteDishImage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得本周菜单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:query')")
|
||||
public CommonResult<DishImageRespVO> getDishImage(@RequestParam("id") Integer id) {
|
||||
DishImageDO dishImage = dishImageService.getDishImage(id);
|
||||
return success(BeanUtils.toBean(dishImage, DishImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得本周菜单分页")
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:query')")
|
||||
public CommonResult<PageResult<DishImageRespVO>> getDishImagePage(@Valid DishImagePageReqVO pageReqVO) {
|
||||
PageResult<DishImageDO> pageResult = dishImageService.getDishImagePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DishImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出本周菜单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('t:dish-image:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDishImageExcel(@Valid DishImagePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DishImageDO> list = dishImageService.getDishImagePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "本周菜单.xls", "数据", DishImageRespVO.class,
|
||||
BeanUtils.toBean(list, DishImageRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dishimage.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 本周菜单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DishImagePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开始日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] startDate;
|
||||
|
||||
@Schema(description = "结束日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] endDate;
|
||||
|
||||
@Schema(description = "地址", example = "https://www.iocoder.cn")
|
||||
private String imageUrl;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dishimage.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 本周菜单 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DishImageRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17200")
|
||||
@ExcelProperty("编号")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名字", example = "张三")
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开始日期")
|
||||
@ExcelProperty("开始日期")
|
||||
private String startDate;
|
||||
|
||||
@Schema(description = "结束日期")
|
||||
@ExcelProperty("结束日期")
|
||||
private String endDate;
|
||||
|
||||
@Schema(description = "地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("地址")
|
||||
private String imageUrl;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dishimage.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 本周菜单新增/修改 Request VO")
|
||||
@Data
|
||||
public class DishImageSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17200")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名字", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开始日期")
|
||||
private String startDate;
|
||||
|
||||
@Schema(description = "结束日期")
|
||||
private String endDate;
|
||||
|
||||
@Schema(description = "地址", example = "https://www.iocoder.cn")
|
||||
private String imageUrl;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.dishimage;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 本周菜单 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("t_dish_image")
|
||||
@KeySequence("t_dish_image_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DishImageDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private String startDate;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private String endDate;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String imageUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.dishimage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImagePageReqVO;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dishimage.DishImageDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 本周菜单 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface DishImageMapper extends BaseMapperX<DishImageDO> {
|
||||
|
||||
default PageResult<DishImageDO> selectPage(DishImagePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DishImageDO>()
|
||||
.likeIfPresent(DishImageDO::getName, reqVO.getName())
|
||||
.betweenIfPresent(DishImageDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(DishImageDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(DishImageDO::getImageUrl, reqVO.getImageUrl())
|
||||
.eqIfPresent(DishImageDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(DishImageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DishImageDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.system.service.dishimage;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dishimage.DishImageDO;
|
||||
|
||||
/**
|
||||
* 本周菜单 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface DishImageService {
|
||||
|
||||
/**
|
||||
* 创建本周菜单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createDishImage(@Valid DishImageSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新本周菜单
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDishImage(@Valid DishImageSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除本周菜单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDishImage(Integer id);
|
||||
|
||||
/**
|
||||
* 获得本周菜单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 本周菜单
|
||||
*/
|
||||
DishImageDO getDishImage(Integer id);
|
||||
|
||||
/**
|
||||
* 获得本周菜单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 本周菜单分页
|
||||
*/
|
||||
PageResult<DishImageDO> getDishImagePage(DishImagePageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.system.service.dishimage;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dishimage.vo.DishImageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dishimage.DishImageDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.dishimage.DishImageMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.DISH_IMAGE_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 本周菜单 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DishImageServiceImpl implements DishImageService {
|
||||
|
||||
@Resource
|
||||
private DishImageMapper dishImageMapper;
|
||||
|
||||
@Override
|
||||
public Integer createDishImage(DishImageSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DishImageDO dishImage = BeanUtils.toBean(createReqVO, DishImageDO.class);
|
||||
dishImageMapper.insert(dishImage);
|
||||
// 返回
|
||||
return dishImage.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDishImage(DishImageSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDishImageExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DishImageDO updateObj = BeanUtils.toBean(updateReqVO, DishImageDO.class);
|
||||
dishImageMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDishImage(Integer id) {
|
||||
// 校验存在
|
||||
validateDishImageExists(id);
|
||||
// 删除
|
||||
dishImageMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDishImageExists(Integer id) {
|
||||
if (dishImageMapper.selectById(id) == null) {
|
||||
throw exception(DISH_IMAGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DishImageDO getDishImage(Integer id) {
|
||||
return dishImageMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DishImageDO> getDishImagePage(DishImagePageReqVO pageReqVO) {
|
||||
return dishImageMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,7 @@ spring:
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
# - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
||||
- org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
||||
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
|
||||
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
|
||||
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||
@ -49,7 +49,7 @@ spring:
|
||||
master:
|
||||
# name: yudao
|
||||
# url: jdbc:mysql://124.223.90.54:6975/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://124.223.90.54:6975/yudao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://localhost:33006/yudao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
@ -58,7 +58,7 @@ spring:
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: Emjlmlwj1!
|
||||
password: JXLZZX79
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
@ -78,11 +78,11 @@ spring:
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 220.200.155.28 # 地址
|
||||
port: 21103 # 端口
|
||||
database: 2 # 数据库索引
|
||||
host: localhost # 地址
|
||||
port: 63079 # 端口
|
||||
database: 1 # 数据库索引
|
||||
# 密码
|
||||
password: auistdguasyghtdas
|
||||
password: JXLZZX79
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# password: dev # 密码,建议生产环境开启
|
||||
|
Reference in New Issue
Block a user