QueryWrapper<>(); 用法样例

/**
     * 在此逻辑中需要先做判断,判断数据库中是否已经存在编码,如果存在,那么对用户发出提示
     * @param fcEstate
     * @return
     */
    public Integer insertEstate(FcEstate fcEstate){
        int result = 0;
        QueryWrapper<FcEstate> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("estate_code", fcEstate.getEstateCode());
        FcEstate fe = fcEstateMapper.selectOne(queryWrapper);
        if (fe == null) {
            result = fcEstateMapper.insert(fcEstate);
        }
        return result;
    }
View Code
原文地址:https://www.cnblogs.com/hulian425/p/14381172.html