package com.hzs.system.home.controller.api;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hzs.common.core.utils.StringUtils;
import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.page.TableDataInfo;
import com.hzs.common.domain.system.ext.HoMemoirProcessExt;
import com.hzs.common.domain.system.home.HoMemoirProcess;
import com.hzs.system.home.service.IHoMemoirProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 大事记-发展历程 前端控制器
 * </p>
 *
 * @author hzs
 * @since 2022-12-01
 */
@RestController
@RequestMapping("/api/ho-memoir-process")
public class ApiHoMemoirProcessController extends BaseController {

    @Autowired
    private IHoMemoirProcessService memoirProcessExtService;

    /**
     * @description: 查询大事记-发展历程列表
     * @author: zhang jing
     * @date: 2022/8/30 10:20
     * @param: [memoirProcessExt]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @GetMapping("/list")
    public TableDataInfo list(HoMemoirProcessExt memoirProcessExt) {
        QueryWrapper<HoMemoirProcess> queryWrapper = new QueryWrapper();
        if(null!=memoirProcessExt.getLanguageType()){
            if(memoirProcessExt.getLanguageType()!=1){
                queryWrapper.ne("PK_COUNTRY",memoirProcessExt.getPkCountry());
            }else{
                queryWrapper.eq("PK_COUNTRY",memoirProcessExt.getPkCountry());
            }
        }
        queryWrapper.lt("EFFECTIVE_DATE",new Date());
        queryWrapper.orderByAsc("SORT");
        List<HoMemoirProcess> list = memoirProcessExtService.list(queryWrapper);
        return getDataTable(list);
    }



}
