当前位置: 首页 > wzjs >正文

学校网站建设是什么意思百度推广助手下载

学校网站建设是什么意思,百度推广助手下载,做石材网站步骤,好视频下载软件目标 mp中所有方法都会带上逻辑删除,如果启用了逻辑删除,有时候我们需要忽略逻辑删除.改如何实现 解决方法 自定义DeleteReal 方法 import com.baomidou.mybatisplus.core.enums.SqlMethod; import com.baomidou.mybatisplus.core.injector.AbstractMethod; import com.ba…

目标

mp中所有方法都会带上逻辑删除,如果启用了逻辑删除,有时候我们需要忽略逻辑删除.改如何实现

解决方法

  • 自定义DeleteReal 方法
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;/*** @author Administrator*/
public class DeleteReal extends AbstractMethod {/*** @param methodName 方法名* @since 3.5.0*/public DeleteReal() {super("deleteReal");}@Overridepublic MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {SqlMethod sqlMethod = SqlMethod.DELETE;String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(),sqlWhereEntityWrapper(true, tableInfo),sqlComment());SqlSource sqlSource = super.createSqlSource(configuration, sql, modelClass);return this.addDeleteMappedStatement(mapperClass, methodName, sqlSource);}@Overrideprotected String sqlWhereEntityWrapper(boolean newLine, TableInfo table) {/** Wrapper SQL*/String _sgEs_ = "<bind name=\"_sgEs_\" value=\"ew.sqlSegment != null and ew.sqlSegment != ''\"/>";String andSqlSegment = SqlScriptUtils.convertIf(String.format(" AND ${%s}", WRAPPER_SQLSEGMENT), String.format("_sgEs_ and %s", WRAPPER_NONEMPTYOFNORMAL), true);String lastSqlSegment = SqlScriptUtils.convertIf(String.format(" ${%s}", WRAPPER_SQLSEGMENT), String.format("_sgEs_ and %s", WRAPPER_EMPTYOFNORMAL), true);/** 普通 SQL 注入*/String sqlScript = table.getAllSqlWhere(false, false, true, WRAPPER_ENTITY_DOT);sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", WRAPPER_ENTITY), true);sqlScript = SqlScriptUtils.convertWhere(sqlScript + NEWLINE + andSqlSegment) + NEWLINE + lastSqlSegment;sqlScript = SqlScriptUtils.convertIf(_sgEs_ + NEWLINE + sqlScript, String.format("%s != null", WRAPPER), true);return newLine ? NEWLINE + sqlScript : sqlScript;}
}
  • 注入
public class MySqlInjector extends DefaultSqlInjector {@Overridepublic List<AbstractMethod> getMethodList(Configuration configuration, Class<?> mapperClass, TableInfo tableInfo) {List<AbstractMethod> methodList = super.getMethodList(configuration, mapperClass, tableInfo);methodList.add(new SelectRealList());methodList.add(new DeleteReal());return methodList;}
}
  • 配置bean
  @Beanpublic MySqlInjector mySqlInjector() {return new MySqlInjector();}

修改basemapper

public interface HelioBaseMapper<E extends HelioBaseEntity<T, E>, T extends Serializable> extends MPJBaseMapper<E> {List<E> selectRealList(@Param(Constants.WRAPPER) Wrapper<E> queryWrapper);int deleteReal(@Param(Constants.WRAPPER) Wrapper<E> queryWrapper);
}

使用方法

int demoKey = sysConfigMapper.deleteReal(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getConfigKey, "demoKey"));
if (demoKey > 0) {log.info("删除成功");
} else {log.info("删除失败");
}
http://www.dtcms.com/wzjs/334604.html

相关文章:

  • 公司官方网站制作哈尔滨优化网站公司
  • 做设计那个素材网站最好头条今日头条新闻头条
  • 浙江中联建设集团网站想在百度做推广怎么做
  • 松原手机网站开发公司seo优化方案案例
  • seo在线教学seo标题优化导师咨询
  • 源码建站之网站建设手机软文广告300字
  • 河南it渠道网重庆seo是什么
  • 网站备案信息百度搜索推广产品
  • 怎么自己做网站免费的安卓嗅探app视频真实地址
  • 网站备案的核验单今天国内最新消息
  • 牡丹江出现一例seo英文
  • 深圳上市公司网站建设公司今天刚刚最新消息2023
  • 织梦如何做淘宝客网站优化大师哪个好
  • 日本优秀平面设计网站新媒体营销案例分析
  • 行业协会网站建设的目的靠谱的代写平台
  • 优秀的手机网站设计138ip查询网域名解析
  • 做企业网站好的营销心得体会感悟300字
  • 静态网站的建设模板网站有哪些平台
  • 成都大丰网站建设例表网万网官网域名注册
  • 湖畔魔豆基金会公益网站开发杭州网络整合营销公司
  • 阿里巴巴做轮播网站怎么自己弄一个网站
  • 潍坊做网站联系方式b站在线观看人数在哪
  • 视频网站建设如何网络营销
  • 如何免费申请公司网站广州企业网站建设
  • 做餐饮网站重庆seo网页优化
  • 手机做网站自己做seo排名优化推广报价
  • 什么软件可以做图片设计长沙seo霸屏
  • 邯郸景区网站制作网站建设公司哪家好
  • 阿里云oss可以做网站搜狗识图
  • 没有做网站地图影响大吗吗百度推广怎么样