标签修改
This commit is contained in:
+18
-13
@@ -369,22 +369,27 @@ public class SysDictController {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
try {
|
||||
Integer count = sysDictService.queryExitData(sysDict);
|
||||
Integer countDictName=sysDictService.queryExitDictName(sysDict);
|
||||
System.out.println("count="+count);
|
||||
|
||||
if (count > 0) {
|
||||
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
} else {
|
||||
if(sysDict.getIsTagDict() == 1){
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(sysDict.getDictName());
|
||||
sysDict.setDictCode(pinYin);
|
||||
if (countDictName > 0) {
|
||||
result.error500("标签名称不能重复");
|
||||
}else{
|
||||
//判断逻辑删除
|
||||
if (count > 0) {
|
||||
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
} else {
|
||||
if(sysDict.getIsTagDict() == 1){
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(sysDict.getDictName());
|
||||
sysDict.setDictCode(pinYin.replace(" ","_"));
|
||||
}
|
||||
sysDict.setCreateTime(new Date());
|
||||
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
sysDictService.save(sysDict);
|
||||
}
|
||||
sysDict.setCreateTime(new Date());
|
||||
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
sysDictService.save(sysDict);
|
||||
result.success("保存成功!");
|
||||
//添加成功后需要刷新缓存
|
||||
sysDictService.refreshCache();
|
||||
}
|
||||
result.success("保存成功!");
|
||||
//添加成功后需要刷新缓存
|
||||
sysDictService.refreshCache();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
|
||||
+7
-25
@@ -3,14 +3,13 @@ package com.jero.modules.tag.controller;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.generater.modules.online.cgform.controller.OnlCgformApiController;
|
||||
import com.jero.modules.enums.FixedFieldEnum;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.tag.entity.OnlCgformArea;
|
||||
import com.jero.modules.tag.entity.OnlCgformTag;
|
||||
import com.jero.modules.tag.service.IOnlCgformTagService;
|
||||
import com.jero.modules.utils.HanYuPinYinUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,7 +22,6 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -46,6 +44,8 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
|
||||
private OnlCgformTagController onlCgformAreaService;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemService;
|
||||
@Autowired
|
||||
private OnlCgformApiController onlCgformApiController;
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -82,28 +82,8 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
|
||||
@ApiOperation(value="标签管理-添加", notes="标签管理-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformTag onlCgformTag) {
|
||||
Integer count=onlCgformTagService.queryExitData(onlCgformTag);
|
||||
if (count > 0) {
|
||||
onlCgformTag.setIsDelete(CommonConstant.DEL_FLAG_0);
|
||||
} else {
|
||||
onlCgformTag.setCreateTime(new Date());
|
||||
onlCgformTag.setIsDelete(CommonConstant.DEL_FLAG_0);
|
||||
onlCgformTag.setCgformHeadId("48308196e7b04761b533dc31bc899707");//设置文档库-表id
|
||||
onlCgformTag.setDbIsKey(0);
|
||||
onlCgformTag.setDbIsNull(1);
|
||||
onlCgformTag.setDbPointLength(0);
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(onlCgformTag.getDbFieldTxt());
|
||||
onlCgformTag.setDbFieldName(pinYin.replace(" ","_"));
|
||||
onlCgformTag.setDbFieldEnName(onlCgformTag.getDbFieldEnName().replace(" ","_"));
|
||||
if(onlCgformTag.getFieldShowType()=="2"){
|
||||
onlCgformTag.setDbType("int");
|
||||
}else if(onlCgformTag.getFieldShowType()=="5" && onlCgformTag.getFieldShowType()=="6"){
|
||||
onlCgformTag.setDbType("Date");
|
||||
}else{
|
||||
onlCgformTag.setDbType("String");
|
||||
}
|
||||
onlCgformTagService.add(onlCgformTag);
|
||||
}
|
||||
onlCgformTagService.add(onlCgformTag);
|
||||
onlCgformApiController.h("48308196e7b04761b533dc31bc899707","normal");
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@@ -121,6 +101,7 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
|
||||
return Result.error("固定字段,不可修改");
|
||||
}else {
|
||||
onlCgformTagService.editById(onlCgformTag);
|
||||
onlCgformApiController.h("48308196e7b04761b533dc31bc899707","normal");
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
}
|
||||
@@ -142,6 +123,7 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
|
||||
result.error500("固定字段,不可删除");
|
||||
} else {
|
||||
onlCgformTagService.deleteById(id);
|
||||
onlCgformApiController.h("48308196e7b04761b533dc31bc899707","normal");
|
||||
result.OK("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -17,9 +17,10 @@ import java.util.Map;
|
||||
public interface OnlCgformTagMapper extends BaseMapper<OnlCgformTag> {
|
||||
@Select("select f.id,f.create_by,f.create_time,f.update_by,f.update_time,f.cgform_head_id,\n" +
|
||||
"f.is_model,f.db_field_txt,f.db_field_en_name,\n" +
|
||||
"f.field_show_type,i.item_text,f.dict_id,f.db_length,\n" +
|
||||
"f.order_num,f.field_must_input,f.is_show_form,f.is_show_list,\n" +
|
||||
"f.is_read_only,f.show_area,a.show_area as show_area_name,f.is_query,f.is_show_laws_list,f.is_show_search,f.is_delete,\n" +
|
||||
"f.field_show_type,i.item_text as field_show_type_name,\n" +
|
||||
"f.dict_id,f.db_length,f.order_num,f.field_must_input,\n" +
|
||||
"f.is_show_form,f.is_show_list,f.is_read_only,\n" +
|
||||
"f.show_area,a.show_area as show_area_name,f.is_query,f.is_show_laws_list,f.is_show_search,f.is_delete,\n" +
|
||||
"f.db_field_name,f.db_is_key,f.db_is_null,f.db_point_length,f.db_type,\n" +
|
||||
"i.en_name as field_show_type_en_name,a.en_name as show_area_en_name\n" +
|
||||
"from onl_cgform_field as f \n" +
|
||||
|
||||
+21
@@ -43,6 +43,27 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
|
||||
*/
|
||||
@Override
|
||||
public void add(OnlCgformTag onlCgformTag) {
|
||||
Integer count=queryExitData(onlCgformTag);
|
||||
if (count > 0) {
|
||||
onlCgformTag.setIsDelete(CommonConstant.DEL_FLAG_0);
|
||||
} else {
|
||||
onlCgformTag.setIsDelete(CommonConstant.DEL_FLAG_0);
|
||||
onlCgformTag.setCgformHeadId("48308196e7b04761b533dc31bc899707");//设置文档库-表id
|
||||
onlCgformTag.setDbIsKey(0);
|
||||
onlCgformTag.setDbIsNull(1);
|
||||
onlCgformTag.setDbPointLength(0);
|
||||
onlCgformTag.setIsReadOnly(0);
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(onlCgformTag.getDbFieldTxt());
|
||||
onlCgformTag.setDbFieldName(pinYin.replace(" ","_"));
|
||||
onlCgformTag.setDbFieldEnName(onlCgformTag.getDbFieldEnName().replace(" ","_"));
|
||||
if(onlCgformTag.getFieldShowType()=="2"){
|
||||
onlCgformTag.setDbType("int");
|
||||
}else if(onlCgformTag.getFieldShowType()=="5" && onlCgformTag.getFieldShowType()=="6"){
|
||||
onlCgformTag.setDbType("Date");
|
||||
}else{
|
||||
onlCgformTag.setDbType("String");
|
||||
}
|
||||
}
|
||||
Date now = new Date();
|
||||
onlCgformTag.setCreateTime(now);
|
||||
onlCgformTag.setUpdateTime(now);
|
||||
|
||||
Reference in New Issue
Block a user