mybatisplus中update用法

@Override
    public boolean updateRiskverificationFlag(String acptracctName) {
        BmsBillRiskverification bbr = new BmsBillRiskverification();
        bbr.setWarnflag("1");
        bbr.setUpdateBy("job");
        int num = billRiskverificationMapper.update(bbr, new QueryWrapper<BmsBillRiskverification>().eq("ACPTRACCT_NAME", acptracctName).eq("WARNFLAG", "0"));
        if (num == 0) {
            return false;
        } else {
            return true;
        }
    }
//以上sql执行为
update bms_bill_riskverification set warnflag = '1',update_by = 'job' where
ACPTRACCT_NAME = 'zhangsan' and warnflag = '0';

 QueryWrapper in条件用法

 @Override
    public boolean updateWaitSignWarnFlag(String acptracctName) {
        BusBillWaitsign bw = new BusBillWaitsign();
        bw.setWarnflag("1");
        bw.setUpdateBy("job");
        List<String> list = new ArrayList<>();
        list.add("0");
        list.add("2");
        int num = billWaitsignMapper.update(bw,new QueryWrapper<BusBillWaitsign>()
                .eq("ACPTRACCT_NAME",acptracctName)
                .eq("BILLTYPE","2")
                .eq("WARNFLAG","0")
                .in("CHECKFLAG",list));
        if (num == 0) {
            return false;
        } else {
            return true;
        }
    }
//执行的sql为:

update
bus_bill_waitsign
set
warnflag ='1',
update_by ='job'
where
(ACPTRACCT_NAME = 'ceshi'
and BILLTYPE = '2'
and WARNFLAG = '0'
and CHECKFLAG in ('0','2'))


 

posted @ 2022-08-10 11:19  花田007  阅读(1873)  评论(0编辑  收藏  举报