zhitong.yu
2024-04-18 a239a844f00b4a75c7f22db8a834fc8b5f92b54f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.hxzk.controller;
 
import cn.hutool.json.JSONObject;
import com.hxzk.pojo.TbDepartment;
import com.hxzk.pojo.TbNav;
import com.hxzk.service.BuMenService;
import com.hxzk.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
 
@RestController
@RequestMapping("/")
public class NavController {
    @Autowired
    NavService navService;
 
    @Autowired
    BuMenService buMenService;
 
 
    @ResponseBody
    @RequestMapping(value = {"/jiedepartment.do"}, method = {RequestMethod.POST, RequestMethod.GET})
    public JSONObject jiedepartment(HttpServletRequest request) {
        JSONObject json = new JSONObject();
        List<TbDepartment> departmentManagementList = buMenService.list();
        List<TbNav> navList = navService.findall();
        json.put("dataList", departmentManagementList);
        json.put("dataList2", navList);
        return json;
    }
    public String gettime(){
        Date now = new Date();
        // 创建日期格式化对象,设置格式为 "yyyy-MM-dd HH:mm"
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        // 格式化日期对象,输出字符串结果
        String formattedDate = sdf.format(now);
        return formattedDate;
    }
}