| | |
| | | package com.yeshi.fanli.service.impl.config;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | |
|
| | | @Service
|
| | | public class SystemClientParamsServiceImpl implements SystemClientParamsService {
|
| | |
|
| | | @Resource
|
| | | private SystemClientParamsMapper systemClientParamsMapper;
|
| | | |
| | | |
| | | @Cacheable(value = "clientParamCache", key = "#systemId+'-'+#version")
|
| | | public List<SystemClientParams> getSystemClientParamsBySystemId(long systemId, int version) {
|
| | | |
| | | return systemClientParamsMapper.listBySystemIdAndMinVersion(systemId,version);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key) {
|
| | | if (system == null) {
|
| | | return null;
|
| | | }
|
| | | return systemClientParamsMapper.getSystemClientParamsBySystemAndKey(system.getId(), key);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public List<SystemClientParams> listQuery(int start, int count, String key, Long systemId) {
|
| | | return systemClientParamsMapper.listQuery(start, count, systemId, key);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countQuery(String key, Long systemId) {
|
| | | return systemClientParamsMapper.countQuery(systemId, key);
|
| | | }
|
| | | |
| | | |
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception {
|
| | | |
| | | if (listId == null || listId.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | SystemClientParams nscp = null;
|
| | | for (Long systemId : listId) {
|
| | | BusinessSystem system = new BusinessSystem(systemId);
|
| | | nscp = new SystemClientParams();
|
| | | nscp.setKey(scp.getKey());
|
| | | nscp.setName(scp.getName());
|
| | | nscp.setValue(scp.getValue());
|
| | | nscp.setSystem(system);
|
| | | nscp.setUpdatetime(java.lang.System.currentTimeMillis());
|
| | | systemClientParamsMapper.insertSelective(nscp);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void update(SystemClientParams systemClientParams) {
|
| | | systemClientParamsMapper.updateByPrimaryKeySelective(systemClientParams);
|
| | | }
|
| | | |
| | | @Override
|
| | | public SystemClientParams selectByPrimaryKey(long id) {
|
| | | return systemClientParamsMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void deleteBatchByPrimaryKey(List<Long> ids) {
|
| | | for (Long id: ids) {
|
| | | systemClientParamsMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.config; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper; |
| | | import com.yeshi.fanli.entity.system.BusinessSystem; |
| | | import com.yeshi.fanli.entity.system.SystemClientParams; |
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService; |
| | | |
| | | @Service |
| | | public class SystemClientParamsServiceImpl implements SystemClientParamsService { |
| | | |
| | | @Resource |
| | | private SystemClientParamsMapper systemClientParamsMapper; |
| | | |
| | | |
| | | @Cacheable(value = "clientParamCache", key = "#systemId+'-'+#version") |
| | | public List<SystemClientParams> getSystemClientParamsBySystemId(long systemId, int version) { |
| | | |
| | | return systemClientParamsMapper.listBySystemIdAndMinVersion(systemId,version); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key) { |
| | | if (system == null) { |
| | | return null; |
| | | } |
| | | return systemClientParamsMapper.getSystemClientParamsBySystemAndKey(system.getId(), key); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<SystemClientParams> listQuery(int start, int count, String key, Long systemId) { |
| | | return systemClientParamsMapper.listQuery(start, count, systemId, key); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public long countQuery(String key, Long systemId) { |
| | | return systemClientParamsMapper.countQuery(systemId, key); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor=Exception.class) |
| | | @Override |
| | | public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception { |
| | | |
| | | if (listId == null || listId.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | SystemClientParams nscp = null; |
| | | for (Long systemId : listId) { |
| | | BusinessSystem system = new BusinessSystem(systemId); |
| | | nscp = new SystemClientParams(); |
| | | nscp.setKey(scp.getKey()); |
| | | nscp.setName(scp.getName()); |
| | | nscp.setValue(scp.getValue()); |
| | | nscp.setSystem(system); |
| | | nscp.setUpdatetime(java.lang.System.currentTimeMillis()); |
| | | systemClientParamsMapper.insertSelective(nscp); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void update(SystemClientParams systemClientParams) { |
| | | systemClientParamsMapper.updateByPrimaryKeySelective(systemClientParams); |
| | | } |
| | | |
| | | @Override |
| | | public SystemClientParams selectByPrimaryKey(long id) { |
| | | return systemClientParamsMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void deleteBatchByPrimaryKey(List<Long> ids) { |
| | | for (Long id: ids) { |
| | | systemClientParamsMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
| | | |
| | | } |