mybaties uuid使用

上源码

TestMapper.xml




    
        
        
    
    
        id" resultType="java.lang.String" order="BEFORE">
            SELECT  uuid()
        
        insert into test (id,name) values(#{id},#{name});
    

上面红色要注意的,其他和平时差不多,id的话是在Test类里面id属性。select uuid()直接生成uuid

TestMapper.java

package com.example.demo.dao;

import com.example.demo.entry.Test;

/**
 * @program: demo
 * @description
 * @author: dajitui
 * @create: 2018-06-16 11:52
 **/
public interface TestMapper {

    int insert(Test test);
}

然后单元测试,注入mapper应该简单的。





你可能感兴趣的:(mybatis)