Mall属性管理第三天

本文探讨了前端开发中的几个关键点:子组件如何向父组件传递点击事件,级联选择器在处理递归数据时的注意事项,分页插件的使用,以及在大量数据场景下如何进行异步查询和事务操作,包括批量删除的实现。
摘要由CSDN通过智能技术生成

子组件向父组件发送点击事件

 //向父组件发送事件;
      this.$emit("tree-node-click", data, node, component);
    }

级联选择器 :如果递归底层没有数据返回,

private Integer productCount;
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
	private List<CategoryEntity> children;

<el-form-item label="所属分类" prop="catelogId">
        <!-- <el-input v-model="dataForm.catelogId" placeholder="所属分类id"></el-input> @change="handleChange" -->
        <!-- <el-cascader filterable placeholder="试试搜索:手机" v-model="catelogPath" :options="categorys"  :props="props"></el-cascader> -->
        <!-- :catelogPath="catelogPath"自定义绑定的属性,可以给子组件传值 -->
        <category-cascader :catelogPath.sync="catelogPath"></category-cascader>
      </el-form-item>

分页插件

@Configuration
@EnableTransactionManagement //开启事务
@MapperScan("com.atguigu.gulimall.product.dao")
public class MyBatisConfig {

    //引入分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求  默认false
        paginationInterceptor.setOverflow(true);
        // 设置最大单页限制数量,默认 500 条,-1 不受限制
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}

 public PageUtils queryPage(Map<String, Object> params) {
        String  key = (String) params.get("key");
         QueryWrapper<BrandEntity> queryWrapper = new QueryWrapper<>();
         if(!StringUtils.isEmpty(key)){
             queryWrapper.eq("brand_id",key).or().like("name",key);
         }
        IPage<BrandEntity> page = this.page(new Query<BrandEntity>().getPage(params), queryWrapper
        );

        return new PageUtils(page);
    }

更新几张数据

 1.数据量大的时候,尽量冗余,不要关联,异步查询

2.添加事务

 

@EnableTransactionManagement //开启事务:在分页配置中
@Transactional,:在serviceimpl中

批量删除 

   <delete id="delteBatchRelation">
    delete from `pms_attr_attrgroup_relation` where
    <foreach collection="entities" item="item" separator=" or ">
        (attr_id=#{item.attrId} and attr_group_id=#{item.attrGroupId})
    </foreach>

    </delete>

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值