随手记录问题

传参
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id, HttpServletRequest request) {
return productInfoService.selectProductInfoPortalById(id,request);
}
前台
productInfoDetail(this.id,loginType).then((res) => {
this.form = res.data;
this.mainImg = this.form.lbFiles[0].filePath;
// this.form.contactNumber = this.form.contactNumber.substr(0,3)+"****"+ this.form.contactNumber.substr(7)
this.inproductInfoList();
});
export function productInfoDetail(id,loginType) {
return request({
url: '/portal/productInfo/' + id + "?loginType=" +loginType,
method: 'get'
})
}




//vue 删除数组对象
let deptOptionsInsert = response.data;
let id = deptOptionsInsert[0].children.findIndex(item => {
if (item.id == '33110') {
return true
}
})
deptOptionsInsert[0].children.splice(id, 1)
this.deptOptionsInsert = deptOptionsInsert;


elment cascader 级联去除圆圈点击文字选中

<el-col :span="5">
<el-form-item label="地区">
<el-cascader
size="small"
clearable
style="width: 100%"
:props="{ checkStrictly: true }"
v-model="queryParams.regines"
:options="options"
popper-class="theder" //重点是引用这个class属性 隐藏并加宽
ref="cascaderAddr"
@active-item-change="handleItemChange"
></el-cascader
>
</el-form-item>
</el-col>
.theder{
.el-cascader-panel{
.el-cascader-menu{
.el-radio{
height: 100%;
width: 150px;
opacity: 0;
position: absolute;
// z-index: 10;
.el-radio__input{
.el-radio__inner{
border: 0px;
}
}
.el-radio__input.is-checked{
.el-radio__inner{
background: none;
}
}
}
}
}
}

效验单个组件输入
  checkPhone(rule, value, callback) {
                if (value) {
                    let phone = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
                    if (!phone.test(value)) {
                        
                        callback(new Error('请输入正确的手机号码'));
                    } else {
                        callback();
                    }
                }
                callback();
            },

 java字符串按照逗号转成数组

List<String> attachNameList = Arrays.stream(attachName.split(",")).collect(Collectors.toList());

 正则

包含0的正整数
  /^[0-9]\d*$/
正整数限1位小数
/(^[1-9]([0-9]{0,0})?(\.[0-9]{1})?$)|(^(1){1}$)|(^[0-9]\.[1-9]{1}?$)/
五位整数,最多保留二位小数
/(^[1-9]([0-9]{1,5})?(\.[0-9]{1,2})?$)|(^(1){1}$)|(^[0-9]\.[1-9]([1-9])?$)/

 mybaits-puls拼接sql

 1    //拼接sql
 2         StringBuffer applySql = new StringBuffer();
 3         //多选类型
 4         List<String> types = checkTemplateReq.getTypes();
 5         //mysql逗号函数查询 拼接sql
 6         if (!CollectionUtils.isEmpty(types)){
 7             for (int i = 0; i< types.size();i++){
 8                 if (i == 0 ){
 9                     applySql.append("(find_in_set("+types.get(i)+", type)");
10                 }else if (i != 0){
11                     applySql.append(" or find_in_set("+types.get(i)+", type)");
12                 }
13             }
14             applySql.append(")");
15             wrapper.apply(applySql.toString());
16         }
17 
18 find_in_set("1", type) mysql按照逗号分割查询 多个用or

 优化批量新增(plus的运行时间是并发流二倍)

        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        List<Test1> testList = new ArrayList<Test1>();
        for (int i = 0; i < 5000; i++) {
            Test1 test = new Test1();
            test.setName(String.valueOf(i));
            testList.add(test);
        }
        List<List<Test1>> split = ListUtil.split(testList, 1000);
        split.stream().parallel().forEach(test1Mapper::saveBatch);
//        test1Mapper.saveBatch(testList);
        stopWatch.stop();
System.out.println(String.format("Total time:%d ms", stopWatch.getTime()));

 for循环时定义index,index.getAndIncrement每次+1

AtomicInteger index = new AtomicInteger(1);
  list.stream().forEach(
                    e ->{
                        TestSupportUnitExport export = new TestSupportUnitExport();
                        export.setSerialNumber(index.getAndIncrement());
                        BeanUtils.copyProperties(e,export);
                        export.setScale(EnterpriseScaleEnum.getCodeByMsg(e.getScale()));
                        export.setSecretRelMeghan(CheckConfidentEnum.getCodeByMsg(e.getSecretRelMeghan()));
                        exportList.add(export);
                    }
            );

 

posted @ 2022-06-13 10:50  呆Finn  阅读(30)  评论(0编辑  收藏  举报