clothescontroller

package com.chinasoft.clothesmanager.controller;



import com.chinasoft.clothesmanager.entity.Clothes;
import com.chinasoft.clothesmanager.entity.ClothesExWarehousing;
import com.chinasoft.clothesmanager.entity.ClothesVo;
import com.chinasoft.clothesmanager.service.ClothesService;
import com.chinasoft.clothesmanager.service.impl.ClothesServiceImpl;
import com.chinasoft.clothesmanager.util.ClothesCons;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *  登录
 * @autor songxingsongxing
 * @date 20200305
 */
@Controller
@RequestMapping("/clothes")
public class ClothesController {

    @Autowired
    ClothesService clothesService;

    private Logger logger = LoggerFactory.getLogger(ClothesServiceImpl.class);

    /**
     * 获取衣服信息
     * @autor songxingsongxing
     * @date 20200305
     * @param clothesName
     * @param clothesColor
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getClothes",  method = RequestMethod.GET)
    public Map getClothes(@RequestParam(value = "clothesName", required = false)String clothesName,
                                 @RequestParam(value = "clothesColor", required = false)String clothesColor) {
        Map<String, Object> map = new HashMap<>();
        map.put("STATUS", 1);
        map.put("MSG", ClothesCons.QUERY_SUCCESS);
        try {
           List<ClothesVo> list = clothesService.getClothes(clothesName, clothesColor);
           map.put("datas", list);
        }
        catch (Exception e) {
            logger.error("获取衣服信息异常");
            map.put("STATUS", 0);
            map.put("MSG", ClothesCons.QUERY_FAIL);
            return  map;
        }
        return  map;
    }

    /**
     * 衣服入库
     * @autor songxingsongxing
     * @date 20200305
     * @param clothes
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/Clothes", method = RequestMethod.POST)
    public Map insertClothes(Clothes clothes) {
        Map<String, Object> map = new HashMap<>();
        map.put("STATUS", 1);
        map.put("MSG", ClothesCons.ADD_SUCCESS);
        try {
            clothesService.insertClothes(clothes);
        }
        catch (Exception e) {
            e.printStackTrace();
            map.put("STATUS", 0);
            map.put("MSG", ClothesCons.ADD_FAIL);
            return  map;
        }
        return map;
    }

    /**
     * 衣服出库
     * @autor songxingsongxing
     * @date 20200308
     * @param exClothes
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/exClothes", method = RequestMethod.POST)
    public Map exClothes(@RequestBody Map<String, List<ClothesExWarehousing>> exClothes) {
        Map<String, Object> map = new HashMap<>();
        map.put("STATUS", 1);
        map.put("MSG", ClothesCons.EXCLOTHES_SUCCESS);
        try {
            clothesService.exClothes(exClothes);
        }
        catch (Exception e) {
            e.printStackTrace();
            map.put("STATUS", 0);
            map.put("MSG", ClothesCons.EXCLOTHES_FAIL);
            return  map;
        }
        return map;
    }


}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值