|
@@ -1,5 +1,6 @@
|
|
|
package com.middle.platform.system.biz.service;
|
|
package com.middle.platform.system.biz.service;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -10,6 +11,7 @@ import com.middle.platform.system.api.pojo.DictCache;
|
|
|
import com.middle.platform.system.api.pojo.DictDto;
|
|
import com.middle.platform.system.api.pojo.DictDto;
|
|
|
import com.middle.platform.system.biz.entity.SysDictItem;
|
|
import com.middle.platform.system.biz.entity.SysDictItem;
|
|
|
import com.middle.platform.system.biz.mapper.SysDictItemMapper;
|
|
import com.middle.platform.system.biz.mapper.SysDictItemMapper;
|
|
|
|
|
+import com.middle.platform.system.biz.pojo.req.SysDictItemPara;
|
|
|
import com.middle.platform.system.biz.pojo.res.SysDictItemVo;
|
|
import com.middle.platform.system.biz.pojo.res.SysDictItemVo;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -84,4 +86,43 @@ public class SysDictItemService {
|
|
|
public DictCache query(String dictType, String value) {
|
|
public DictCache query(String dictType, String value) {
|
|
|
return sysDictItemMapper.queryOne(dictType, value);
|
|
return sysDictItemMapper.queryOne(dictType, value);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增字典项
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author Aick Spt
|
|
|
|
|
+ * @date 2023-12-22 17:10
|
|
|
|
|
+ */
|
|
|
|
|
+ public int saveItemOne(SysDictItemPara sysDictItemPara) {
|
|
|
|
|
+ sysDictItemPara.setId(null);
|
|
|
|
|
+ if (sysDictItemPara.getSort() == null) {
|
|
|
|
|
+ sysDictItemPara.setSort(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sysDictItemPara.getDesc() == null) {
|
|
|
|
|
+ sysDictItemPara.setDesc(sysDictItemPara.getLabel());
|
|
|
|
|
+ }
|
|
|
|
|
+ SysDictItem sysDictItem = new SysDictItem();
|
|
|
|
|
+ BeanUtil.copyProperties(sysDictItemPara, sysDictItem);
|
|
|
|
|
+ return sysDictItemMapper.insert(sysDictItem);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public int remove(Long id) {
|
|
|
|
|
+ return sysDictItemMapper.delete(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public int update(SysDictItemPara sysDictItemPara) {
|
|
|
|
|
+ Long id = sysDictItemPara.getId();
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ throw new RuntimeException("ID必填");
|
|
|
|
|
+ }
|
|
|
|
|
+ SysDictItem sysDictItem = sysDictItemMapper.getById(id);
|
|
|
|
|
+ if (Objects.isNull(sysDictItem)) {
|
|
|
|
|
+ throw new RuntimeException("数据不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ BeanUtil.copyProperties(sysDictItemPara, sysDictItem);
|
|
|
|
|
+ return sysDictItemMapper.update(sysDictItem);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|