Browse Source

维护二级耗材库功能20251121

tbzhang 1 week ago
parent
commit
ba6c21d5fe

+ 27 - 0
src/main/java/thyyxxk/webserver/controller/DictController.java

@@ -0,0 +1,27 @@
+package thyyxxk.webserver.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.service.DictService;
+
+import java.util.HashMap;
+import java.util.List;
+
+@RestController
+@RequestMapping("/dict")
+public class DictController {
+
+    private final DictService service;
+
+    public DictController(DictService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectDictDataList")
+    ResultVo<List<HashMap<String, Object>>> selectDictDataList(@RequestParam("dictType") String dictType){
+        return service.selectDictDataList(dictType);
+    }
+}

+ 16 - 0
src/main/java/thyyxxk/webserver/dao/DictDao.java

@@ -0,0 +1,16 @@
+package thyyxxk.webserver.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Mapper
+public interface DictDao {
+
+    @Select("select dict_label as name, dict_value as code from mat_dict_data where dict_type = #{dictType} and status = #{status} order by dict_sort")
+    List<HashMap<String, Object>> selectDictDataList(String dictType, String status);
+
+
+}

+ 23 - 0
src/main/java/thyyxxk/webserver/service/DictService.java

@@ -0,0 +1,23 @@
+package thyyxxk.webserver.service;
+
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.dao.DictDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class DictService {
+    private final DictDao dao;
+
+    public ResultVo<List<HashMap<String, Object>>> selectDictDataList(String dictType){
+
+        return ResultVoUtil.success(dao.selectDictDataList(dictType,"0"));
+    }
+}