|
|
@ -12,18 +12,24 @@ import com.hfkj.entity.SecMenu; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.service.goods.GoodsTypeService; |
|
|
|
import com.hfkj.service.goods.GoodsTypeService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
|
|
|
@RequestMapping(value="/goodsType") |
|
|
|
|
|
|
|
@Api(value="商品类型") |
|
|
|
public class GoodsTypeController { |
|
|
|
public class GoodsTypeController { |
|
|
|
private static final Logger log = LoggerFactory.getLogger(FileUploadController.class); |
|
|
|
private static final Logger log = LoggerFactory.getLogger(FileUploadController.class); |
|
|
|
|
|
|
|
|
|
|
@ -33,10 +39,10 @@ public class GoodsTypeController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/editMenu",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/editGoodsType",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "编辑菜单") |
|
|
|
@ApiOperation(value = "编辑商品类型") |
|
|
|
public ResponseData editMenu(@RequestBody GoodsType body, HttpServletRequest request) { |
|
|
|
public ResponseData editGoodsType(@RequestBody GoodsType body, HttpServletRequest request) { |
|
|
|
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
|
|
|
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
|
|
@ -62,6 +68,7 @@ public class GoodsTypeController { |
|
|
|
|
|
|
|
|
|
|
|
goodsType.setUpdateTime(new Date()); |
|
|
|
goodsType.setUpdateTime(new Date()); |
|
|
|
goodsType.setStatus(1); |
|
|
|
goodsType.setStatus(1); |
|
|
|
|
|
|
|
goodsType.setTitle(body.getTitle()); |
|
|
|
goodsType.setParentId(body.getParentId()); |
|
|
|
goodsType.setParentId(body.getParentId()); |
|
|
|
goodsType.setBusinessType(body.getBusinessType()); |
|
|
|
goodsType.setBusinessType(body.getBusinessType()); |
|
|
|
goodsType.setImgUrl(body.getImgUrl()); |
|
|
|
goodsType.setImgUrl(body.getImgUrl()); |
|
|
@ -80,19 +87,15 @@ public class GoodsTypeController { |
|
|
|
@RequestMapping(value="/getList",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/getList",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询列表") |
|
|
|
@ApiOperation(value = "查询列表") |
|
|
|
public ResponseData getList( |
|
|
|
public ResponseData getList() { |
|
|
|
@RequestParam(value = "parentId" , required = false) Long parentId, |
|
|
|
|
|
|
|
@RequestParam(value = "businessType" , required = false) Integer businessType, |
|
|
|
|
|
|
|
@RequestParam(value = "title" , required = false) String title |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
map.put("parentId" , parentId); |
|
|
|
map.put("parentId" , null); |
|
|
|
map.put("businessType" , businessType); |
|
|
|
|
|
|
|
map.put("title" , title); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(goodsTypeService.getList(map)); |
|
|
|
List<GoodsType> list = goodsTypeService.getList(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(goodsTypeService.getGoodsTypeModelList(list)); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("error!",e); |
|
|
|
log.error("error!",e); |
|
|
|