.xml文件java
<select id="getArticle" resultType="com.my.Article"> select ta.ID, ta.article from t_article ta where 1=1 <if test="blacklist != null and blacklist.size()>0 "> and ta.createrid not in <foreach collection="blacklist" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </select>
dao层接口web
List<Article> getArticle(@Param("blacklist") List<Long> blackList);
接口传入List类型,使用foreach遍历并查询svg
.xml文件映射配置ui
<resultMap id="GoodsSizeVo" type="com.my.GoodsSizeVo"> <result column="images" jdbcType="VARCHAR" property="images" /> <result column="price" jdbcType="BIGINT" property="price" /> <result column="goodsName" jdbcType="VARCHAR" property="goodsName" /> <result column="isCust" jdbcType="INTEGER" property="isCust" /> <result column="spuId" jdbcType="INTEGER" property="spuId" /> <collection property="groupAndParamVoList" ofType="com.my.GroupAndParamVo"> <result column="lable" property="lable"/> <result column="sort" property="sort"/> <collection property="params" ofType="java.lang.String" javaType="java.util.List"> <result column="param"/> </collection> </collection> </resultMap>
.xml查询语句code
<select id="selectSpuBaseInfo" parameterType="com.my.Spu" resultMap="GoodsSizeVo"> SELECT ts.images, ts.price, ts.NAME goodsName, ts.is_cust isCust, ts.id spuId, tsg.`name` lable, tsg.sort, tsp.`name` param FROM t_spu ts, t_spec_group tsg, t_spec_param tsp WHERE ts.id = #{id} AND tsg.spuid = ts.id AND tsp.spuid = ts.id AND tsp.group_id = tsg.id order by tsg.sort </select>
dao接口xml
GoodsSizeVo selectSpuBaseInfo(Spu spu);
实体类数据格式blog
@Data public class GoodsSizeVo extends Entity { private String images; private Integer price; private String goodsName; private Integer isCust; private Long spuId; private List<GroupAndParamVo> groupAndParamVoList; } @Data public class GroupAndParamVo{ private String lable; private List<String> params; private Integer sort; }