Yansen 2 years ago
parent
commit
c8845218cc

+ 15
- 0
src/main/java/com/yunzhi/inte/controller/PackageController.java View File

10
 
10
 
11
 import com.yunzhi.inte.common.StringUtils;
11
 import com.yunzhi.inte.common.StringUtils;
12
 import com.yunzhi.inte.entity.Dishes;
12
 import com.yunzhi.inte.entity.Dishes;
13
+import com.yunzhi.inte.entity.PackageDetail;
13
 import com.yunzhi.inte.entity.Store;
14
 import com.yunzhi.inte.entity.Store;
14
 import io.swagger.annotations.Api;
15
 import io.swagger.annotations.Api;
15
 import io.swagger.annotations.ApiOperation;
16
 import io.swagger.annotations.ApiOperation;
67
         return ResponseBean.success(result);
68
         return ResponseBean.success(result);
68
     }
69
     }
69
 
70
 
71
+
72
+    /**
73
+     * 导出套餐
74
+     *
75
+     * @return 查询结果
76
+     */
77
+    @ApiOperation("导出套餐")
78
+    @GetMapping("/export")
79
+    public ResponseBean export() throws Exception {
80
+        List<PackageDetail> result = packageService.exportAll();
81
+
82
+        return ResponseBean.success(result);
83
+    }
84
+
70
     /**
85
     /**
71
      * 新增数据
86
      * 新增数据
72
      *
87
      *

+ 11
- 0
src/main/java/com/yunzhi/inte/entity/PackageDetail.java View File

1
 package com.yunzhi.inte.entity;
1
 package com.yunzhi.inte.entity;
2
 
2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3
 import io.swagger.annotations.ApiModel;
4
 import io.swagger.annotations.ApiModel;
4
 import io.swagger.annotations.ApiModelProperty;
5
 import io.swagger.annotations.ApiModelProperty;
5
 import com.baomidou.mybatisplus.annotation.IdType;
6
 import com.baomidou.mybatisplus.annotation.IdType;
29
     /** 套餐ID */
30
     /** 套餐ID */
30
     @ApiModelProperty(name = "套餐ID",notes = "")
31
     @ApiModelProperty(name = "套餐ID",notes = "")
31
     private Integer packageId ;
32
     private Integer packageId ;
33
+
34
+    /** 套餐名称 */
35
+    @ApiModelProperty(name = "套餐名称",notes = "")
36
+    @TableField(exist = false)
37
+    private Integer packageName ;
32
     /** 菜肴ID */
38
     /** 菜肴ID */
33
     @ApiModelProperty(name = "菜肴ID",notes = "")
39
     @ApiModelProperty(name = "菜肴ID",notes = "")
34
     private Integer dishId ;
40
     private Integer dishId ;
41
+
42
+    /** 菜肴名称 */
43
+    @ApiModelProperty(name = "菜肴名称",notes = "")
44
+    @TableField(exist = false)
45
+    private Integer dishName ;
35
     /** 菜肴类型 */
46
     /** 菜肴类型 */
36
     @ApiModelProperty(name = "菜肴类型",notes = "1主食,2菜肴")
47
     @ApiModelProperty(name = "菜肴类型",notes = "1主食,2菜肴")
37
     private Integer dishKind ;
48
     private Integer dishKind ;

+ 4
- 0
src/main/java/com/yunzhi/inte/mapper/PackageMapper.java View File

1
 package com.yunzhi.inte.mapper;
1
 package com.yunzhi.inte.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.inte.entity.PackageDetail;
4
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
6
 import com.yunzhi.inte.entity.Package;
7
 import com.yunzhi.inte.entity.Package;
7
 
8
 
9
+import java.util.List;
10
+
8
 /**
11
 /**
9
  * 套餐;(package)表数据库访问层
12
  * 套餐;(package)表数据库访问层
10
  * @author : http://njyunzhi.com
13
  * @author : http://njyunzhi.com
13
 @Mapper
16
 @Mapper
14
 public interface PackageMapper  extends BaseMapper<Package>{
17
 public interface PackageMapper  extends BaseMapper<Package>{
15
 
18
 
19
+    List<PackageDetail> exportAll();
16
 }
20
 }

+ 4
- 0
src/main/java/com/yunzhi/inte/service/PackageService.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.yunzhi.inte.entity.Package;
4
 import com.yunzhi.inte.entity.Package;
5
+import com.yunzhi.inte.entity.PackageDetail;
6
+
7
+import java.util.List;
5
 
8
 
6
 /**
9
 /**
7
  * 套餐;(package)表服务接口
10
  * 套餐;(package)表服务接口
10
  */
13
  */
11
 public interface PackageService extends IBaseService<Package> {
14
 public interface PackageService extends IBaseService<Package> {
12
 
15
 
16
+    List<PackageDetail> exportAll();
13
 }
17
 }

+ 8
- 0
src/main/java/com/yunzhi/inte/service/impl/PackageServiceImpl.java View File

1
 package com.yunzhi.inte.service.impl;
1
 package com.yunzhi.inte.service.impl;
2
 
2
 
3
+import com.yunzhi.inte.entity.PackageDetail;
3
 import org.springframework.beans.factory.annotation.Autowired;
4
 import org.springframework.beans.factory.annotation.Autowired;
4
 import org.springframework.stereotype.Service;
5
 import org.springframework.stereotype.Service;
5
 import com.yunzhi.inte.entity.Package;
6
 import com.yunzhi.inte.entity.Package;
6
 import com.yunzhi.inte.mapper.PackageMapper;
7
 import com.yunzhi.inte.mapper.PackageMapper;
7
 import com.yunzhi.inte.service.PackageService;
8
 import com.yunzhi.inte.service.PackageService;
9
+
10
+import java.util.List;
11
+
8
 /**
12
 /**
9
  * 套餐;(package)表服务实现类
13
  * 套餐;(package)表服务实现类
10
  * @author : http://www.chiner.pro
14
  * @author : http://www.chiner.pro
13
 @Service
17
 @Service
14
 public class PackageServiceImpl extends BaseServiceImpl<PackageMapper, Package> implements PackageService {
18
 public class PackageServiceImpl extends BaseServiceImpl<PackageMapper, Package> implements PackageService {
15
 
19
 
20
+    @Override
21
+    public List<PackageDetail> exportAll() {
22
+        return baseMapper.exportAll();
23
+    }
16
 }
24
 }

+ 14
- 0
src/main/java/com/yunzhi/inte/vo/PackageExport.java View File

1
+package com.yunzhi.inte.vo;
2
+
3
+
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+@Data
9
+@ApiModel("套餐导出")
10
+public class PackageExport {
11
+
12
+    @ApiModelProperty("套餐名称")
13
+    String packageName;
14
+}

+ 14
- 0
src/main/resources/mapper/PackageMapper.xml View File

3
 
3
 
4
 <mapper namespace="com.yunzhi.inte.mapper.PackageMapper">
4
 <mapper namespace="com.yunzhi.inte.mapper.PackageMapper">
5
 
5
 
6
+    <select id="exportAll" resultType="com.yunzhi.inte.entity.PackageDetail">
7
+        SELECT
8
+            s.*,
9
+            t.`name` AS package_name,
10
+            m.`name` AS dish_name
11
+        FROM
12
+            package t
13
+                INNER JOIN package_detail s ON t.id = s.package_id
14
+                INNER JOIN dishes m ON s.dish_id = m.id
15
+        WHERE
16
+            t.`status` = 1
17
+        ORDER BY
18
+            t.`name` ASC
19
+    </select>
6
 </mapper>
20
 </mapper>