package com.hzya.frame.grpU8.dictAcctSubj.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntityVo;
import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntity;
import com.hzya.frame.grpU8.dictAcctSubj.dao.IDictAcctSubjDao;
import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntityVo;
import com.hzya.frame.grpU8.dictAcctSubj.service.IDictAcctSubjService;
import org.springframework.stereotype.Service; 
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;

import java.util.List;

/**
 * 子表(DictAcctSubj)表服务实现类
 *
 * @author makejava
 * @since 2024-07-09 11:23:36
 */
@Service(value = "dictAcctSubjService")
public class DictAcctSubjServiceImpl extends BaseService<DictAcctSubjEntity, String> implements IDictAcctSubjService {
     
    private IDictAcctSubjDao dictAcctSubjDao;
    
    @Autowired
	public void setDictAcctSubjDao(IDictAcctSubjDao dao) {
		this.dictAcctSubjDao = dao;
		this.dao = dao;
	}
	/**
	 * @param jsonObject
	 * @return com.hzya.frame.web.entity.JsonResultEntity
	 * @Author lvleigang
	 * @Description 数据表
	 * @Date 11:52 上午 2024/3/27
	 **/
	@Override
	public Object queryData(JSONObject jsonObject) {
		DictAcctSubjEntity entity = getData("jsonStr", jsonObject, DictAcctSubjEntity.class);
		if(entity == null ){
			entity = new DictAcctSubjEntity();
		}
		//判断分页
		if (entity.getPageNum() != null && entity.getPageSize() != null) {
			PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
			List<DictAcctSubjEntityVo> list = dictAcctSubjDao.queryData(entity);
			PageInfo pageInfo = new PageInfo(list);
			JSONObject object = new JSONObject();
			object.put("status","success");
			object.put("data",pageInfo);
			return object;
		}else {
			List<DictAcctSubjEntityVo> list = dictAcctSubjDao.queryData(entity);
			JSONObject object = new JSONObject();
			object.put("status","success");
			object.put("data",list);
			return object;		}
	}
}
