package com.product.admin.service;
|
|
import com.product.admin.config.CmnConst;
|
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.permission.PermissionService;
|
import com.product.core.service.support.AbstractBaseService;
|
import com.product.core.service.support.QueryFilterService;
|
import com.product.core.spring.context.SpringMVCContextHolder;
|
import com.product.core.transfer.Transactional;
|
import com.product.util.BaseUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Date;
|
|
/**
|
* Copyright LX-BASE
|
* @Title: CodeLogicService
|
* @Project: LX-BASE-SERVICE
|
* @Date: 2020-9-9 13:55
|
* @Author: ZhouJie
|
* @Description: 代码逻辑配置
|
*/
|
@Component
|
public class CodeLogicService extends AbstractBaseService {
|
|
@Autowired
|
public BaseDao baseDao;
|
@Autowired
|
PermissionService permissionService;
|
@Autowired
|
QueryFilterService queryFilterService;
|
|
/**
|
* 代码逻辑查询列表
|
* @param cpage
|
* @param pagesize
|
* @return
|
* @throws BaseException
|
*/
|
public DataTableEntity getCodeLogicList(FieldSetEntity fse) throws BaseException{
|
String queryFilter;
|
if(BaseUtil.dataTableIsEmpty(fse.getSubDataTable("systemSeniorQueryString"))){
|
queryFilter = "";
|
}else {
|
queryFilter = " WHERE " + queryFilterService.getQueryFilter(fse);
|
}
|
String sql="SELECT * FROM product_sys_org_levels_change_process"+queryFilter;
|
DataTableEntity dTableEntity = baseDao.listTable(sql, new Object[] {},fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE));
|
if (dTableEntity!=null && dTableEntity.getRows()>0) {
|
baseDao.listInternationDataTable(dTableEntity, null);
|
}
|
baseDao.loadPromptData(dTableEntity);
|
return dTableEntity;
|
}
|
|
/**
|
* 代码逻辑配置详情
|
* @param uuid
|
* @return
|
* @throws BaseException
|
*/
|
public FieldSetEntity getCodeLogicInfo(String uuid) throws BaseException{
|
return baseDao.listInternationDataTable(baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_ORG_LEVELS_CHANGE_PROCESS, uuid, true),null);
|
}
|
|
/**
|
* 新增代码逻辑配置
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
@Transactional
|
public String addCodeLogic(FieldSetEntity fse)throws BaseException{
|
fse.setValue(CmnConst.CREATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
|
fse.setValue(CmnConst.PRODUCT_SYS_ORG_LEVELS_CHANGE_PROCESS, new Date());
|
return baseDao.add(fse);
|
}
|
|
/**
|
* 修改代码逻辑配置
|
* @param fse
|
* @return
|
* @throws BaseExceptionz
|
*/
|
@Transactional
|
public boolean updateCodeLogic(FieldSetEntity fse)throws BaseException{
|
fse.setValue(CmnConst.UPDATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
|
fse.setValue(CmnConst.PRODUCT_SYS_ORG_LEVELS_CHANGE_PROCESS, new Date());
|
return update(fse);
|
}
|
|
/**
|
* 删除代码逻辑配置
|
* @param fse
|
* @return
|
* @throws BaseException
|
*/
|
@Transactional
|
public boolean deleteCodeLogic(FieldSetEntity fse) throws BaseException {
|
return baseDao.delete(CmnConst.PRODUCT_SYS_ORG_LEVELS_CHANGE_PROCESS, "uuid=?", new Object[] {fse.getString("uuid")});
|
}
|
|
|
}
|