select

1.基本用法

<select >
      select * from tableOne
  </select>

2.内连接

<sql >
        INNER JOIN rich.PSUBDAYBOOK ON rich.PMAINDAYBOOK.SALENO = rich.PSUBDAYBOOK.SALENO
        INNER JOIN rich.BITEM ON rich.PSUBDAYBOOK.ICODE = rich.BITEM.ICODE
  </sql>

<select >
      select  *   from  test

          <include ref/>
  </select>

2.带参数

<select>

  select * from table

  where   id  =   #{id}

</select>

<select>

  select * from table

  where   id  like   CONCAT('%',#{name},'%')     //这里是mysql的写法如果是其他数据库参见::  http://w6513017.iteye.com/blog/1512761

</select>

update

<update    parameterType="com.trade2cn.im.bean.testTable">

  update    testTable

  <set>

    <if test="id!=null">

      id=#{id}

    </if>

  </set>

  where name=#{name}

</update>

insert

<insert >

  insert into test

  <trim  prefix="(" suffix=")" suffixOverrides=",">

    <if  test="id != null">

      t_id,

    </if>

    <if test="name != null">

      t_name

    </if>

  </trim>

  <trim prefix="values(" suffix=")" suffixOverrides=",">

    <if  test="id != null">

      #{id},

    </if>

    <if test="name != null">

      #{name}

    </if>

  </trim>

</insert>

delete

 

相关文章:

  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-06-01
  • 2021-10-28
猜你喜欢
  • 2021-10-14
  • 2021-06-28
  • 2021-07-08
  • 2023-04-02
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案