mybatis的sql标签

  1. 静态
<sql id="factoryColumns">factory_index,factory_id,system_name,model_num,model_idsql>
<select id="listAllInfoByFactoryId" resultMap="factoryResultMap" parameterType="Integer">
        select "factoryColumns"/> from tb2_factory where factory_id = #{factoryId}
    select>
  1. 动态
"userColumns"> ${alias}.id,${alias}.password </sql> 
<select id="findUserById" parameterType="String" resultType="User">  
select "userColumns">"alias" value="u"/> from sysuser u where id=#{id}  
select>  

你可能感兴趣的:(mybatis)