parent
32abbd5ad5
commit
561024a571
@ -0,0 +1,32 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
|
||||
//添加品牌关联
|
||||
export function addCategoryBrandRelation(data) {
|
||||
return request({
|
||||
url: '/mall-product/product/categorybrandrelation/save',
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//删除品牌关联
|
||||
export function delCategoryBrandRelation(ids) {
|
||||
return request({
|
||||
url: '/mall-product/product/categorybrandrelation/delete',
|
||||
method: 'delete',
|
||||
data:ids
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//获取品牌关联
|
||||
export function categoryBrandRelationList(data) {
|
||||
return request({
|
||||
url: '/mall-product/product/categorybrandrelation/catelog/list',
|
||||
method: 'get',
|
||||
params:data
|
||||
})
|
||||
}
|
||||
|
@ -1,20 +1,36 @@
|
||||
package com.xjs.mall.product.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjs.utils.PageUtils;
|
||||
import com.xjs.mall.product.entity.CategoryBrandRelationEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 品牌分类关联
|
||||
*
|
||||
* @author xiejs
|
||||
* @email 1294405880@qq.com
|
||||
* @date 2022-03-15 10:16:53
|
||||
* @since 2022-03-15 10:16:53
|
||||
*/
|
||||
public interface CategoryBrandRelationService extends IService<CategoryBrandRelationEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 保存详情
|
||||
* @param categoryBrandRelation entity
|
||||
*/
|
||||
void saveDetail(CategoryBrandRelationEntity categoryBrandRelation);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param brandId 品牌id
|
||||
* @param name 品牌名称
|
||||
*/
|
||||
void updateBrand(Long brandId, String name);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param catId 分类id
|
||||
* @param name 分类名称
|
||||
*/
|
||||
void updateCategory(Long catId, String name);
|
||||
}
|
||||
|
||||
|
@ -1,29 +1,62 @@
|
||||
package com.xjs.mall.product.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjs.utils.PageUtils;
|
||||
import com.xjs.utils.Query;
|
||||
|
||||
import com.xjs.mall.product.dao.BrandDao;
|
||||
import com.xjs.mall.product.dao.CategoryBrandRelationDao;
|
||||
import com.xjs.mall.product.dao.CategoryDao;
|
||||
import com.xjs.mall.product.entity.BrandEntity;
|
||||
import com.xjs.mall.product.entity.CategoryBrandRelationEntity;
|
||||
import com.xjs.mall.product.entity.CategoryEntity;
|
||||
import com.xjs.mall.product.service.CategoryBrandRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Service("categoryBrandRelationService")
|
||||
@Transactional
|
||||
public class CategoryBrandRelationServiceImpl extends ServiceImpl<CategoryBrandRelationDao, CategoryBrandRelationEntity> implements CategoryBrandRelationService {
|
||||
|
||||
@Resource
|
||||
private BrandDao brandDao;
|
||||
|
||||
@Resource
|
||||
private CategoryDao categoryDao;
|
||||
|
||||
|
||||
@Override
|
||||
public void saveDetail(CategoryBrandRelationEntity categoryBrandRelation) {
|
||||
Long brandId = categoryBrandRelation.getBrandId();
|
||||
Long catelogId = categoryBrandRelation.getCatelogId();
|
||||
|
||||
BrandEntity brandEntity = brandDao.selectById(brandId);
|
||||
CategoryEntity categoryEntity = categoryDao.selectById(catelogId);
|
||||
|
||||
categoryBrandRelation.setBrandName(brandEntity.getName());
|
||||
categoryBrandRelation.setCatelogName(categoryEntity.getName());
|
||||
|
||||
super.save(categoryBrandRelation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<CategoryBrandRelationEntity> page = this.page(
|
||||
new Query<CategoryBrandRelationEntity>().getPage(params),
|
||||
new QueryWrapper<CategoryBrandRelationEntity>()
|
||||
);
|
||||
public void updateBrand(Long brandId, String name) {
|
||||
CategoryBrandRelationEntity entity = new CategoryBrandRelationEntity();
|
||||
entity.setBrandId(brandId);
|
||||
entity.setBrandName(name);
|
||||
|
||||
return new PageUtils(page);
|
||||
super.update(entity, new LambdaUpdateWrapper<CategoryBrandRelationEntity>()
|
||||
.eq(CategoryBrandRelationEntity::getBrandId, brandId));
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void updateCategory(Long catId, String name) {
|
||||
CategoryBrandRelationEntity entity = new CategoryBrandRelationEntity();
|
||||
entity.setCatelogId(catId);
|
||||
entity.setCatelogName(name);
|
||||
|
||||
super.update(entity, new LambdaUpdateWrapper<CategoryBrandRelationEntity>()
|
||||
.eq(CategoryBrandRelationEntity::getCatelogId, catId));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue