package com.product.org.admin.service; import com.alibaba.druid.util.StringUtils; import com.product.core.spring.context.SpringMVCContextHolder; import com.product.org.admin.config.CmnConst; import com.product.util.BaseUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.product.core.dao.BaseDao; import com.product.core.entity.DataTableEntity; import com.product.core.entity.FieldSetEntity; import com.product.core.exception.BaseException; import com.product.core.service.support.AbstractBaseService; /** * Copyright LX-BASE * * @Title: CompanyService * @Project: LX-BASE-SERVER * @Date: 2020年5月29日 上午11:00:39 * @Author: 郑盟 * @Description:单位基本信息配置,对应单位表 */ @Component public class CompanyService extends AbstractBaseService { @Autowired public BaseDao baseDao; /** * 单位详情 * * @param : fs 详情参数org_level_uuid * @return :FieldSetEntity */ public FieldSetEntity findCompany(FieldSetEntity fs) throws BaseException { FieldSetEntity fieldSetEntity = baseDao.listInternationDataTable(baseDao.getFieldSetEntityByFilter("product_sys_company", "org_level_uuid=?", new String[]{fs.getString("org_level_uuid")}, false), null); if (fieldSetEntity == null) { return null; } return fieldSetEntity; } public Boolean updateCompany(FieldSetEntity fse) throws BaseException { if (!StringUtils.isEmpty(fse.getString("del"))) { String[] dels = fse.getString("del").split(","); for (int i = 0; i < dels.length; i++) { baseDao.delete("product_sys_attachments", "uuid=?", new String[]{dels[i]}); } } return baseDao.update(fse); } /** * levels单位详情 * * @param : fs 详情参数uuid * @return :FieldSetEntity */ public FieldSetEntity findLevelAll(FieldSetEntity fs) throws BaseException { return baseDao.getFieldSetEntity("product_sys_org_levels", fs.getString("uuid"), false); } /** * 删除单位详情 * * @param : fs 详情参数org_level_uuid * @return :FieldSetEntity */ public boolean deleteCompanyList(FieldSetEntity fs) throws BaseException { return baseDao.delete("product_sys_company", "org_level_uuid=?", new String[]{fs.getString("org_level_uuid")}); } /** * 获取当前用户的关联公司 * * @param filter * @return */ public DataTableEntity relationCompany(String filter) throws BaseException { if (filter == null) { return null; } DataTableEntity dataTableEntity = baseDao.listTable("product_sys_org_levels", filter,CmnConst.ORG_LEVEL_CODE); if (dataTableEntity == null) { return null; } return BaseUtil.dataTableToTreeTable(dataTableEntity, CmnConst.ORG_LEVEL_CODE, CmnConst.ORG_LEVEL_CODE_PARENT, null); } }