<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      mybatisplus、baomidou動態數據庫@DS、sqlSession

       

      @TableId("f_id") 主鍵 

      @Data
      @TableName("flow_task_tag")
      public class FlowTaskTagEntity {
      @TableId("f_id")
      private String id;
      @TableField("f_task_id")
      private String taskId;
      
      LambdaQueryWrapper<FlowTaskTagEntity> queryWrapper = new LambdaQueryWrapper<FlowTaskTagEntity>();
      LambdaUpdateWrapper<FlowTaskEntity> updateWrapper = new LambdaUpdateWrapper<>();
      

        

       

      SqlSession批量提交

      @GetMapping(value = "/test")
      public String test(String xmh){
      List<XmhTest> list = new ArrayList<>();
      commonManager.saveBatch(list);
      
      @Component
      public class CommonManager {
          @Autowired
          private SqlSessionFactory sqlSessionFactory;
          public void saveBatch(List<XmhTest> list) {
              // 使用SqlSession進行插入操作
              SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);//
              try {
                  XmhTestMapper mapper = sqlSession.getMapper(XmhTestMapper.class);
                  // 假設User對象有一個insert方法,用于插入操作
                  for (XmhTest xmhTest : list) {
                      int rowsAffected = mapper.insert(xmhTest);
                      System.out.println(rowsAffected);
                  }
                  sqlSession.commit();
              } finally {
                  sqlSession.close();
              }
           }
      }
      
      @SpringBootApplication
      @MapperScan("com.xmh.mapper")
      public class XmhApplication {
          public static void main(String[] args) {
              SpringApplication.run(XmhApplication.class, args);
          }
      }
      
      public interface XmhTestMapper extends BaseMapper<XmhTest> {
          int insertXmh(XmhTest dto);
      
      @Data
      @Accessors(chain = true)
      @TableName("xmh_test")
      public class XmhTest implements Serializable {
          private static final long serialVersionUID = 1L;
          @Schema(description = "主鍵")
          @TableId(value = "id", type = IdType.ASSIGN_ID)
          private Long id;
          private String title;
          private int age;
      
      @Service
      @Transactional(rollbackFor = Exception.class)
      public class XmhTestServiceImpl extends ServiceImpl<XmhTestMapper, XmhTest> implements IXmhTestService {
          @Override
          public int insertXmh(XmhTest dto) {
              return baseMapper.insertXmh(dto);
          }
      
      public interface IXmhTestService extends IService<XmhTest> {
          int insertXmh(XmhTest dto);
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
      <mapper namespace="com.xmh.mapper.XmhTestMapper">
          <resultMap id="BaseResultMap" type="com.xmh.model.entity.XmhTest">
              <id column="id" property="id"/>
              <result column="title" property="title"/>
              <result column="age" property="age"/>
          </resultMap>
          <sql id="Basic_Column_List">
              id, title, age
          </sql>
          <insert id="insertXmh" parameterType ="com.xmh.model.entity.XmhTest">
              insert into xmh_test(id, title, age) values(#{id},#{title}, #{age});
          </insert>
      
      <!-- mybatis相關 -->
              <dependency>
                  <groupId>com.baomidou</groupId>
                  <artifactId>mybatis-plus-boot-starter</artifactId>
                  <version>3.5.1</version>
              </dependency>
              <dependency>
                  <groupId>com.github.pagehelper</groupId>
                  <artifactId>pagehelper-spring-boot-starter</artifactId>
                  <version>1.4.1</version>
              </dependency>
              <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <version>8.0.29</version>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-databind</artifactId>
                  <version>2.13.3</version>
              </dependency>
      

       

      LambdaQueryWrapper<FileResource> wrapper = new LambdaQueryWrapper<>();
      wrapper.eq(FileResource::getDeleted, Boolean.FALSE);
      count1 = baseMapper.selectCount(wrapper);
      
      QueryWrapper<FileResource> wrappe = new QueryWrapper<>();
      wrappe.select("count(distinct OWN_COMPANY_ID) as count");
      wrappe.lambda().eq(FileResource::getDeleted, Boolean.FALSE);
      Map<String,Object> map = this.getMap(wrappe);
      count2 = (long)map.get("count");
      

      yaml配置

      spring:
        application:
          name: xmh-service
        datasource:
          driver-class-name: ${DS_DRIVER:com.mysql.cj.jdbc.Driver}
          url: jdbc:mysql://${MYSQL_URL:xx}/${MYSQL_DBNAME:xx}?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai
          username: ${MYSQL_USER:xx}
          password: ${MYSQL_PASSWORD:xx}
          type: ${DS_TYPE:com.zaxxer.hikari.HikariDataSource}
      mybatis-plus:
        configuration:
          # 配置日志打印
          log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
        global-config:
          db-config:
            # 配置邏輯刪除字段和值
            logic-delete-field: status
            logic-delete-value: 1
            logic-not-delete-value: 0
      logging:
        level:
          org.apache.ibatis: DEBUG
      

       

       

       

      全鏈路不能使用@Transactional
      
      public interface XXXBasicMapper {
          @DS("operating")
          List<XXXBasicVo> findBasicList(XXXBasicPageDto dto);
      
      @Service
      @DS("operating")
      public class XXXXXXBasicServiceImpl2 implements IXXXBasicService2 {
      
      
      spring:
        datasource:
          hikari:
            pool-name: hikariCP-biz
            auto-commit: false
            read-only: false
            maximum-pool-size: 10
            max-lifetime: 1800000
            connection-timeout: 30000
            idle-timeout: 600000
          #動態數據源配置
          dynamic:
            #主數據源
            primary: master
            datasource:
              #數據源a01
              master:
                driver-class-name: com.mysql.cj.jdbc.Driver
                url: jdbc:mysql://${MYSQL_URL:xxx:3306}/${MYSQL_DBNAME:xxx}?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai
                username: ${MYSQL_USER:root}
                password: ${MYSQL_PASSWORD:xxx}
              #運營中間庫
              operating:
                driver-class-name: com.mysql.cj.jdbc.Driver
                url: jdbc:mysql://${MYSQL_URL:xxx:3306}/${MYSQL_DBNAME:xxxxxx}?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai
                username: ${MYSQL_USER:root}
                password: ${MYSQL_PASSWORD:xxx}
      
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-web</artifactId>
                  <version>2.6.8</version>
              </dependency>
             <dependency>
                  <groupId>com.baomidou</groupId>
                  <artifactId>mybatis-plus-boot-starter</artifactId>
                  <version>3.5.1</version>
              </dependency>
              <dependency>
                  <groupId>com.github.pagehelper</groupId>
                  <artifactId>pagehelper-spring-boot-starter</artifactId>
                  <version>1.4.1</version>
              </dependency>
              <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <version>8.0.29</version>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-databind</artifactId>
                  <version>2.13.3</version>
              </dependency>
              <dependency>
                  <groupId>com.baomidou</groupId>
                  <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
                  <version>2.5.6</version>
              </dependency>
      

       

      @MapperScan("com.xmh.mapper")
      public class XmhApplication {
      
      src\main\resources\mapper\XxxBasicMapper.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
      <mapper namespace="com.xmh.mapper.XxxBasicMapper">
          <!-- 通用查詢映射結果 -->
          <resultMap id="BaseResultMap" type="com.xmh.model.entity.XxxBasic">
              <id column="id" property="id"/>
              <result column="type" property="type"/>
              <result column="level" property="level"/>   
          </resultMap>
      
          <sql id="Basic_Column_List">   
              id, type, level, name
          </sql>
      
          <resultMap id="BasicResultMap" type="com.xmh.model.vo.XxxBasicVo">
              <id column="id" property="id"/>
              <result column="type" property="type"/>
              <result column="level" property="level"/>
              <result column="create_time" property="createTime"/>
              <result column="update_time" property="updateTime"/>
          </resultMap>
      
          <sql id="BasicNeed_Column_List">
              ab
              .
              `code`
              , ab.`name`, ab.type, ab.`level`, ab.dept_name as offerDept,
              slw.title, slw.dept_name as proposeDept, slw.create_name, slw.create_time, slw.id
          </sql>
      
          <select id="findBasicList" resultMap="BasicResultMap"
                  parameterType="com.xmh.model.dto.XxxBasicPageDto">
              select
              <include refid="Basic_Column_List"/>
              from Xxx_basic
              <trim prefix="where" prefixOverrides="and|or">
                  node = 1 and status != 2
                  <if test="name!=null and name!=''">
                      and name like concat('%', #{name}, '%')
                  </if>
                  <if test="code != null and code != ''">
                      and code = #{code}
                  </if>
                  <if test="deptCode != null and deptCode != ''">
                      and dept_code = #{deptCode}
                  </if>
                  <if test="keyword != null and keyword != ''">
                      and (name like concat('%', #{keyword}, '%') or code like concat('%', #{keyword}, '%'))
                  </if>
              </trim>
              <if test="orderBy == null or orderBy == ''">
                  order by sort desc, update_time desc
              </if>
          </select>
      </mapper>
      

       

      posted @ 2023-08-31 14:05  XUMT111  閱讀(216)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 久久久精品人妻一区二区三区蜜桃| 日本精品aⅴ一区二区三区| 亚洲永久精品日韩成人av| 男女猛烈无遮挡免费视频APP| 成人3D动漫一区二区三区| 天堂av成人网在线观看| 阳原县| 四虎在线中文字幕一区| 宾馆人妻4P互换视频| 亚洲最大成人网色| 亚洲熟女乱综合一区二区| 国产乱码精品一区二区三| 亚洲性图日本一区二区三区| 久久综合97丁香色香蕉| 少妇被躁爽到高潮无码文 | 日本高清一区免费中文视频| 国产亚洲一二三区精品| 大香伊蕉在人线国产av| 久久久久久人妻一区精品| 中文字幕有码日韩精品| 天天狠天天透天天伊人| 么公的好大好硬好深好爽视频| 亚洲人成电影网站色mp4| 西宁市| 亚洲欧美在线一区中文字幕| 婷婷色爱区综合五月激情韩国| 宁海县| 亚洲欧美另类久久久精品播放的| 草草线在成年免费视频2| 2021亚洲国产精品无码| 国产午夜福利视频一区二区| 在线日韩日本国产亚洲| 麻豆tv入口在线看| 国产一区二区不卡在线| 亚洲熟妇久久精品| 高清无码爆乳潮喷在线观看 | 国产精品自拍午夜福利| 国产精品老熟女一区二区| 免费无码一区二区三区蜜桃| 国产一区在线播放av| 商水县|