/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.workcontent.service;

import java.util.List;

import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.service.CrudService;
import com.jeeplus.modules.workcontent.entity.WorkContentDocument;
import com.jeeplus.modules.workcontent.dao.WorkContentDocumentDao;

/**
 * 资料管理Service
 * @author ssrh
 * @version 2018-06-06
 */
@Service
@Transactional(readOnly = true)
public class WorkContentDocumentService extends CrudService<WorkContentDocumentDao, WorkContentDocument> implements WorkContentDetailBaseService {

	public WorkContentDocument get(String id) {
		return super.get(id);
	}
	
	public List<WorkContentDocument> findList(WorkContentDocument workContentDocument) {
		return super.findList(workContentDocument);
	}
	
	public Page<WorkContentDocument> findPage(Page<WorkContentDocument> page, WorkContentDocument workContentDocument) {
		return super.findPage(page, workContentDocument);
	}
	
	@Transactional(readOnly = false)
	public void save(WorkContentDocument workContentDocument) {
		super.save(workContentDocument);
	}
	
	@Transactional(readOnly = false)
	public void delete(WorkContentDocument workContentDocument) {
		super.delete(workContentDocument);
	}


    @Override
    @Transactional(readOnly = false)
    public void saveDetails(String detailStr, String projectId, String contentId) {
        WorkContentDocument newRecord = JSON.parseObject(detailStr,WorkContentDocument.class);
        newRecord.setProjectId(projectId);
        newRecord.setContentId(contentId);
        this.save(newRecord);
    }

}