mybatis中sql语句从postgress到mysql修改点记录

 

1.表名及字段名字符修改

Postgres

select count(*) from "TAS_RES_60" where "TAS_RES_60_COL_230"='0'

 

Mysql

select count(*) from `TAS_RES_60` where `TAS_RES_60_COL_230`='0'

 

2.修改like模糊查询语句

Postgres

like '%'|| #{researchReport_title,jdbcType=VARCHAR} || '%'

Mysql

like CONCAT('%',#{researchReport_title,jdbcType=VARCHAR},'%')

 

 

3.数据函数修改

Postgres

  AND  to_date("TAS_RES_60_COL_60",'YYYY-MM-DD') >= to_date(#{startDate},'YYYY-MM-DD') ]]>

 

Mysql

  AND  str_to_date(`TAS_RES_60_COL_60`,'%Y-%m-%d') >= str_to_date(#{startDate},'%Y-%m-%d') ]]>

4.插入数据返回主键值修改

Postgres(建立系列类型字段),在插入之前写,插入时加入主键值字段及获取的键值

<selectKey keyProperty="achieveAward_id" resultType="int" order="BEFORE">

        SELECT nextval('"TAS_RES_60_TAS_RES_60_COL_10_seq"'::regclass) as achieveAward_id 

    selectKey> 

 

Mysql(建立自增字段类型),在插入后获取,插入时不加主键值字段

     <selectKey keyProperty="achieveAward_id" resultType="int" order="AFTER">

            select LAST_INSERT_ID()

    selectKey>

 

你可能感兴趣的:(mybatis)