This commit is contained in:
wangjinlei
2024-11-22 17:30:04 +08:00
parent 31a02d6f79
commit d17dca9497
5 changed files with 33 additions and 6 deletions

View File

@@ -26,7 +26,8 @@ import java.util.Map;
@Slf4j
@RestController("masterCourse")
@RequestMapping("master/course")
public class CourseController {
public class
CourseController {
@Autowired
private CourseService courseService;

View File

@@ -7,10 +7,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
import java.util.Map;
@Slf4j
@RestController("masterMainAdController")
@@ -27,8 +27,8 @@ public class MainAdController {
}
@RequestMapping("/getMainAdDetail")
public R getMainAdDetail(@RequestParam Integer id){
MainAdEntity mainAdDetail = mainAdService.getMainAdDetail(id);
public R getMainAdDetail(@RequestBody Map<String,Integer> map){
MainAdEntity mainAdDetail = mainAdService.getMainAdDetail(map.get("id"));
return R.ok().put("detail",mainAdDetail);
}
@@ -39,8 +39,8 @@ public class MainAdController {
}
@RequestMapping("/delMainAd")
public R delMainAd(@RequestParam Integer id){
mainAdService.getBaseMapper().deleteById(id);
public R delMainAd(@RequestBody Map<String,Integer> map){
mainAdService.getBaseMapper().deleteById(map.get("id"));
return R.ok();
}

View File

@@ -210,4 +210,10 @@ public class ShopProductController {
return shopProductService.unbindProductAndCourse(map.get("productId"),map.get("catalogueId"));
}
@RequestMapping("/getProductForApp")
public R getProductForApp(@RequestBody Map<String,Object> map){
Page<ShopProduct> productForApp = shopProductService.getProductForApp(Integer.valueOf(map.get("type").toString()), Integer.valueOf(map.get("page").toString()), Integer.valueOf(map.get("limit").toString()),map.get("keywords").toString());
return R.ok().put("page",productForApp);
}
}

View File

@@ -57,5 +57,7 @@ public interface ShopProductService extends IService<ShopProduct> {
R unbindProductAndCourse(int productId,int catalogueId);
Page<ShopProduct> getProductForApp(int type,int page,int limit,String keywords);
R delShopProduct(int productId);
}

View File

@@ -300,6 +300,24 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
return R.ok();
}
@Override
public Page<ShopProduct> getProductForApp(int type, int page, int limit,String keywords) {
String sql = "";
if(type==0){//疯子读书
sql = "select * from shop_product_to_book_market where product_id = shop_product.product_id";
} else if (type==1) {//吴门医述
sql = "select * from shop_product_to_medicine_market where product_id = shop_product.product_id";
}else{
sql = "select * from shop_product_to_sociology_market where product_id = shop_product.product_id";
}
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper<>();
wrapper.exists(sql);
wrapper.like(StringUtils.isNotBlank(keywords),ShopProduct::getProductName,keywords);
Page<ShopProduct> shopProductPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
return shopProductPage;
}
@Override
public Map<String, Object> getProductToLabel(Integer productId) {
HashMap<String, Object> flag = new HashMap<>();