fix:数据字典无法添加和正确修改bug修改
parent
c6756775ce
commit
8498476226
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -22,6 +24,7 @@ public class AssetDataDict extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 数据接入id */
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonKey;
|
||||
|
@ -26,10 +28,11 @@ public class DictInfo extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 接入id */
|
||||
@Excel(name = "接入id")
|
||||
@Excel(name = "字典id")
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
|
@ -64,11 +64,18 @@ public class AssetDataDictServiceImpl extends ServiceImpl<AssetDataDictMapper, A
|
|||
@Override
|
||||
public boolean insertAssetDataDict(AssetDataDict assetDataDict) throws ServletException {
|
||||
assetDataDict.setCreateTime(DateUtils.getNowDate());
|
||||
boolean b = this.saveOrUpdate(assetDataDict, new LambdaUpdateChainWrapper<AssetDataDict>(AssetDataDict.class) {{
|
||||
AssetDataDict one = this.getOne(new LambdaQueryWrapper<AssetDataDict>(AssetDataDict.class) {{
|
||||
eq(AssetDataDict::getDictType, assetDataDict.getDictType());
|
||||
eq(AssetDataDict::getBasicId, assetDataDict.getBasicId());
|
||||
}});
|
||||
if (one!=null){
|
||||
throw new ServletException("该字典已存在");
|
||||
}
|
||||
boolean b = this.saveOrUpdate(assetDataDict, new LambdaUpdateWrapper<AssetDataDict>(AssetDataDict.class) {{
|
||||
eq(AssetDataDict::getDictType,assetDataDict.getDictType());
|
||||
eq(AssetDataDict::getBasicId,assetDataDict.getBasicId());
|
||||
}});
|
||||
if (!b)throw new ServletException("该字典已存在");
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import com.muyu.etl.mapper.DictInfoMapper;
|
||||
import com.muyu.etl.service.DictInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.DictInfoMapper;
|
||||
import com.muyu.etl.domain.DictInfo;
|
||||
import com.muyu.etl.service.DictInfoService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典详细内容Service业务层处理
|
||||
|
@ -22,8 +22,7 @@ import javax.servlet.ServletException;
|
|||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> implements DictInfoService
|
||||
{
|
||||
public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper, DictInfo> implements DictInfoService {
|
||||
@Autowired
|
||||
private DictInfoMapper dictInfoMapper;
|
||||
|
||||
|
@ -34,8 +33,7 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
* @return 字典详细内容
|
||||
*/
|
||||
@Override
|
||||
public DictInfo selectDictInfoById(Long id)
|
||||
{
|
||||
public DictInfo selectDictInfoById(Long id) {
|
||||
return dictInfoMapper.selectDictInfoById(id);
|
||||
}
|
||||
|
||||
|
@ -46,8 +44,7 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
* @return 字典详细内容
|
||||
*/
|
||||
@Override
|
||||
public List<DictInfo> selectDictInfoList(DictInfo dictInfo)
|
||||
{
|
||||
public List<DictInfo> selectDictInfoList(DictInfo dictInfo) {
|
||||
return dictInfoMapper.selectDictInfoList(dictInfo);
|
||||
}
|
||||
|
||||
|
@ -60,11 +57,19 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
@Override
|
||||
public boolean insertDictInfo(DictInfo dictInfo) throws ServletException {
|
||||
dictInfo.setCreateTime(DateUtils.getNowDate());
|
||||
boolean b = this.saveOrUpdate(dictInfo, new LambdaUpdateChainWrapper<DictInfo>(DictInfo.class) {{
|
||||
DictInfo one = this.getOne(new LambdaQueryWrapper<DictInfo>() {{
|
||||
eq(DictInfo::getDictId, dictInfo.getDictId());
|
||||
eq(DictInfo::getId, dictInfo.getId());
|
||||
eq(DictInfo::getInfoName, dictInfo.getInfoName());
|
||||
eq(DictInfo::getInfoValue, dictInfo.getInfoValue());
|
||||
}});
|
||||
if (one!=null){
|
||||
throw new ServletException("该字典内容已存在");
|
||||
}
|
||||
boolean b = this.saveOrUpdate(dictInfo, new LambdaUpdateWrapper<DictInfo>(DictInfo.class) {{
|
||||
eq(DictInfo::getDictId, dictInfo.getDictId());
|
||||
eq(DictInfo::getInfoName, dictInfo.getInfoName());
|
||||
eq(DictInfo::getInfoValue, dictInfo.getInfoValue());
|
||||
}});
|
||||
if (!b)throw new ServletException("该字典内容已存在");
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -75,8 +80,7 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictInfo(DictInfo dictInfo)
|
||||
{
|
||||
public int updateDictInfo(DictInfo dictInfo) {
|
||||
dictInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return dictInfoMapper.updateDictInfo(dictInfo);
|
||||
}
|
||||
|
@ -88,8 +92,7 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictInfoByIds(Long[] ids)
|
||||
{
|
||||
public int deleteDictInfoByIds(Long[] ids) {
|
||||
return dictInfoMapper.deleteDictInfoByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -100,8 +103,7 @@ public class DictInfoServiceImpl extends ServiceImpl<DictInfoMapper,DictInfo> im
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictInfoById(Long id)
|
||||
{
|
||||
public int deleteDictInfoById(Long id) {
|
||||
return dictInfoMapper.deleteDictInfoById(id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue