Pārlūkot izejas kodu

消费type,菜品评价,图片

he.dujuan 3 gadi atpakaļ
vecāks
revīzija
cbff71ac63

+ 7 - 4
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/repository/DmDayPcRepository.java

@@ -39,10 +39,13 @@ public interface DmDayPcRepository extends JpaRepository<DmDayPc, Long>, JpaSpec
 //            "WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') ",nativeQuery = true)
 //    List<DmDayPc> foodRepository();
 
-    @Query(value = "SELECT DISTINCT a.`pcid`, a.`pid`, a.`id`, a.`name`, a.`price`, `times`,a.`cate`, a.`cate_name`, a.`state`, " +
-            "`window`,`window_name`, a.`pstate`, a.`barcode`, a.`no`, a.`goods`, a.`pinyin`, a.`qty_book`, `seq`, `date`, " +
-            "`shopname`,0 as cate_id,0 as pid,NULL as cate_name,null as picture,null as create_by,null as update_by," +
-            "null as create_time,null as update_time FROM dm_day_pc a LEFT JOIN dm_food_cate c ON a.cate = c.cate_id " +
+    @Query(value = "SELECT DISTINCT a.`pcid`, a.`pid`, a.`id`, a.`name`, a.`price`, `times`,a.`cate`, a.`cate_name`, a.`state`," +
+            " `window`,`window_name`, a.`pstate`, a.`barcode`, a.`no`, a.`goods`, a.`pinyin`, a.`qty_book`, `seq`, `date`," +
+            " `shopname`,0 as cate_id,0 as pid,NULL as cate_name,null as picture,null as create_by,null as update_by," +
+            "null as create_time,null as update_time,NULL AS `storage_id`, NULL AS `real_name`, NULL AS `name`, NULL AS `suffix`," +
+            " NULL AS `path`, NULL AS `url`, NULL AS `type`, NULL AS `size`, NULL AS `create_by`, NULL AS `update_by`," +
+            " NULL AS `create_time`, NULL AS `update_time` FROM dm_day_pc a LEFT JOIN dm_food_cate c ON a.cate = c.cate_id " +
+            "LEFT JOIN tool_local_storage s ON c.url = s.storage_id " +
             "WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')",nativeQuery = true)
     List<DmDayPc> foodRepository();
 

+ 1 - 13
eladmin-system/src/main/java/me/zhengjie/modules/dm/food/domain/DmFood.java

@@ -20,6 +20,7 @@ import cn.hutool.core.bean.BeanUtil;
 import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.copier.CopyOptions;
 import me.zhengjie.base.BaseEntity;
+import me.zhengjie.domain.LocalStorage;
 import me.zhengjie.modules.dm.foodCate.domain.DmFoodCate;
 import me.zhengjie.utils.SecurityUtils;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -84,17 +85,4 @@ public class DmFood extends BaseEntity implements Serializable {
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }
 
-//    @PrePersist
-//    public void prePersist() {
-//        UserDetails user = SecurityUtils.getCurrentUser();
-//        this.createBy = user.getUsername();
-//        this.createTime = new Timestamp(new Date().getTime());
-//    }
-
-//    @PreUpdate
-//    public void preUPdate() {
-//        UserDetails user = SecurityUtils.getCurrentUser();
-//        this.updateBy = user.getUsername();
-//        this.updateTime = new Timestamp(new Date().getTime());
-//    }
 }

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/food/service/dto/DmFoodDto.java

@@ -22,6 +22,7 @@ import java.io.Serializable;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.ToStringSerializer;
 import me.zhengjie.base.BaseDTO;
