package com.yunhai.notice.controller.api; import com.yunhai.notice.service.DictService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; /** * 系统字典接口(兼容前端 Notice3.0 URL)。 * 路径前缀: /{platform}/base/ * 返回裸对象,由 ApiResponseAdvice 自动包装为 {code, msg, data}。 */ @RestController @RequestMapping(value = "/{platform}/base/") public class DictController { @Autowired private DictService dictService; // ============================ GetSysDic ============================ /** * 获取系统字典(下拉框用)。 * 前端: GET base/GetSysDic?Type=1 */ @GetMapping("GetSysDic") public List> getSysDic(@RequestParam(value = "type", defaultValue = "0") Integer type) { return dictService.getSysDic(type); } // ============================ GetDictMangeList ============================ /** * 获取系统字典管理列表。 * 前端: GET base/GetDictMangeList?type=dept */ @GetMapping("GetDictMangeList") public List> getDictMangeList(@RequestParam(value = "type", defaultValue = "dept") String type) { return dictService.getDictMangeList(type); } // ============================ AddDeptDic ============================ /** * 添加发文单位。 * 前端: POST base/AddDeptDic (form-urlencoded: Name) */ @PostMapping("AddDeptDic") public void addDeptDic(@RequestParam("name") String name) { dictService.addDeptDic(name); } // ============================ UpdateDeptDic ============================ /** * 更新发文单位。 * 前端: POST base/UpdateDeptDic (form-urlencoded: SerID, Name, Enable) */ @PostMapping("UpdateDeptDic") public void updateDeptDic( @RequestParam("SerID") Integer serID, @RequestParam("Name") String name, @RequestParam(value = "Enable", required = false, defaultValue = "1") Integer enable) { dictService.updateDeptDic(serID, name, enable); } // ============================ DelDept ============================ /** * 删除发文单位。 * 前端: GET base/DelDept?serid=xxx */ @GetMapping("DelDept") public void delDept(@RequestParam("serid") Integer serID) { dictService.delDept(serID); } // ============================ OrdbyDicIds ============================ /** * 发文单位排序。 * 前端: GET base/OrdbyDicIds?ids=1,2,3 */ @GetMapping("OrdbyDicIds") public void ordbyDicIds(@RequestParam("ids") String ids) { dictService.ordbyDicIds(ids); } // ============================ GetDeptSync ============================ /** * 发文单位同步。 * 前端: GET base/GetDeptSync */ @GetMapping("GetDeptSync") public void getDeptSync() { dictService.getDeptSync(); } // ============================ GetSchModuleIsSms ============================ /** * 是否发送短信。 * 前端: GET base/GetSchModuleIsSms */ @GetMapping("GetSchModuleIsSms") public Boolean getSchModuleIsSms() { return dictService.getSchModuleIsSms(); } }