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

 

posted @ 2021-02-06 12:40  hulian425  阅读(581)  评论(0编辑  收藏  举报