提交 0e7c4be4 authored 作者: 张光耀's avatar 张光耀

添加了商品独立站分类,更新商品独立站新API街口

上级 04064e85
......@@ -43,6 +43,7 @@ public class TokenVerification {
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfUserInfoController.resetPassWord(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfFeedbackController.getFeedbackList(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfUserInfoController.getUserIdentifyCode(..))"+
"&&!execution(* com.diaoyun.zion.chinafrica.controller.GoodsTypeController.getGoodsTypeList(..))"+
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfFeeController.*(..))")
public void controllerAspect() {
......
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity;
import com.diaoyun.zion.chinafrica.service.TbCfGoodstypeService;
import com.diaoyun.zion.chinafrica.service.TbCfStationItemService;
import com.diaoyun.zion.chinafrica.vo.StationToGoodsType;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.*;
import java.util.Map;
@RestController
@RequestMapping("/goodsType")
public class GoodsTypeController {
private static Logger logger = LoggerFactory.getLogger(LoginController.class);
@Autowired
private HttpServletRequest request; //自动注入request
@Autowired
private TbCfGoodstypeService tbCfGoodstypeService;
@Autowired
private TbCfStationItemService tbCfStationItemService;
@RequestMapping("/getGoodsTypeList")
@GetMapping
public Map<String,List<StationToGoodsType>> getGoodsTypeList() {
Map<String,List<StationToGoodsType>> map = new HashMap<>();
List<StationToGoodsType> listStation = new ArrayList<StationToGoodsType>();
List<TbCfGoodstypeEntity> list = tbCfGoodstypeService.queryList(null);
for (TbCfGoodstypeEntity goods:list) {
StationToGoodsType goodsType = new StationToGoodsType();
goodsType.setCategoryId(goods.getGoodstypeId());
goodsType.setGoodstypetitle(goods.getGoodstypeTitle());
List<TbCfStationItemEntity> station = tbCfStationItemService.getGoodsTypeList(goods.getGoodstypeId());
goodsType.setStationlist(station);
listStation.add(goodsType);
}
map.put("data",listStation);
return map;
}
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* Dao
*
* @author lipengjun
* @date 2019-10-08 16:34:40
*/
public interface TbCfGoodstypeDao extends BaseDao<TbCfGoodstypeEntity> {
}
......@@ -19,4 +19,11 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
* @return
*/
List<TbCfStationItemEntity> getItemStationList();
/**
* 根据主键一级分类实体集合
*
* @return List集合
*/
List<TbCfStationItemEntity> getGoodsTypeList(String categoryId);
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_goodstype
*
* @author lipengjun
* @date 2019-10-08 16:34:40
*/
public class TbCfGoodstypeEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品分类Id
*/
private String goodstypeId;
/**
* 商品分类标题
*/
private String goodstypeTitle;
/**
* 商品分类排序编号
*/
private Integer goodstypeSort;
/**
* 设置:商品分类Id
*/
public void setGoodstypeId(String goodstypeId) {
this.goodstypeId = goodstypeId;
}
/**
* 获取:商品分类Id
*/
public String getGoodstypeId() {
return goodstypeId;
}
/**
* 设置:商品分类标题
*/
public void setGoodstypeTitle(String goodstypeTitle) {
this.goodstypeTitle = goodstypeTitle;
}
/**
* 获取:商品分类标题
*/
public String getGoodstypeTitle() {
return goodstypeTitle;
}
/**
* 设置:商品分类排序编号
*/
public void setGoodstypeSort(Integer goodstypeSort) {
this.goodstypeSort = goodstypeSort;
}
/**
* 获取:商品分类排序编号
*/
public Integer getGoodstypeSort() {
return goodstypeSort;
}
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2019-10-08 16:34:40
*/
public interface TbCfGoodstypeService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfGoodstypeEntity queryObject(String goodstypeId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfGoodstypeEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfGoodstype 实体
* @return 保存条数
*/
int save(TbCfGoodstypeEntity tbCfGoodstype);
/**
* 根据主键更新实体
*
* @param tbCfGoodstype 实体
* @return 更新条数
*/
int update(TbCfGoodstypeEntity tbCfGoodstype);
/**
* 根据主键删除
*
* @param goodstypeId
* @return 删除条数
*/
int delete(String goodstypeId);
/**
* 根据主键批量删除
*
* @param goodstypeIds
* @return 删除条数
*/
int deleteBatch(String[] goodstypeIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.dao.TbCfGoodstypeDao;
import com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service实现类
*
* @author lipengjun
* @date 2019-10-08 16:34:40
*/
@Service("tbCfGoodstypeService")
public class TbCfGoodstypeServiceImpl implements TbCfGoodstypeService {
@Autowired
private TbCfGoodstypeDao tbCfGoodstypeDao;
@Override
public TbCfGoodstypeEntity queryObject(String goodstypeId) {
return tbCfGoodstypeDao.queryObject(goodstypeId);
}
@Override
public List<TbCfGoodstypeEntity> queryList(Map<String, Object> map) {
return tbCfGoodstypeDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfGoodstypeDao.queryTotal(map);
}
@Override
public int save(TbCfGoodstypeEntity tbCfGoodstype) {
tbCfGoodstype.setGoodstypeId(IdUtil.createIdbyUUID());
return tbCfGoodstypeDao.save(tbCfGoodstype);
}
@Override
public int update(TbCfGoodstypeEntity tbCfGoodstype) {
return tbCfGoodstypeDao.update(tbCfGoodstype);
}
@Override
public int delete(String goodstypeId) {
return tbCfGoodstypeDao.delete(goodstypeId);
}
@Override
public int deleteBatch(String[] goodstypeIds) {
return tbCfGoodstypeDao.deleteBatch(goodstypeIds);
}
}
......@@ -22,6 +22,13 @@ public interface TbCfStationItemService {
*/
TbCfStationItemEntity queryObject(String itemId);
/**
* 根据主键一级分类实体集合
*
* @return List集合
*/
List<TbCfStationItemEntity> getGoodsTypeList(String categoryId);
/**
* 分页查询
*
......
......@@ -31,6 +31,11 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
return tbCfStationItemDao.queryObject(itemId);
}
@Override
public List<TbCfStationItemEntity> getGoodsTypeList(String categoryId) {
return tbCfStationItemDao.getGoodsTypeList(categoryId);
}
@Override
public List<TbCfStationItemEntity> queryList(Map<String, Object> map) {
return tbCfStationItemDao.queryList(map);
......
package com.diaoyun.zion.chinafrica.vo;
import com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity;
import java.util.List;
public class StationToGoodsType {
private String CategoryId;
private String Goodstypetitle;
private List<TbCfStationItemEntity> stationlist;
public String getCategoryId() {
return CategoryId;
}
public String getGoodstypetitle() {
return Goodstypetitle;
}
public List<TbCfStationItemEntity> getStationlist() {
return stationlist;
}
public void setCategoryId(String categoryId) {
CategoryId = categoryId;
}
public void setGoodstypetitle(String goodstypetitle) {
Goodstypetitle = goodstypetitle;
}
public void setStationlist(List<TbCfStationItemEntity> stationlist) {
this.stationlist = stationlist;
}
}
<?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.diaoyun.zion.chinafrica.dao.TbCfGoodstypeDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity" id="tbCfGoodstypeMap">
<result property="goodstypeId" column="goodstype_id"/>
<result property="goodstypeTitle" column="goodstype_title"/>
<result property="goodstypeSort" column="goodstype_sort"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity">
select
`goodstype_id`,
`goodstype_title`,
`goodstype_sort`
from tb_cf_goodstype
where goodstype_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity">
select
`goodstype_id`,
`goodstype_title`,
`goodstype_sort`
from tb_cf_goodstype
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by goodstype_sort asc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_goodstype
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity">
insert into tb_cf_goodstype(
`goodstype_id`,
`goodstype_title`,
`goodstype_sort`)
values(
#{goodstypeId},
#{goodstypeTitle},
#{goodstypeSort})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfGoodstypeEntity">
update tb_cf_goodstype
<set>
<if test="goodstypeTitle != null">`goodstype_title` = #{goodstypeTitle}, </if>
<if test="goodstypeSort != null">`goodstype_sort` = #{goodstypeSort}</if>
</set>
where goodstype_id = #{goodstypeId}
</update>
<delete id="delete">
delete from tb_cf_goodstype where goodstype_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_goodstype where goodstype_id in
<foreach item="goodstypeId" collection="array" open="(" separator="," close=")">
#{goodstypeId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -17,6 +17,23 @@
<result property="createTime" column="create_time"/>
</resultMap>
<select id="getGoodsTypeList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select
`item_id`,
`item_code`,
`item_name`,
`item_brief`,
`item_category`,
`item_url`,
`item_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_station_item
where item_category = #{categoryId} order by create_time desc limit 0,4
</select>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select
`item_id`,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论