目录
一,一对多关系关联
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration>
<!-- 引入配置文件 -->
<properties resource="jdbc.properties"/>
<!--指定数据库jdbc驱动jar包的位置-->
<classPathEntry location="D:\\maven mulu\\mvn_repository\\mysql\\mysql-connector-java\\5.1.44\\mysql-connector-java-5.1.44.jar"/>
<!-- 一个数据库一个context -->
<context id="infoGuardian">
<!-- 注释 -->
<commentGenerator>
<property name="suppressAllComments" value="true"/><!-- 是否取消注释 -->
<property name="suppressDate" value="true"/> <!-- 是否生成注释代时间戳 -->
</commentGenerator>
<!-- jdbc连接 -->
<jdbcConnection driverClass="${jdbc.driver}"
connectionURL="${jdbc.url}" userId="${jdbc.username}" password="${jdbc.password}"/>
<!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 01 指定javaBean生成的位置 -->
<!-- targetPackage:指定生成的model生成所在的包名 -->
<!-- targetProject:指定在该项目下所在的路径 -->
<javaModelGenerator targetPackage="com.hmj.model"
targetProject="src/main/java">
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="false"/>
<!-- 是否对model添加构造函数 -->
<property name="constructorBased" value="true"/>
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="false"/>
<!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法,只有构造方法 -->
<property name="immutable" value="false"/>
</javaModelGenerator>
<!-- 02 指定sql映射文件生成的位置 -->
<sqlMapGenerator targetPackage="com.hmj.mapper"
targetProject="src/main/java">
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- 03 生成XxxMapper接口 -->
<!-- type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 -->
<!-- type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 -->
<!-- type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator targetPackage="com.hmj.mapper"
targetProject="src/main/java" type="XMLMAPPER">
<!-- 是否在当前路径下新加一层schema,false路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- 配置表信息 -->
<!-- schema即为数据库名 -->
<!-- tableName为对应的数据库表 -->
<!-- domainObjectName是要生成的实体类 -->
<!-- enable*ByExample是否生成 example类 -->
<!--<table schema="" tableName="t_book" domainObjectName="Book"-->
<!--enableCountByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" enableUpdateByExample="false">-->
<!--<!– 忽略列,不生成bean 字段 –>-->
<!--<!– <ignoreColumn column="FRED" /> –>-->
<!--<!– 指定列的java数据类型 –>-->
<!--<!– <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> –>-->
<!--</table>-->
<table schema="" tableName="t_hibernate_Book" domainObjectName="Hbook"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
<!-- 忽略列,不生成bean 字段 -->
<!-- <ignoreColumn column="FRED" /> -->
<!-- 指定列的java数据类型 -->
<!-- <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> -->
</table>
<table schema="" tableName="t_hibernate_category" domainObjectName="Category"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_hibernate_book_category" domainObjectName="HbookCategory"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
</context>
</generatorConfiguration>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hmj.mapper.OrderMapper" >
<resultMap id="BaseResultMap" type="com.hmj.model.Order" >
<constructor >
<idArg column="order_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="order_no" jdbcType="VARCHAR" javaType="java.lang.String" />
</constructor>
</resultMap>
<resultMap id="OrderVoMap" type="com.hmj.model.vo.OrderVo" >
<result column="order_id" property="orderId"></result>
<result column="order_no" property="orderNo"></result>
<collection property="orderItems" ofType="com.hmj.model.OrderItem">
<result column="order_item_id" property="orderItemId"></result>
<result column="oid" property="oid"></result>
<result column="product_id" property="productId"></result>
<result column="quantity" property="quantity"></result>
</collection>
</resultMap>
<sql id="Base_Column_List" >
order_id, order_no
</sql>
<select id="selectByPrimaryKey" resultMap="OrderVoMap" parameterType="java.lang.Integer" >
select * from t_hibernate_order o,t_hibernate_order_item oi
where o.order_id = oi.oid and o.order_id=#{orderId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from t_hibernate_order
where order_id = #{orderId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.hmj.model.Order" >
insert into t_hibernate_order (order_id, order_no)
values (#{orderId,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.hmj.model.Order" >
insert into t_hibernate_order
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="orderId != null" >
order_id,
</if>
<if test="orderNo != null" >
order_no,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="orderId != null" >
#{orderId,jdbcType=INTEGER},
</if>
<if test="orderNo != null" >
#{orderNo,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.hmj.model.Order" >
update t_hibernate_order
<set >
<if test="orderNo != null" >
order_no = #{orderNo,jdbcType=VARCHAR},
</if>
</set>
where order_id = #{orderId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.hmj.model.Order" >
update t_hibernate_order
set order_no = #{orderNo,jdbcType=VARCHAR}
where order_id = #{orderId,jdbcType=INTEGER}
</update>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hmj.mapper.OrderItemMapper" >
<resultMap id="BaseResultMap" type="com.hmj.model.OrderItem" >
<constructor >
<idArg column="order_item_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="product_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="quantity" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="oid" jdbcType="INTEGER" javaType="java.lang.Integer" />
</constructor>
</resultMap>
<resultMap id="OrderVoMap" type="com.hmj.model.vo.OrderItemVo" >
<result column="order_item_id" property="orderItemId"></result>
<result column="oid" property="oid"></result>
<result column="product_id" property="productId"></result>
<result column="quantity" property="quantity"></result>
<collection property="order" javaType="com.hmj.model.Order">
<result column="order_id" property="orderId"></result>
<result column="order_no" property="orderNo"></result>
</collection>
</resultMap>
<sql id="Base_Column_List" >
order_item_id, product_id, quantity, oid
</sql>
<select id="selectByPrimaryKeys" resultMap="OrderVoMap" parameterType="java.lang.Integer" >
select * from t_hibernate_order o,t_hibernate_order_item oi
where o.order_id = oi.oid and oi.order_item_id=#{orderItemId}
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from t_hibernate_order_item
where order_item_id = #{orderItemId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from t_hibernate_order_item
where order_item_id = #{orderItemId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.hmj.model.OrderItem" >
insert into t_hibernate_order_item (order_item_id, product_id, quantity,
oid)
values (#{orderItemId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER},
#{oid,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.hmj.model.OrderItem" >
insert into t_hibernate_order_item
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="orderItemId != null" >
order_item_id,
</if>
<if test="productId != null" >
product_id,
</if>
<if test="quantity != null" >
quantity,
</if>
<if test="oid != null" >
oid,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="orderItemId != null" >
#{orderItemId,jdbcType=INTEGER},
</if>
<if test="productId != null" >
#{productId,jdbcType=INTEGER},
</if>
<if test="quantity != null" >
#{quantity,jdbcType=INTEGER},
</if>
<if test="oid != null" >
#{oid,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.hmj.model.OrderItem" >
update t_hibernate_order_item
<set >
<if test="productId != null" >
product_id = #{productId,jdbcType=INTEGER},
</if>
<if test="quantity != null" >
quantity = #{quantity,jdbcType=INTEGER},
</if>
<if test="oid != null" >
oid = #{oid,jdbcType=INTEGER},
</if>
</set>
where order_item_id = #{orderItemId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.hmj.model.OrderItem" >
update t_hibernate_order_item
set product_id = #{productId,jdbcType=INTEGER},
quantity = #{quantity,jdbcType=INTEGER},
oid = #{oid,jdbcType=INTEGER}
where order_item_id = #{orderItemId,jdbcType=INTEGER}
</update>
</mapper>
package com.hmj.mapper;
import com.hmj.model.OrderItem;
import com.hmj.model.vo.OrderItemVo;
import org.apache.ibatis.annotations.Param;
public interface OrderItemMapper {
int deleteByPrimaryKey(Integer orderItemId);
int insert(OrderItem record);
int insertSelective(OrderItem record);
OrderItem selectByPrimaryKey(Integer orderItemId);
OrderItemVo selectByPrimaryKeys(@Param("orderItemId") Integer orderItemId);
int updateByPrimaryKeySelective(OrderItem record);
int updateByPrimaryKey(OrderItem record);
}
package com.hmj.mapper;
import com.hmj.model.vo.OrderVo;
import com.hmj.model.Order;
import org.apache.ibatis.annotations.Param;
public interface OrderMapper {
int deleteByPrimaryKey(Integer orderId);
int insert(Order record);
int insertSelective(Order record);
OrderVo selectByPrimaryKey(@Param("orderId") Integer orderId);
int updateByPrimaryKeySelective(Order record);
int updateByPrimaryKey(Order record);
}
package com.hmj.biz;
import com.hmj.model.Order;
import org.apache.ibatis.annotations.Param;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 18:41
*/
public interface OrderBiz{
int deleteByPrimaryKey(Integer orderId);
int insert(Order record);
int insertSelective(Order record);
Order selectByPrimaryKey(Integer orderId);
int updateByPrimaryKeySelective(Order record);
int updateByPrimaryKey(Order record);
}
package com.hmj.biz;
import com.hmj.model.OrderItem;
import com.hmj.model.vo.OrderItemVo;
import org.apache.ibatis.annotations.Param;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 19:14
*/
public interface OrderItemBiz {
int deleteByPrimaryKey(Integer orderItemId);
int insert(OrderItem record);
int insertSelective(OrderItem record);
OrderItem selectByPrimaryKey(Integer orderItemId);
OrderItemVo selectByPrimaryKeys( Integer orderItemId);
int updateByPrimaryKeySelective(OrderItem record);
int updateByPrimaryKey(OrderItem record);
}
package com.hmj.biz.impl;
import com.hmj.biz.OrderBiz;
import com.hmj.mapper.OrderMapper;
import com.hmj.model.Order;
import com.sun.tracing.dtrace.Attributes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 18:42
*/
@Service
public class OrderBizImpl implements OrderBiz {
@Autowired
private OrderMapper orderMapper;
@Override
public int deleteByPrimaryKey(Integer orderId) {
return 0;
}
@Override
public int insert(Order record) {
return 0;
}
@Override
public int insertSelective(Order record) {
return 0;
}
@Override
public Order selectByPrimaryKey(Integer orderId) {
return orderMapper.selectByPrimaryKey(orderId);
}
@Override
public int updateByPrimaryKeySelective(Order record) {
return 0;
}
@Override
public int updateByPrimaryKey(Order record) {
return 0;
}
}
package com.hmj.biz.impl;
import com.hmj.biz.OrderItemBiz;
import com.hmj.mapper.OrderItemMapper;
import com.hmj.mapper.OrderMapper;
import com.hmj.model.OrderItem;
import com.hmj.model.vo.OrderItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 若娟
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 19:36
*/
@Service
public class OrderItemBizImpl implements OrderItemBiz {
@Autowired
private OrderItemMapper orderItemMapper;
@Override
public int deleteByPrimaryKey(Integer orderItemId) {
return 0;
}
@Override
public int insert(OrderItem record) {
return 0;
}
@Override
public int insertSelective(OrderItem record) {
return 0;
}
@Override
public OrderItem selectByPrimaryKey(Integer orderItemId) {
return null;
}
@Override
public OrderItemVo selectByPrimaryKeys(Integer orderItemId) {
return orderItemMapper.selectByPrimaryKeys(orderItemId);
}
@Override
public int updateByPrimaryKeySelective(OrderItem record) {
return 0;
}
@Override
public int updateByPrimaryKey(OrderItem record) {
return 0;
}
}
package com.hmj.biz.impl;
import com.hmj.biz.OrderItemBiz;
import com.hmj.model.vo.OrderItemVo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 19:38
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext-mybatis.xml"})
public class OrderItemBizImplTest {
@Autowired
private OrderItemBiz orderItemBiz;
@Test
public void selectByPrimaryKeys() {
OrderItemVo orderitemVo = orderItemBiz.selectByPrimaryKeys(43);
System.out.println(orderitemVo);
}
}
package com.hmj.biz.impl;
import com.hmj.biz.OrderBiz;
import com.hmj.model.Order;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 18:45
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext-mybatis.xml"})
public class OrderBizImplTest {
@Autowired
private OrderBiz orderBiz;
@Test
public void selectByPrimaryKey() {
Order order = orderBiz.selectByPrimaryKey(9);
System.out.println(order);
}
}
二,多对多关系关联
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hmj.mapper.HbookMapper" >
<resultMap id="BaseResultMap" type="com.hmj.model.Hbook" >
<constructor >
<idArg column="book_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="book_name" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="price" jdbcType="REAL" javaType="java.lang.Float" />
</constructor>
</resultMap>
<sql id="Base_Column_List" >
book_id, book_name, price
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from t_hibernate_book
where book_id = #{bookId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from t_hibernate_book
where book_id = #{bookId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.hmj.model.Hbook" >
insert into t_hibernate_book (book_id, book_name, price
)
values (#{bookId,jdbcType=INTEGER}, #{bookName,jdbcType=VARCHAR}, #{price,jdbcType=REAL}
)
</insert>
<insert id="insertSelective" parameterType="com.hmj.model.Hbook" >
insert into t_hibernate_book
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="bookId != null" >
book_id,
</if>
<if test="bookName != null" >
book_name,
</if>
<if test="price != null" >
price,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="bookId != null" >
#{bookId,jdbcType=INTEGER},
</if>
<if test="bookName != null" >
#{bookName,jdbcType=VARCHAR},
</if>
<if test="price != null" >
#{price,jdbcType=REAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.hmj.model.Hbook" >
update t_hibernate_book
<set >
<if test="bookName != null" >
book_name = #{bookName,jdbcType=VARCHAR},
</if>
<if test="price != null" >
price = #{price,jdbcType=REAL},
</if>
</set>
where book_id = #{bookId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.hmj.model.Hbook" >
update t_hibernate_book
set book_name = #{bookName,jdbcType=VARCHAR},
price = #{price,jdbcType=REAL}
where book_id = #{bookId,jdbcType=INTEGER}
</update>
</mapper>
package com.hmj.mapper;
import com.hmj.model.Hbook;
public interface HbookMapper {
int deleteByPrimaryKey(Integer bookId);
int insert(Hbook record);
int insertSelective(Hbook record);
Hbook selectByPrimaryKey(Integer bookId);
int updateByPrimaryKeySelective(Hbook record);
int updateByPrimaryKey(Hbook record);
}package com.hmj.mapper;
import com.hmj.model.Hbook;
public interface HbookMapper {
int deleteByPrimaryKey(Integer bookId);
int insert(Hbook record);
int insertSelective(Hbook record);
Hbook selectByPrimaryKey(Integer bookId);
int updateByPrimaryKeySelective(Hbook record);
int updateByPrimaryKey(Hbook record);
}package com.hmj.mapper;
import com.hmj.model.Hbook;
public interface HbookMapper {
int deleteByPrimaryKey(Integer bookId);
int insert(Hbook record);
int insertSelective(Hbook record);
Hbook selectByPrimaryKey(Integer bookId);
int updateByPrimaryKeySelective(Hbook record);
int updateByPrimaryKey(Hbook record);
}
package com.hmj.biz;
import com.hmj.model.HbookCategory;
import com.hmj.model.vo.CategoryVo;
import com.hmj.model.vo.HbookVo;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 20:16
*/
public interface HbookCategoryBiz {
int deleteByPrimaryKey(Integer bcid);
int insert(HbookCategory record);
int insertSelective(HbookCategory record);
HbookCategory selectByPrimaryKey(Integer bcid);
int updateByPrimaryKeySelective(HbookCategory record);
int updateByPrimaryKey(HbookCategory record);
HbookVo queryByBookId( Integer bookId);
CategoryVo queryByCid( Integer cid);
}
package com.hmj.biz.impl;
import com.hmj.biz.HbookCategoryBiz;
import com.hmj.mapper.HbookCategoryMapper;
import com.hmj.model.HbookCategory;
import com.hmj.model.vo.CategoryVo;
import com.hmj.model.vo.HbookVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 20:16
*/
@Service
public class HbookCategoryBizImpl implements HbookCategoryBiz {
@Autowired
private HbookCategoryMapper hbookCategoryMapper;
@Override
public int deleteByPrimaryKey(Integer bcid) {
return 0;
}
@Override
public int insert(HbookCategory record) {
return 0;
}
@Override
public int insertSelective(HbookCategory record) {
return 0;
}
@Override
public HbookCategory selectByPrimaryKey(Integer bcid) {
return null;
}
@Override
public int updateByPrimaryKeySelective(HbookCategory record) {
return 0;
}
@Override
public int updateByPrimaryKey(HbookCategory record) {
return 0;
}
@Override
public HbookVo queryByBookId(Integer bookId) {
return hbookCategoryMapper.queryByBookId(bookId);
}
@Override
public CategoryVo queryByCid(Integer cid) {
return hbookCategoryMapper.queryByCid(cid);
}
}
package com.hmj.biz.impl;
import com.hmj.biz.HbookCategoryBiz;
import com.hmj.model.vo.CategoryVo;
import com.hmj.model.vo.HbookVo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
/**
* @author
* @site 123456999
* @company 玉渊工作室
* @create 2022-08-15 20:18
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext-mybatis.xml"})
public class HbookCategoryBizImplTest {
@Autowired
private HbookCategoryBiz hbookCategoryBiz;
@Test
public void queryByBookId() {
HbookVo hbookVo = hbookCategoryBiz.queryByBookId(8);
System.out.println(hbookVo);
hbookVo.getCategories().forEach(System.out::println);
}
@Test
public void queryByCid() {
CategoryVo categoryVo = hbookCategoryBiz.queryByCid(8);
System.out.println(categoryVo);
categoryVo.getHbooks().forEach(System.out::println);
}
}