package com.sifang.modules.q7link.service;


import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.q7link.dao.CrmSupplyMaterialProjectDao;
import com.sifang.modules.q7link.entity.CrmSupplyMaterialProject;
import com.sifang.modules.sys.common.service.BaseService;
import org.springframework.stereotype.Service;

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

@Service
public class CrmSupplyMaterialProjectService extends BaseService {

    @Resource
    private CrmSupplyMaterialProjectDao dao;



    public String save(CrmSupplyMaterialProject obj){
        dao.save(obj);
        return obj.getId();
    }

    public List<CrmSupplyMaterialProject> queryList(){
        List<CrmSupplyMaterialProject> list=new ArrayList<>();
        String querySql="select id,code,name from crm_supply_material_project where status='0'";
        List<Record> lists=Db.find(querySql);
        for(Record rd:lists){
            CrmSupplyMaterialProject obj=new CrmSupplyMaterialProject();
            obj.setId(rd.get("id"));
            obj.setCode(rd.get("code"));
            obj.setName(rd.get("name"));
            list.add(obj);
        }
        return list;
    }


}
