<resultMap id="BaseResultMap" type="com.fafukeji.model.Goods" > <id column="id" property="id" jdbcType="INTEGER" /> <result column="description" property="description" jdbcType="VARCHAR" /> <result column="attributes" property="attributes" jdbcType="VARCHAR" /> <result column="pics" property="pics" jdbcType="VARCHAR" /> <result column="urls" property="urls" jdbcType="VARCHAR" /> <result column="numbers" property="numbers" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="BIT" /> <result column="status" property="status" jdbcType="BIT" /> <result column="updated_at" property="updatedAt" jdbcType="INTEGER" /> <result column="created_at" property="createdAt" jdbcType="INTEGER" />
<association property="userId" javaType="com.fafukeji.model.User"> <id column="id" property="id" jdbcType="INTEGER" /> <result column="username" property="username" jdbcType="VARCHAR" /> </association> <association property="categoryId" javaType="com.fafukeji.model.Categories"> <result column="name" property="name" jdbcType="VARCHAR" /> <result column="parent_name" property="parentName" jdbcType="INTEGER" /> </association>
</resultMap>
<select id="selectGoods" resultMap="BaseResultMap" parameterType="com.fafukeji.model.Goods"> SELECT goods.id,goods.description,goods.attributes,categories.`name`,categories.ename,goods.user_id,goods.category_id,goods.pics,goods.urls,goods.numbers,goods.state,goods.`status`,goods.updated_at,goods.created_at ,categories.parent_name ,users.username from ((goods inner join categories on goods.category_id = categories.category_id) INNER JOIN attribute on goods.attributes = attribute.name) INNER JOIN users </select> </mapper><c:forEach items="${goodsList.list}" var="goods"> <tr> <td>${goods.userId.id}</td> <td>${goods.userId.username}</td> <td>${goods.categoryId.name}</td> <td>${goods.categoryId.parentName}</td> <%--<td>${goods.description}</td>--%> <%--<td>${goods.attributes}</td>--%> <%--<td>${goods.numbers}</td>--%> <td>${goods.taskStateName}</td> <%--<td>${goods.createdAt}</td>--%></c:forEach>