废话不多说,直接贴代码:
dao层代码:
mapper:
ListselectByParentId(Integer id);
mapper.xml
select
from easybuy_product_category
where parentId = #{parentId,jdbcType=INTEGER}
Test:
import cn.hd.entity.ProductCategory;
import cn.hd.mapper.ProductCategoryMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext_dao.xml")</