特别注意:

在Dao.java的映射文件Dao.xml中传入对象的属性怎么写,不是  对象.属性  而是直接写属性 如下示例

ProviderDao.java文件  传入的是一个对象,而不是普通的类型

public List<Provider> getProvidersFactors(Provider provider);

 

xml映射文件 ProviderDao.xml

<select id="getProvidersFactors" parameterType="com.thinkgem.jeesite.modules.goodsmanage.entity.Provider" resultType="com.thinkgem.jeesite.modules.goodsmanage.entity.Provider">
    select
    <include refid="providerColumns"></include>
    from ma_provider p
    <where>
        1=1
        <if    test="id !=null and id !=''">
            and p.id = #{provider.id}    <!-- 编号1-->
        </if>
        <if    test="companyName !=null and companyName !=''">
            and p.companyName = #{provider.companyName} <!-- 编号2-->


</if> <if test="address !=null and address !=''"> and p.address = #{address} </if> </where> </select>    <!-- 编号3-->

其中的

 <!-- 编号1-->
<!-- 编号2-->都是错误的写法
只有
 <!-- 编号3-->   才是正确的写法,所以要明白以后传入对象的时候,需要取到对象的属性的时候,不用 对象名.属性   直接写 #{属性名称} 即可


相关文章:

  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-06-21
  • 2022-12-23
  • 2021-08-11
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2021-10-12
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案