Bladeren bron

收藏商品

yubin 3 dagen geleden
bovenliggende
commit
6574636eec

+ 0 - 27
mall-interface/src/main/java/com/txz/mall/service/MidFavoriteServiceClient.java

@@ -1,27 +0,0 @@
-package com.txz.mall.service;
-
-
-import com.txz.mall.dto.*;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.*;
-import java.util.List;
-
-
-@FeignClient("mall")
-public interface MidFavoriteServiceClient {
-
-	@RequestMapping( value = {"/mid/favorite/add"}, method = {RequestMethod.POST} )
-    public Result add(@RequestBody MidFavoriteDPO midFavorite,@RequestParam("userId") Long userId);
-
-	@RequestMapping( value = {"/mid/favorite/delete"}, method = {RequestMethod.POST} )
-	public Result delete(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
-
-	@RequestMapping( value = {"/mid/favorite/update"}, method = {RequestMethod.POST} )
-	public Result update(@RequestBody MidFavoriteDPO midFavorite,@RequestParam("userId") Long userId);
-
-	@RequestMapping( value = {"/mid/favorite/detail"}, method = {RequestMethod.POST} )
-	public Result<MidFavoriteDPO> detail(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
-
-	@RequestMapping( value = {"/mid/favorite/list"}, method = {RequestMethod.POST} )
-	public Result<List<MidFavoriteDPO>> list(@RequestBody MidFavoriteDPO midFavorite, @RequestParam("page") Integer page, @RequestParam("size") Integer size,@RequestParam("userId") Long userId);
-}

+ 54 - 54
mall-service/src/main/java/com/txz/mall/controller/appcontroller/AppBannerController.java

@@ -32,60 +32,60 @@ public class AppBannerController {
     @Resource
     private BannerService bannerService;
 
-    @PostMapping("/add")
-    @ApiOperation(value = "轮播图新增")
-    public Result add(@RequestBody Banner banner) {
-        if (banner == null) {
-            return Result.fail(ResultCode.OBJECT_IS_NULL);
-        }
-        try {
-            banner.setCreateTime(new Date());
-//            banner.setCreateUserId(userId);
-            bannerService.save(banner);
-        } catch (Exception e) {
-            log.error("新增对象操作异常e:{}", e);
-            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-        }
-        return Result.success();
-    }
-
-    @DeleteMapping("/delete")
-    @ApiOperation(value = "轮播图删除")
-    public Result delete(@RequestParam Long id) {
-        if (id == null) {
-            return Result.fail(ResultCode.ID_IS_NULL);
-        }
-        try {
-            Banner banner = new Banner();
-            banner.setId(id);
-            banner.setIsDelete(1);
-            bannerService.update(banner);
-        } catch (Exception e) {
-            log.error("删除对象操作异常e:{}", e);
-            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-        }
-        return Result.success();
-    }
-
-    @PutMapping("/update")
-    @ApiOperation(value = "轮播图更新")
-    public Result update(@RequestBody Banner banner) {
-        if (banner == null) {
-            return Result.fail(ResultCode.OBJECT_IS_NULL);
-        }
-        if (banner.getId() == null) {
-            return Result.fail(ResultCode.ID_IS_NULL);
-        }
-        try {
-            banner.setUpdateTime(new Date());
-//            banner.setUpdateUserId(userId);
-            bannerService.update(banner);
-        } catch (Exception e) {
-            log.error("更新对象操作异常e:{}", e);
-            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-        }
-        return Result.success();
-    }
+//    @PostMapping("/add")
+//    @ApiOperation(value = "轮播图新增")
+//    public Result add(@RequestBody Banner banner) {
+//        if (banner == null) {
+//            return Result.fail(ResultCode.OBJECT_IS_NULL);
+//        }
+//        try {
+//            banner.setCreateTime(new Date());
+////            banner.setCreateUserId(userId);
+//            bannerService.save(banner);
+//        } catch (Exception e) {
+//            log.error("新增对象操作异常e:{}", e);
+//            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+//        }
+//        return Result.success();
+//    }
+//
+//    @DeleteMapping("/delete")
+//    @ApiOperation(value = "轮播图删除")
+//    public Result delete(@RequestParam Long id) {
+//        if (id == null) {
+//            return Result.fail(ResultCode.ID_IS_NULL);
+//        }
+//        try {
+//            Banner banner = new Banner();
+//            banner.setId(id);
+//            banner.setIsDelete(1);
+//            bannerService.update(banner);
+//        } catch (Exception e) {
+//            log.error("删除对象操作异常e:{}", e);
+//            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+//        }
+//        return Result.success();
+//    }
+//
+//    @PutMapping("/update")
+//    @ApiOperation(value = "轮播图更新")
+//    public Result update(@RequestBody Banner banner) {
+//        if (banner == null) {
+//            return Result.fail(ResultCode.OBJECT_IS_NULL);
+//        }
+//        if (banner.getId() == null) {
+//            return Result.fail(ResultCode.ID_IS_NULL);
+//        }
+//        try {
+//            banner.setUpdateTime(new Date());
+////            banner.setUpdateUserId(userId);
+//            bannerService.update(banner);
+//        } catch (Exception e) {
+//            log.error("更新对象操作异常e:{}", e);
+//            return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+//        }
+//        return Result.success();
+//    }
 
     @GetMapping("/detail")
     @ApiOperation(value = "轮播图获取详情")

+ 256 - 0
mall-service/src/main/java/com/txz/mall/controller/appcontroller/MidFavoriteController.java

@@ -0,0 +1,256 @@
+package com.txz.mall.controller.appcontroller;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.txz.mall.core.AuthService;
+import com.txz.mall.core.Result;
+import com.txz.mall.core.ServiceException;
+import com.txz.mall.dto.MidFavoriteDTO;
+import com.txz.mall.model.MidFavorite;
+import com.txz.mall.model.StoreCombination;
+import com.txz.mall.model.StoreProduct;
+import com.txz.mall.service.MidFavoriteService;
+
+import com.txz.mall.core.ResultCode;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.txz.mall.service.StoreCombinationService;
+import com.txz.mall.service.StoreProductService;
+import com.txz.mall.util.EasyToUseUtil;
+import com.txz.mall.web.bo.MidFavoriteBO;
+import com.txz.mall.web.param.BasePageParam;
+import com.txz.mall.web.param.MidFavoriteParam;
+import com.txz.mall.web.param.TopLevelEntity;
+import com.txz.mall.web.param.addparam.MidFavoriteAddParam;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import tk.mybatis.mapper.entity.Condition;
+import tk.mybatis.mapper.entity.Example.Criteria;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+* Created by CodeGenerator on 2025/08/13.
+*/
+@Api(tags = "[后台]midFavorite管理")
+@RestController
+@RequestMapping("/mid/favorite")
+public class MidFavoriteController {
+
+	private static Logger log = LoggerFactory.getLogger(MidFavoriteController.class);
+
+    @Resource
+    private MidFavoriteService midFavoriteService;
+	@Resource
+	private StoreCombinationService  storeCombinationService;
+
+	@Resource
+	private StoreProductService storeProductService;
+
+    @PostMapping("/add")
+	@ApiOperation(value = "midFavorite新增")
+	public Result add(@RequestBody MidFavoriteAddParam midFavoriteAddParam) {
+    	if(ObjectUtils.isEmpty(midFavoriteAddParam)){
+    		return Result.fail(ResultCode.OBJECT_IS_NULL);
+    	}
+
+		if(CollectionUtils.isEmpty(midFavoriteAddParam.getProductIdList())){
+			return Result.fail(ResultCode.OBJECT_IS_NULL);
+		}
+
+		Condition condition3 = new Condition(StoreCombination.class);
+		Criteria criteria3 = condition3.createCriteria();
+		criteria3.andEqualTo("isDelete", 0);
+		criteria3.andIn("id",midFavoriteAddParam.getProductIdList());
+
+		Map<Long, StoreProduct> productId_StoreProduct= new HashMap<>();
+		List<StoreProduct> storeProductList = storeProductService.findByCondition(condition3);
+		if(CollectionUtils.isEmpty(storeProductList)){
+			throw new ServiceException("商品id不存在");
+		}
+		Long tokenUserId = AuthService.getTokenUserId(null);
+		Condition condition = new Condition(MidFavorite.class);
+		Criteria criteria = condition.createCriteria();
+		criteria.andEqualTo("isValid", 1);
+		criteria.andEqualTo("userId",tokenUserId);
+		criteria.andIn("productId",midFavoriteAddParam.getProductIdList());
+
+		List<MidFavorite> list = midFavoriteService.findByCondition(condition);
+		if(!CollectionUtils.isEmpty(list)){
+			throw new ServiceException("重复收藏同样的商品");
+		}
+		List<MidFavorite> midFavoriteList = new ArrayList<>();
+
+		List<Long> productIdList = midFavoriteAddParam.getProductIdList();
+		for (Long l : productIdList) {
+			MidFavorite midFavorite = new MidFavorite();
+			EasyToUseUtil.appCreateAssignment(midFavorite);
+			midFavorite.setProductId(l);
+			midFavoriteList.add(midFavorite);
+		}
+
+    	try {
+    		midFavoriteService.save(midFavoriteList);
+		} catch (Exception e) {
+			log.error("新增对象midFavorite操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success();
+    }
+
+    @DeleteMapping("/delete")
+	@ApiOperation(value = "midFavorite删除")
+	public Result delete(@RequestParam Long id) {
+    	if(id == null){
+    		return Result.fail(ResultCode.ID_IS_NULL);
+    	}
+
+    	try {
+            MidFavorite midFavorite = new MidFavorite();
+			EasyToUseUtil.appDeleteAssignment(midFavorite);
+			midFavorite.setId(id);
+			midFavoriteService.update(midFavorite);
+		} catch (Exception e) {
+			log.error("midFavorite删除对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success();
+    }
+
+//    @PutMapping("/update")
+//	@ApiOperation(value = "midFavorite更新")
+//	public Result update(@RequestBody MidFavorite midFavorite) {
+//    	if(midFavorite == null){
+//    		return Result.fail(ResultCode.OBJECT_IS_NULL);
+//    	}
+//    	if(midFavorite.getId() == null){
+//    		return Result.fail(ResultCode.ID_IS_NULL);
+//    	}
+//    	try {
+//    		midFavorite.setUpdateTime(new Date());
+////            midFavorite.setUpdateUserId(userId);
+//    		midFavoriteService.update(midFavorite);
+//		} catch (Exception e) {
+//			log.error("更新对象操作异常e:{}",e);
+//			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+//		}
+//        return Result.success();
+//    }
+
+//    @GetMapping("/detail")
+//	@ApiOperation(value = "midFavorite获取详情")
+//	public Result<MidFavorite> detail(@RequestParam Long id) {
+//    	if(id == null){
+//    		return Result.fail(ResultCode.ID_IS_NULL);
+//    	}
+//    	MidFavorite midFavorite = null;
+//    	try {
+//    		midFavorite = midFavoriteService.findById(id);
+//		} catch (Exception e) {
+//			log.error("查询对象操作异常e:{}",e);
+//			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+//		}
+//        return Result.success(midFavorite);
+//    }
+
+
+
+    @PostMapping("/list")
+	@ApiOperation(value = "midFavorite获取列表")
+	public Result list(@RequestBody MidFavoriteParam midFavoriteParam) {
+
+		Long tokenUserId = AuthService.getTokenUserId(null);
+        PageHelper.startPage(midFavoriteParam.getPage(), midFavoriteParam.getSize());
+
+
+        Condition condition = new Condition(MidFavorite.class);
+        Criteria criteria = condition.createCriteria();
+		criteria.andEqualTo("isValid", 1);
+		criteria.andEqualTo("userId",tokenUserId);
+		condition.setOrderByClause("create_time DESC");
+
+
+
+
+		PageInfo pageInfo = null;
+		try {
+    		 List<MidFavorite> list = midFavoriteService.findByCondition(condition);
+
+			 if(!CollectionUtils.isEmpty(list)){
+
+				 List<Long> productIdList = list.stream().map(MidFavorite::getProductId).collect(Collectors.toList());
+
+				 Condition condition2 = new Condition(StoreCombination.class);
+				 Criteria criteria2 = condition2.createCriteria();
+				 criteria2.andEqualTo("isDelete", 0);
+				 criteria2.andIn("productId",productIdList);
+				 List<StoreCombination> byCondition = storeCombinationService.findByCondition(condition2);
+
+
+				 Condition condition3 = new Condition(StoreCombination.class);
+				 Criteria criteria3 = condition3.createCriteria();
+				 criteria3.andEqualTo("isDelete", 0);
+				 criteria3.andIn("id",productIdList);
+
+				 Map<Long, StoreProduct> productId_StoreProduct= new HashMap<>();
+				 List<StoreProduct> storeProductList = storeProductService.findByCondition(condition3);
+				 if(!CollectionUtils.isEmpty(storeProductList)){
+
+					 productId_StoreProduct = storeProductList.stream().collect(Collectors.toMap(StoreProduct::getId, a -> a, (b, c) -> c));
+				 }
+
+
+
+				 if(!CollectionUtils.isEmpty(byCondition)){
+					 Map<Long, StoreCombination> productIdMap = byCondition.stream().collect(Collectors.toMap(StoreCombination::getProductId, a -> a, (c, d) -> d));
+					 Map<Long, StoreProduct> finalProductId_StoreProduct = productId_StoreProduct;
+					 List<MidFavoriteBO> resultList = list.stream().map(a -> {
+
+						 MidFavoriteBO bean = new MidFavoriteBO();
+						 bean.setId(a.getId());
+						 bean.setProductId(a.getProductId());
+						 StoreProduct storeProduct = finalProductId_StoreProduct.get(bean.getProductId());
+						 StoreCombination storeCombination = productIdMap.get(bean.getProductId());
+						 if(!ObjectUtils.isEmpty(storeCombination)){
+							 bean.setCId(storeCombination.getId());
+							 bean.setPrice(storeCombination.getPrice());
+							 bean.setSales(storeCombination.getSales());
+							 bean.setImage(storeCombination.getImage());
+							 bean.setStoreName(storeCombination.getProductName());
+						 }else if(!ObjectUtils.isEmpty(storeProduct)){
+							 bean.setImage(storeProduct.getImage());
+							 bean.setStoreName(storeProduct.getStoreName());
+						 }
+
+						 return bean;
+					 }).collect(Collectors.toList());
+					 pageInfo = new PageInfo(resultList);
+				 }
+
+			 }
+
+
+		} catch (Exception e) {
+			log.error("查询对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success(pageInfo);
+    }
+}

+ 3 - 3
mall-service/src/main/java/com/txz/mall/model/MidFavorite.java

@@ -54,7 +54,7 @@ public class MidFavorite {
     /**
      * 版本号
      */
-    private String version;
+    private Integer version;
 
     /**
      * @return id
@@ -201,7 +201,7 @@ public class MidFavorite {
      *
      * @return version - 版本号
      */
-    public String getVersion() {
+    public Integer getVersion() {
         return version;
     }
 
@@ -210,7 +210,7 @@ public class MidFavorite {
      *
      * @param version 版本号
      */
-    public void setVersion(String version) {
+    public void setVersion(Integer version) {
         this.version = version;
     }
 }

+ 96 - 0
mall-service/src/main/java/com/txz/mall/util/EasyToUseUtil.java

@@ -0,0 +1,96 @@
+package com.txz.mall.util;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.txz.cif.dto.UserDTO;
+import com.txz.mall.core.AuthService;
+import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
+import com.txz.mall.model.MidFavorite;
+import com.txz.mall.web.param.TopLevelEntity;
+import org.apache.poi.ss.formula.functions.T;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.util.Date;
+@Component
+public class EasyToUseUtil {
+    private static Logger log = LoggerFactory.getLogger(EasyToUseUtil.class);
+    @Resource
+    private  CifUserDubboServiceClient cifUserDubboServiceClient;
+
+    // 2. 定义静态变量,用于静态方法中引用
+    private static EasyToUseUtil instance;
+
+    // 3. 私有化构造器,防止被实例化
+    private EasyToUseUtil() {}
+
+    // 4. 初始化时将实例赋值给静态变量,使静态方法能访问注入的资源
+    @PostConstruct
+    public void init() {
+        instance = this;
+    }
+
+    public static <T> void  appCreateAssignment(Date date, T t){
+        TopLevelEntity topLevelEntity = new TopLevelEntity();
+
+        UserDTO user = new UserDTO();
+        user.setName("Operation");
+        Long tokenUserId = AuthService.getTokenUserId(null);
+        if(!ObjectUtils.isEmpty(tokenUserId)){
+            try{
+                user = instance.cifUserDubboServiceClient.getUser(tokenUserId);
+            }catch (Exception e){
+                log.error("Failed to get user from cifUserDubboServiceClient ,tokenUserId:{}", tokenUserId, e);
+            }
+
+        }
+        Byte b = 1;
+        topLevelEntity.setIsValid(b);
+        topLevelEntity.setVersion(1);
+        topLevelEntity.setCreateTime(date);
+        topLevelEntity.setUpdateTime(date);
+        topLevelEntity.setCreateUser(user.getName());
+        topLevelEntity.setUpdateUser(user.getName());
+        topLevelEntity.setUserId(tokenUserId);
+        BeanUtils.copyProperties(topLevelEntity,t);
+
+    }
+
+    public static <T> void  appCreateAssignment( T t){
+        DateTime date = DateUtil.date();
+        appCreateAssignment(date, t);
+    }
+
+
+    public static <T> void  appDeleteAssignment(Date date, T t){
+        TopLevelEntity topLevelEntity = new TopLevelEntity();
+
+        UserDTO user = new UserDTO();
+        user.setName("Operation");
+        Long tokenUserId = AuthService.getTokenUserId(null);
+        if(!ObjectUtils.isEmpty(tokenUserId)){
+            try{
+                user = instance.cifUserDubboServiceClient.getUser(tokenUserId);
+            }catch (Exception e){
+                log.error("Failed to get user from cifUserDubboServiceClient ,tokenUserId:{}", tokenUserId, e);
+            }
+
+        }
+        Byte b = 0;
+        topLevelEntity.setIsValid(b);
+        topLevelEntity.setUpdateTime(date);
+        topLevelEntity.setUpdateUser(user.getName());
+        BeanUtils.copyProperties(topLevelEntity,t);
+
+    }
+    public static <T> void  appDeleteAssignment(T t){
+        DateTime date = DateUtil.date();
+        appDeleteAssignment(date, t);
+    }
+
+}

+ 39 - 0
mall-service/src/main/java/com/txz/mall/web/bo/MidFavoriteBO.java

@@ -0,0 +1,39 @@
+package com.txz.mall.web.bo;
+
+import com.tencentcloudapi.iot.v20180123.models.Product;
+import com.txz.mall.model.StoreProduct;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@ApiModel(value="我收藏的商品")
+public class MidFavoriteBO  {
+
+       private Long id;
+
+       @ApiModelProperty(value = "商品id")
+       private Long productId;
+
+       @ApiModelProperty(value = "商品主图")
+       private String image;
+
+       @ApiModelProperty(value = "商品名称")
+       private String storeName;
+
+       @ApiModelProperty(value = "拼团商品价格")
+       private BigDecimal price;
+
+       @ApiModelProperty(value = "拼团商品id")
+       private Long cId;
+
+       @ApiModelProperty(value = "销量")
+       private Integer sales;
+
+}

+ 0 - 130
mall-service/src/main/java/com/txz/mall/web/mng/MidFavoriteController.java

@@ -1,130 +0,0 @@
-package com.txz.mall.web.mng;
-import com.txz.mall.core.Result;
-import com.txz.mall.model.MidFavorite;
-import com.txz.mall.service.MidFavoriteService;
-
-import com.txz.mall.core.ResultCode;
-
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import tk.mybatis.mapper.entity.Condition;
-import tk.mybatis.mapper.entity.Example.Criteria;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Date;
-
-/**
-* Created by CodeGenerator on 2025/08/13.
-*/
-@Api(tags = "[后台]midFavorite管理")
-@RestController
-@RequestMapping("/mid/favorite")
-public class MidFavoriteController {
-
-	private static Logger log = LoggerFactory.getLogger(MidFavoriteController.class);
-
-    @Resource
-    private MidFavoriteService midFavoriteService;
-
-    @PostMapping("/add")
-	@ApiOperation(value = "midFavorite新增")
-	public Result add(@RequestBody MidFavorite midFavorite) {
-    	if(midFavorite == null){
-    		return Result.fail(ResultCode.OBJECT_IS_NULL);
-    	}
-    	try {
-    		midFavorite.setCreateTime(new Date());
-//            midFavorite.setCreateUserId(userId);
-    		midFavoriteService.save(midFavorite);
-		} catch (Exception e) {
-			log.error("新增对象操作异常e:{}",e);
-			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-		}
-        return Result.success();
-    }
-
-    @DeleteMapping("/delete")
-	@ApiOperation(value = "midFavorite删除")
-	public Result delete(@RequestParam Long id) {
-    	if(id == null){
-    		return Result.fail(ResultCode.ID_IS_NULL);
-    	}
-    	try {
-            MidFavorite midFavorite = new MidFavorite();
-			midFavorite.setId(id);
-			midFavorite.setIsDelete(1);
-			midFavoriteService.update(midFavorite);
-		} catch (Exception e) {
-			log.error("删除对象操作异常e:{}",e);
-			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-		}
-        return Result.success();
-    }
-
-    @PutMapping("/update")
-	@ApiOperation(value = "midFavorite更新")
-	public Result update(@RequestBody MidFavorite midFavorite) {
-    	if(midFavorite == null){
-    		return Result.fail(ResultCode.OBJECT_IS_NULL);
-    	}
-    	if(midFavorite.getId() == null){
-    		return Result.fail(ResultCode.ID_IS_NULL);
-    	}
-    	try {
-    		midFavorite.setUpdateTime(new Date());
-//            midFavorite.setUpdateUserId(userId);
-    		midFavoriteService.update(midFavorite);
-		} catch (Exception e) {
-			log.error("更新对象操作异常e:{}",e);
-			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-		}
-        return Result.success();
-    }
-
-    @GetMapping("/detail")
-	@ApiOperation(value = "midFavorite获取详情")
-	public Result<MidFavorite> detail(@RequestParam Long id) {
-    	if(id == null){
-    		return Result.fail(ResultCode.ID_IS_NULL);
-    	}
-    	MidFavorite midFavorite = null;
-    	try {
-    		midFavorite = midFavoriteService.findById(id);
-		} catch (Exception e) {
-			log.error("查询对象操作异常e:{}",e);
-			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-		}
-        return Result.success(midFavorite);
-    }
-
-    @PostMapping("/list")
-	@ApiOperation(value = "midFavorite获取列表")
-	public Result<List<MidFavorite>> list(@Validated @RequestBody MidFavoriteDTO dto) {
-        PageHelper.startPage(dto.getPage(), dto.getSize());
-
-        Condition condition = new Condition(MidFavorite.class);
-        Criteria criteria = condition.createCriteria();
-		criteria.andEqualTo("isDelete", 0);
-		condition.setOrderByClause("create_time DESC");
-		PageInfo pageInfo = null;
-		try {
-    		 List<MidFavorite> list = midFavoriteService.findByCondition(condition);
-    		 pageInfo = new PageInfo(list);
-		} catch (Exception e) {
-			log.error("查询对象操作异常e:{}",e);
-			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
-		}
-        return Result.success(pageInfo);
-    }
-}

+ 0 - 1
mall-service/src/main/java/com/txz/mall/web/param/BasePageParam.java

@@ -11,7 +11,6 @@ import javax.validation.constraints.Min;
 import java.io.Serializable;
 
 @Data
-@ApiModel("分页查询参数")
 @NoArgsConstructor
 public class BasePageParam implements Serializable {
 

+ 13 - 0
mall-service/src/main/java/com/txz/mall/web/param/MidFavoriteParam.java

@@ -0,0 +1,13 @@
+package com.txz.mall.web.param;
+
+
+import lombok.NoArgsConstructor;
+
+
+@NoArgsConstructor
+public class MidFavoriteParam extends BasePageParam {
+
+
+
+
+}

+ 44 - 0
mall-service/src/main/java/com/txz/mall/web/param/TopLevelEntity.java

@@ -0,0 +1,44 @@
+package com.txz.mall.web.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class TopLevelEntity implements Serializable {
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 删除标识 1是0否
+     */
+    private Byte isValid;
+
+    /**
+     * 版本号
+     */
+    private Integer version;
+
+
+    private Long userId;
+
+}

+ 16 - 0
mall-service/src/main/java/com/txz/mall/web/param/addparam/MidFavoriteAddParam.java

@@ -0,0 +1,16 @@
+package com.txz.mall.web.param.addparam;
+
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MidFavoriteAddParam {
+
+    @ApiModelProperty(value = "产品id列表")
+    private List<Long> productIdList;
+
+
+}

+ 1 - 1
mall-service/src/test/java/CodeGenerator.java

@@ -47,7 +47,7 @@ public class CodeGenerator {
 	public static void main(String[] args) {
 //		genCode("o_lottery","o_lottery_prize","o_lottery_record");
 		// genCode("输入表名","输入自定义Model名称");
-		genCode("m_banner");
+		genCode("m_mid_favorite");
 		//genCode("c_member_coupon");
 	}
 

+ 2 - 2
mall-service/src/test/resources/generator/template/controller.ftl

@@ -54,7 +54,7 @@ public class ${modelNameUpperCamel}Controller {
         return Result.success();
     }
 
-    @GetMapping("/delete")
+    @DeleteMapping("/delete")
 	@ApiOperation(value = "${modelNameLowerCamel}删除")
 	public Result delete(@RequestParam Long id) {
     	if(id == null){
@@ -72,7 +72,7 @@ public class ${modelNameUpperCamel}Controller {
         return Result.success();
     }
 
-    @PostMapping("/update")
+    @PutMapping("/update")
 	@ApiOperation(value = "${modelNameLowerCamel}更新")
 	public Result update(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel}) {
     	if(${modelNameLowerCamel} == null){