不同的sql语句的sql配置文件的编写

1.查询的时候做模糊查询。

<select id="selectMany" parameterType="java.lang.String" resultType="com.gxa.bj.model.Cate">
        Select * From cate Where name like '%${value}%'
  </select>

2.普通的插入语句:

<insert id="insertCate" parameterType="com.gxa.bj.model.Cate">
        Insert into Cate(name,description) values(#{name},#{description})
  </insert>

3.插入语句之后,获取刚插入的主键的数据:

<insert id="insertCate" parameterType="com.gxa.bj.model.Cate">
        <selectKey keyProperty="id" resultType="java.lang.Integer" order="AFTER">
           select last_insert_id()
        </selectKey>
        Insert into Cate(name,description) values(#{name},#{description})
     </insert>
如果是mysql的uuid。那么sql的编写为: 
<insert id="insertCate" parameterType="com.gxa.bj.model.Cate">
   <selectKey keyProperty="id" resultType="java.lang.Integer" order=“BEFORE">
        select uuid()
   </selectKey>
   insert into cate(id,name,description)values(#{id},#{name},#{description})
</insert>
 
如果是oracle的序列,那么sql的编写为:
<insert id="insertCate" parameterType="com.gxa.bj.model.Cate">
   <selectKey keyProperty="id" resultType="java.lang.Integer" order=“BEFORE">
        select 序列名.nextval()
   </selectKey>
   insert into cate(id,name,description)values(#{id},#{name},#{description})
</insert>
 
更新的sql语句:
<update id="updateCate" parameterType="com.gxa.bj.model.Cate">
   update cate set name=#{name},description=#{description} where id=#{id}
</update>
 
删除语句:
<delete id="deleteCate" parameterType="java.lang.Integer">
   delete from cate from id=#{id}
</delete>