package com.corewing.app.modules.app;

import com.corewing.app.entity.PrivacyPolicy;
import com.corewing.app.service.PrivacyPolicyService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * 隐私政策与协议
 */
@Controller
@RequestMapping("/privacy_policy")
public class AppPrivacyPolicyController {

    @Resource
    private PrivacyPolicyService privacyPolicyService;

    /**
     * 隐私政策列表
     * @return
     */
    @GetMapping("/view_list/{lang}")
    public String viewList(@PathVariable String lang, ModelMap modelMap) {
        List<PrivacyPolicy> list = privacyPolicyService.list();
        modelMap.put("list", list);
        // 获取最新更新时间
        modelMap.put("lastUpdateTime", privacyPolicyService.getLastUpdateTime());
        return "app/privacyPolicy/index";
    }

}
