Search in sources :

Example 1 with TbSysProgMultiName

use of com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName in project bamboobsc by billchen198318.

the class MenuSupportUtils method getProgramMultiName.

public static String getProgramMultiName(TbSysProg sysProg, String localeCode) throws ServiceException, Exception {
    if (null == sysProg) {
        return "unknown-program";
    }
    if (LocaleLanguageUtils.getMap().get(localeCode) == null) {
        return sysProg.getName();
    }
    TbSysProgMultiName multiName = new TbSysProgMultiName();
    multiName.setProgId(sysProg.getProgId());
    multiName.setLocaleCode(localeCode);
    multiName = sysProgMultiNameService.findByEntityUK(multiName);
    if (multiName != null && !StringUtils.isBlank(multiName.getName()) && YesNo.YES.equals(multiName.getEnableFlag())) {
        return multiName.getName();
    }
    return sysProg.getName();
}
Also used : TbSysProgMultiName(com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName)

Example 2 with TbSysProgMultiName

use of com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName in project bamboobsc by billchen198318.

the class SystemProgramLogicServiceImpl method delete.

/**
	 * 刪除 TB_SYS_PROG 資料
	 * 
	 * @param sysProg
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(SysProgVO sysProg) throws ServiceException, Exception {
    if (sysProg == null || StringUtils.isBlank(sysProg.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysProgVO> sysProgResult = this.sysProgService.findObjectByOid(sysProg);
    if (sysProgResult.getValue() == null) {
        throw new ServiceException(sysProgResult.getSystemMessage().getValue());
    }
    sysProg = sysProgResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("progId", sysProg.getProgId());
    if (this.sysMenuService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }
    // 刪除 TB_SYS_MENU_ROLE 資料
    List<TbSysMenuRole> sysMenuRoleList = this.sysMenuRoleService.findListByParams(params);
    for (int i = 0; sysMenuRoleList != null && i < sysMenuRoleList.size(); i++) {
        TbSysMenuRole sysMenuRole = sysMenuRoleList.get(i);
        this.sysMenuRoleService.delete(sysMenuRole);
    }
    // 刪除名稱語言資料 tb_sys_prog_multi_name
    List<TbSysProgMultiName> progMultiNames = this.sysProgMultiNameService.findListByParams(params);
    for (int i = 0; progMultiNames != null && i < progMultiNames.size(); i++) {
        this.sysProgMultiNameService.delete(progMultiNames.get(i));
    }
    return this.sysProgService.deleteObject(sysProg);
}
Also used : TbSysMenuRole(com.netsteadfast.greenstep.po.hbm.TbSysMenuRole) TbSysProgMultiName(com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

TbSysProgMultiName (com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 TbSysMenuRole (com.netsteadfast.greenstep.po.hbm.TbSysMenuRole)1 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)1 HashMap (java.util.HashMap)1 Transactional (org.springframework.transaction.annotation.Transactional)1