package com.yeejoin.amos.boot.module.common.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireChemical;
import com.yeejoin.amos.boot.module.common.api.mapper.FireChemicalMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireChemicalService;

import org.springframework.stereotype.Service;

import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;

import java.util.Arrays;
import java.util.List;
/**
* 危化品服务实现类
*
* @author system_generator
* @date 2021-06-29
*/
@Service
public class FireChemicalServiceImpl extends BaseService<FireChemicalDto,FireChemical,FireChemicalMapper> implements IFireChemicalService {
        /**
         * 分页查询
         */
        @Override
        public Page<FireChemicalDto> queryForFireChemicalPage(Page<FireChemicalDto> page,   @Condition(Operator.like) String casNo, @Condition(Operator.like)String formula, @Condition(Operator.like)String name, String typeCode,boolean isDelete)   {
                if(typeCode.equals("-1")) { // bug 2673 选择 -1 时候没有查出所有危化品处理 by kongfm
                        typeCode = null;
                }
           return this.queryForPage(page, "", false,casNo, formula, name,  typeCode, isDelete);
        }

        /**
         * 列表查询 示例
         */
        public List<FireChemicalDto> queryForFireChemicalList(@Condition(Operator.eq) Boolean isDelete)   {
                return this.queryForList("" , false,isDelete);
        }
        /**
         * 删除
         * */
        public Boolean updateisDelete( List sequenceNbr)   {
        	
        	return this.update(new UpdateWrapper<FireChemical>().in("sequence_nbr", sequenceNbr).set("is_delete", 1));         	
       }
}
