package com.sa.ibiz.demo.demo.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sa.ibiz.demo.demo.mapper.TSSDTaskMapper;
import com.sa.ibiz.demo.demo.domain.TSSDTask;
import com.sa.ibiz.demo.demo.service.TSSDTaskService;
import com.sa.ibiz.demo.ibizutil.service.ServiceImplBase;
import com.sa.ibiz.demo.demo.service.dto.TSSDTaskSearchFilter;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import java.util.UUID;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.math.BigInteger;
import com.sa.ibiz.demo.ibizutil.annotation.PreField;
import java.lang.reflect.Field;

import com.sa.ibiz.demo.demo.service.TSSDEngineService;

/**
 * 实体[TSSDTask] 服务对象接口实现
 */
@Service
public class TSSDTaskServiceImpl extends ServiceImplBase<TSSDTaskMapper, TSSDTask> implements TSSDTaskService{

    @Autowired
    private TSSDEngineService tssdengineService;

    @Resource
    private TSSDTaskMapper tssdtaskMapper;


    @Override
    public boolean create(TSSDTask et) {
        this.beforeCreate(et);
         return super.create(et);
    }
    @Override
    public boolean update(TSSDTask et){
        this.beforeUpdate(et);
		this.tssdtaskMapper.updateOne(et);
		this.get(et);
		return true;
    }

    public Object getEntityKey(TSSDTask et){
		return et.getTssdtaskid();  
    }

    @Override
    public boolean getDraft(TSSDTask et)  {
    if((!StringUtils.isEmpty(et.getTssdengineid())) && et.getTssdengine() == null){
            try {
                et.setTssdengine(tssdengineService.getById(et.getTssdengineid()));
            }catch (Exception ex){}
        }
            return true;
    }

	public List<TSSDTask> listDefault(TSSDTaskSearchFilter filter) {
		return tssdtaskMapper.searchDefault(filter,filter.getSelectCond());
	}

	public Page<TSSDTask> searchDefault(TSSDTaskSearchFilter filter) {
		return tssdtaskMapper.searchDefault(filter.getPage(),filter,filter.getSelectCond());
	}

    public  List<Map<String,Object>> selectRow(String sql){
       return tssdtaskMapper.selectRow(sql);
    }

 }