mybati之sql集合

mybatis 详解(五)------动态SQL - YSOcean - 博客园 (cnblogs.com)

 

mybatis参数注入:

根据参数名称 使用#{} 注入参数

    <insert id="insProject">
        insert into t_project
         (<include refid="colums"></include>)
         values
         (null,#{projectName},0)
    </insert>

 

 

mybaits 模糊查询:

使用$代替#注入参数

    <select id="selProjectList" resultType="java.util.Map">
        select
         <include refid="colums_properties"></include>
         from t_project
         where
         1=1
        <if test="projectName != null and projectName != ''">
            and  project_name like '%${projectName}%'
        </if>
    </select>

 

posted @ 2021-12-08 16:03  hehehenhen  阅读(76)  评论(0)    收藏  举报