Browse Source

调整商品搜索视图

master
xyiege 4 years ago
parent
commit
f0457321be
  1. 107
      src/main/java/cn/chjyj/szwh/vo/GoodsListVo.java
  2. 23
      src/main/resources/mapper/szwh/GoodsMapper.xml
  3. 13
      src/test/java/cn/chjyj/szwh/mapper/GoodsMapperTest.java

107
src/main/java/cn/chjyj/szwh/vo/GoodsListVo.java

@ -0,0 +1,107 @@
package cn.chjyj.szwh.vo;
/**
* 商品列表映射
* goods+goods_detail
*/
public class GoodsListVo {
private Integer id;
private String createtime;
private String goods_islicode;
private String goods_name;
private String username;
private String user_islicode; //
private Integer goods_type;//商品类型;1:文化资源数据;2:文化数字内容 |goods_detail
private Integer goods_status;//商品状态;1:上架中;2:下架中;3:已转让;4:已失效;5:冻结中;6:下架中 |goods
private Integer goods_detail_id; //商品明细ID |goods
private Integer is_recommend; //是否推荐;0:否;1:是 \goods
private Integer entrust_status; //商品委托类型;1:转让;2:许可 \goods_detail
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getGoods_islicode() {
return goods_islicode;
}
public void setGoods_islicode(String goods_islicode) {
this.goods_islicode = goods_islicode;
}
public String getGoods_name() {
return goods_name;
}
public void setGoods_name(String goods_name) {
this.goods_name = goods_name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUser_islicode() {
return user_islicode;
}
public void setUser_islicode(String user_islicode) {
this.user_islicode = user_islicode;
}
public Integer getGoods_type() {
return goods_type;
}
public void setGoods_type(Integer goods_type) {
this.goods_type = goods_type;
}
public Integer getGoods_status() {
return goods_status;
}
public void setGoods_status(Integer goods_status) {
this.goods_status = goods_status;
}
public Integer getGoods_detail_id() {
return goods_detail_id;
}
public void setGoods_detail_id(Integer goods_detail_id) {
this.goods_detail_id = goods_detail_id;
}
public Integer getIs_recommend() {
return is_recommend;
}
public void setIs_recommend(Integer is_recommend) {
this.is_recommend = is_recommend;
}
public Integer getEntrust_status() {
return entrust_status;
}
public void setEntrust_status(Integer entrust_status) {
this.entrust_status = entrust_status;
}
}

23
src/main/resources/mapper/szwh/GoodsMapper.xml

@ -46,6 +46,29 @@
limit #{limit}
</select>
<!-- 筛选商品列表 -->
<select id="getGoodsVoList" parameterType="java.util.Map" resultType="cn.chjyj.szwh.vo.GoodsListVo">
SELECT g.id,g.createtime,g.goods_islicode,
gd.goods_name, g.username,g.user_islicode,
gd.goods_type, g.goods_status, g.goods_detail_id,
g.is_recommend, g.entrust_status
FROM goods g
INNER JOIN goods_detail gd ON g.goods_detail_id=gd.id
<where>
<if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='id'">
${k} = #{v}
</if>
</foreach>
</if>
</where>
<if test="orderkey!=null">
ORDER BY #{orderkey} #{orderval}
</if>
limit #{startrs},#{limit}
</select>
<!--查询记录列表-->
<select id="getGoodsList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">

13
src/test/java/cn/chjyj/szwh/mapper/GoodsMapperTest.java

@ -2,6 +2,7 @@ package cn.chjyj.szwh.mapper;
import cn.chjyj.szwh.bean.Goods;
import cn.chjyj.szwh.constant.ChConstant;
import cn.chjyj.szwh.vo.GoodsListVo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -82,4 +83,16 @@ public class GoodsMapperTest {
Integer axx = goodsMapper.countAllGoods();
System.out.println(axx);
}
@Test
public void getGoodsListTest() {
Map map =new HashMap();
map.put("gd.goods_entrust",1);
String odkey ="g.sale_count";
String odval="DESC";
List<GoodsListVo> goodsListVoList = goodsMapper.getGoodsVoList(map,odkey,odval,10,0);
for (GoodsListVo gv:goodsListVoList){
System.out.println(gv.getGoods_name());
}
}
}
Loading…
Cancel
Save