+import me.zhengjie.domain.LocalStorage;
 import me.zhengjie.modules.dm.foodCate.domain.DmFoodCate;
 
 /**

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/domain/DmFoodCate.java

@@ -61,9 +61,10 @@ public class DmFoodCate extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "子节点数目", hidden = true)
     private Integer subCount = 0;
 
-    @Column(name = "url")
+    @OneToOne
+    @JoinColumn(name = "url",referencedColumnName = "storage_id")
     @ApiModelProperty(value = "url路径")
-    private Long url;
+    private LocalStorage url;
 
     @Override
     public boolean equals(Object o) {

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/service/dto/DmFoodCateDto.java

@@ -47,7 +47,7 @@ public class DmFoodCateDto extends BaseDTO implements Serializable {
 
     private Integer subCount;
 
-    private Long url;
+    private LocalStorage url;
 
     private List<DmFoodCateDto> children;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/domain/AppFoodPj.java

@@ -19,7 +19,7 @@ public class AppFoodPj implements Serializable {
     @Column(name = "id")
     @ApiModelProperty(value = "id")
     @GeneratedValue(strategy = GenerationType.IDENTITY)//设置自增
-    private Integer id;
+    private Long id;
 
     @Column(name = "name")
     @ApiModelProperty(value = "菜品名称")

+ 10 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/repository/AppFoodPjRepository.java

@@ -14,8 +14,15 @@ public interface AppFoodPjRepository extends JpaRepository<AppFoodPj,Integer>, J
      * @param
      * @return
      */
-    @Query(nativeQuery =true,value = "SELECT a.id,b.`name`,b.`code`,b.type,c.create_date as order_time,c.bh,b.picture,user_code FROM dm_order_item a " +
-            "LEFT JOIN dm_food b ON a.`code` = b.`code` LEFT JOIN dm_order_record c ON a.bh=c.bh " +
-            "WHERE c.user_code=:userCode and a.pj_type='0' and date_format( create_date, '%Y-%m-%d' ) = date_format(now(),'%Y-%m-%d') ")
+//    @Query(nativeQuery =true,value = "SELECT a.id,b.`name`,b.`code`,b.type,c.create_date as order_time,c.bh,b.picture,user_code FROM dm_order_item a " +
+//            "LEFT JOIN dm_food b ON a.`code` = b.`code` LEFT JOIN dm_order_record c ON a.bh=c.bh " +
+//            "WHERE c.user_code=:userCode and a.pj_type='0' and date_format( create_date, '%Y-%m-%d' ) = date_format(now(),'%Y-%m-%d') ")
+//    List<AppFoodPj> selectAppFoodPj (@Param("userCode") String userCode);
+
+    @Query(nativeQuery =true,value = "SELECT a.id,b.`name`,b.`code`,b.type,c.create_date as order_time,c.bh," +
+            "l.url as picture,user_code FROM dm_order_item a LEFT JOIN dm_food b ON a.pid = b.id " +
+            "LEFT JOIN dm_order_record c ON a.bh=c.bh LEFT JOIN dm_food_cate d ON b.type = d.cate_id " +
+            "LEFT JOIN tool_local_storage l ON d.url = l.storage_id WHERE c.user_code='0001T110000000002HBL' " +
+            "and a.pj_type='0' and date_format( create_date, '%Y-%m-%d' ) = date_format(now(),'%Y-%m-%d') ")
     List<AppFoodPj> selectAppFoodPj (@Param("userCode") String userCode);
 }

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/CardRecordTask.java

@@ -241,6 +241,7 @@ public class CardRecordTask {
                         dmOrderItem.setPrice(userData.getString("price"));
                         dmOrderItem.setAmt(userData.getDouble("amt"));
                         dmOrderItem.setMoney(String.valueOf(userData.getDouble("amt")));
+                        dmOrderItem.setPjType("0");
                         dmOrderItemService.create(dmOrderItem);
                     }
                     JSONArray payment = attendance.getJSONArray("payments");
@@ -328,6 +329,7 @@ public class CardRecordTask {
                         dmOrderItem.setPrice(userData.getString("price"));
                         dmOrderItem.setAmt(userData.getDouble("amt"));
                         dmOrderItem.setMoney(String.valueOf(userData.getDouble("amt")));
+                        dmOrderItem.setPjType("0");
                         dmOrderItemService.create(dmOrderItem);
                     }
                     JSONArray payment = attendance.getJSONArray("payments");