haoyahui
2023-11-11 332c012e7336f2996c4fe5c8c110d00713c1bde2
consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java
@@ -11,11 +11,15 @@
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Description 物品模板
@@ -49,7 +53,9 @@
        }
        int result = this.baseGoodsTemplateService.add(param, this.getCurrentUser());
        if (result > 0) return ResponseValue.success(1);
        if (result > 0) {
            return ResponseValue.success(1);
        }
        return ResponseValue.error("新增失败!");
    }
@@ -70,6 +76,7 @@
    /**
     * 根据物品id查询物品详情
     *
     * @author 卢庆阳
     * @date 2023/9/26
     */
@@ -79,7 +86,9 @@
            return ResponseValue.error("物品id为空");
        }
        BaseGoodsTemplateVo vo = this.baseGoodsTemplateService.getById(id);
        if (vo == null) return ResponseValue.error("查询失败!");
        if (vo == null) {
            return ResponseValue.error("查询失败!");
        }
        return ResponseValue.success("查询成功!", vo);
    }
@@ -104,6 +113,7 @@
    /**
     * 修改状态
     *
     * @author 卢庆阳
     * @date 2023/10/25
     */
@@ -129,13 +139,13 @@
        if (goodsTemplate.getId() == null) {
            return ResponseValue.error("物品id为空");
        }
        int num = this.baseGoodsTemplateService.updateById(goodsTemplate,this.getCurrentUser());
        int num = this.baseGoodsTemplateService.updateById(goodsTemplate, this.getCurrentUser());
        return num > 0 ? ResponseValue.success(1) : ResponseValue.error("删除失败!");
    }
    /**
     * @Description  查询仓库类型(数据字典)
     * @Description 查询仓库类型(数据字典)
     * @Author 卢庆阳
     * @Date 2023/10/30
     */
@@ -145,6 +155,28 @@
        return ResponseValue.success(list);
    }
    /**
     * @Description 根据分类id查询物品模板
     * @Author 卢庆阳
     * @Date 2023/10/30
     */
    @GetMapping("/selectByCategoryId")
    public ResponseValue queryByCategoryId(Long categoryId) {
        List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryByCategoryId(categoryId);
        return ResponseValue.success(list);
    }
    @GetMapping("/query/goodsTemplate")
    public ResponseValue getByAgencyId(Long agencyId) {
        if (agencyId == null) {
            return ResponseValue.error("机构id为空");
        }
        List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryByAgencyId(agencyId);
        if (list == null) {
            return ResponseValue.error("查询失败!");
        }
        return ResponseValue.success("查询成功!", list);
    }
}