19 changed files with 2 additions and 1094 deletions
-
185mdp-form/src/main/java/com/mdp/form/ctrl/FormDataTagController.java
-
175mdp-form/src/main/java/com/mdp/form/ctrl/FormDefTagController.java
-
2mdp-form/src/main/java/com/mdp/form/ctrl/FormQxController.java
-
174mdp-form/src/main/java/com/mdp/form/ctrl/FormViewController.java
-
53mdp-form/src/main/java/com/mdp/form/entity/FormDataTag.java
-
29mdp-form/src/main/java/com/mdp/form/entity/FormDataTagVo.java
-
53mdp-form/src/main/java/com/mdp/form/entity/FormDefTag.java
-
22mdp-form/src/main/java/com/mdp/form/entity/FormDefTagVo.java
-
3mdp-form/src/main/java/com/mdp/form/entity/FormField.java
-
25mdp-form/src/main/java/com/mdp/form/mapper/FormDataTagMapper.java
-
17mdp-form/src/main/java/com/mdp/form/mapper/FormDataTagMapper.xml
-
25mdp-form/src/main/java/com/mdp/form/mapper/FormDefTagMapper.java
-
17mdp-form/src/main/java/com/mdp/form/mapper/FormDefTagMapper.xml
-
25mdp-form/src/main/java/com/mdp/form/mapper/FormViewMapper.java
-
17mdp-form/src/main/java/com/mdp/form/mapper/FormViewMapper.xml
-
115mdp-form/src/main/java/com/mdp/form/service/FormDataTagService.java
-
2mdp-form/src/main/java/com/mdp/form/service/FormDefService.java
-
120mdp-form/src/main/java/com/mdp/form/service/FormDefTagService.java
-
37mdp-form/src/main/java/com/mdp/form/service/FormViewService.java
@ -1,185 +0,0 @@ |
|||||
package com.mdp.form.ctrl; |
|
||||
|
|
||||
import java.util.*; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDataTagVo; |
|
||||
import com.mdp.form.service.FormDataService; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestMethod; |
|
||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
import io.swagger.annotations.*; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.mdp.core.entity.Result; |
|
||||
import com.mdp.core.query.QueryTools; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.entity.LangTips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
import com.mdp.core.utils.RequestUtils; |
|
||||
import com.mdp.core.utils.NumberUtil; |
|
||||
import com.mdp.safe.client.entity.User; |
|
||||
import com.mdp.safe.client.utils.LoginUtils; |
|
||||
import com.mdp.swagger.ApiEntityParams; |
|
||||
import io.swagger.annotations.*; |
|
||||
import springfox.documentation.annotations.ApiIgnore; |
|
||||
|
|
||||
import javax.servlet.http.HttpServletRequest; |
|
||||
|
|
||||
import com.mdp.form.service.FormDataTagService; |
|
||||
import com.mdp.form.entity.FormDataTag; |
|
||||
|
|
||||
@RestController |
|
||||
@RequestMapping(value="/**/form/formDataTag") |
|
||||
@Api(tags={"form_data_tag-操作接口"}) |
|
||||
public class FormDataTagController { |
|
||||
|
|
||||
static Logger logger =LoggerFactory.getLogger(FormDataTagController.class); |
|
||||
|
|
||||
@Autowired |
|
||||
private FormDataTagService formDataTagService; |
|
||||
|
|
||||
|
|
||||
@Autowired |
|
||||
private FormDataService formDataService; |
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-查询列表",notes=" ") |
|
||||
@ApiEntityParams(FormDataTag.class) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDataTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|
||||
}) |
|
||||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|
||||
public Result listFormDataTag(@ApiIgnore @RequestParam Map<String,Object> params){ |
|
||||
try { |
|
||||
User user=LoginUtils.getCurrentUserInfo(); |
|
||||
QueryWrapper<FormDataTag> qw = QueryTools.initQueryWrapper(FormDataTag.class , params); |
|
||||
IPage page=QueryTools.initPage(params); |
|
||||
List<Map<String,Object>> datas = formDataTagService.selectListMapByWhere(page,qw,params); |
|
||||
return Result.ok("query-ok","查询成功").setData(datas).setTotal(page.getTotal()); |
|
||||
}catch (BizException e) { |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-新增",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDataTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|
||||
public Result addFormDataTag(@RequestBody FormDataTag formDataTag) { |
|
||||
formDataTagService.save(formDataTag); |
|
||||
return Result.ok("add-ok","添加成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-删除",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
|
||||
}) |
|
||||
@RequestMapping(value="/del",method=RequestMethod.POST) |
|
||||
public Result delFormDataTag(@RequestBody FormDataTag formDataTag){ |
|
||||
formDataTagService.removeById(formDataTag); |
|
||||
return Result.ok("del-ok","删除成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-修改",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDataTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|
||||
public Result editFormDataTag(@RequestBody FormDataTag formDataTag) { |
|
||||
formDataTagService.updateById(formDataTag); |
|
||||
return Result.ok("edit-ok","修改成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-批量修改某些字段",notes="") |
|
||||
@ApiEntityParams( value = FormDataTag.class, props={ }, remark = "form_data_tag", paramType = "body" ) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDataTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
|
||||
public Result editSomeFields( @ApiIgnore @RequestBody Map<String,Object> params) { |
|
||||
try{ |
|
||||
User user= LoginUtils.getCurrentUserInfo(); |
|
||||
formDataTagService.editSomeFields(params); |
|
||||
return Result.ok("edit-ok","更新成功"); |
|
||||
}catch (BizException e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
@ApiOperation( value = "form_data_tag-根据主键查询一条数据",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDataTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/queryById",method=RequestMethod.GET) |
|
||||
public Result queryById(FormDataTag formDataTag) { |
|
||||
FormDataTag data = (FormDataTag) formDataTagService.getById(formDataTag); |
|
||||
return Result.ok().setData(data); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 批量打标签 |
|
||||
* [ |
|
||||
* {formId:'',dataId:'',tags:[ |
|
||||
* {tagId:'',tagName:''} |
|
||||
* ] |
|
||||
* } |
|
||||
* ] |
|
||||
* @param tagsVos |
|
||||
* @return |
|
||||
*/ |
|
||||
@RequestMapping(value="/batchInsertOrDeleteTags",method=RequestMethod.POST) |
|
||||
public Map<String,Object> batchDelFormDataTag(@RequestBody List<FormDataTagVo> tagsVos) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
try{ |
|
||||
if(tagsVos==null) { |
|
||||
return Result.error("params-required","请上送参数列表"); |
|
||||
}else if(tagsVos.size()>10) { |
|
||||
return Result.error("must-small-10","一次只能同时给十条数据打标签"); |
|
||||
}else { |
|
||||
for (FormDataTagVo tagsVo : tagsVos) { |
|
||||
List<FormDataTag> tags=tagsVo.getTags(); |
|
||||
String formId=tagsVo.getFormId(); |
|
||||
String dataId=tagsVo.getDataId(); |
|
||||
String tagIds=""; |
|
||||
String tagNames=""; |
|
||||
if(tags!=null && tags.size()>0) { |
|
||||
for (FormDataTag tag : tags) { |
|
||||
tagIds=tagIds+","+tag.getTagId(); |
|
||||
tagNames=tagNames+","+tag.getTagName(); |
|
||||
} |
|
||||
tagIds=tagIds.substring(1); |
|
||||
tagNames=tagNames.substring(1); |
|
||||
} |
|
||||
formDataService.updateTagsByDataId(dataId,tagIds,tagNames); |
|
||||
formDataTagService.batchInsertOrDeleteTags(dataId,tags); |
|
||||
} |
|
||||
} |
|
||||
return Result.ok(); |
|
||||
}catch (BizException e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e.getMessage()); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,175 +0,0 @@ |
|||||
package com.mdp.form.ctrl; |
|
||||
|
|
||||
import java.util.*; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDefTagVo; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestMethod; |
|
||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
import io.swagger.annotations.*; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.mdp.core.entity.Result; |
|
||||
import com.mdp.core.query.QueryTools; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.entity.LangTips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
import com.mdp.core.utils.RequestUtils; |
|
||||
import com.mdp.core.utils.NumberUtil; |
|
||||
import com.mdp.safe.client.entity.User; |
|
||||
import com.mdp.safe.client.utils.LoginUtils; |
|
||||
import com.mdp.swagger.ApiEntityParams; |
|
||||
import io.swagger.annotations.*; |
|
||||
import springfox.documentation.annotations.ApiIgnore; |
|
||||
|
|
||||
import javax.servlet.http.HttpServletRequest; |
|
||||
|
|
||||
import com.mdp.form.service.FormDefTagService; |
|
||||
import com.mdp.form.entity.FormDefTag; |
|
||||
|
|
||||
@RestController |
|
||||
@RequestMapping(value="/**/form/formDefTag") |
|
||||
@Api(tags={"form_def_tag-操作接口"}) |
|
||||
public class FormDefTagController { |
|
||||
|
|
||||
static Logger logger =LoggerFactory.getLogger(FormDefTagController.class); |
|
||||
|
|
||||
@Autowired |
|
||||
private FormDefTagService formDefTagService; |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-查询列表",notes=" ") |
|
||||
@ApiEntityParams(FormDefTag.class) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|
||||
}) |
|
||||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|
||||
public Result listFormDefTag(@ApiIgnore @RequestParam Map<String,Object> params){ |
|
||||
try { |
|
||||
User user=LoginUtils.getCurrentUserInfo(); |
|
||||
QueryWrapper<FormDefTag> qw = QueryTools.initQueryWrapper(FormDefTag.class , params); |
|
||||
IPage page=QueryTools.initPage(params); |
|
||||
List<Map<String,Object>> datas = formDefTagService.selectListMapByWhere(page,qw,params); |
|
||||
return Result.ok("query-ok","查询成功").setData(datas).setTotal(page.getTotal()); |
|
||||
}catch (BizException e) { |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-新增",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|
||||
public Result addFormDefTag(@RequestBody FormDefTag formDefTag) { |
|
||||
formDefTagService.save(formDefTag); |
|
||||
return Result.ok("add-ok","添加成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-删除",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
|
||||
}) |
|
||||
@RequestMapping(value="/del",method=RequestMethod.POST) |
|
||||
public Result delFormDefTag(@RequestBody FormDefTag formDefTag){ |
|
||||
formDefTagService.removeById(formDefTag); |
|
||||
return Result.ok("del-ok","删除成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-修改",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDefTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|
||||
public Result editFormDefTag(@RequestBody FormDefTag formDefTag) { |
|
||||
formDefTagService.updateById(formDefTag); |
|
||||
return Result.ok("edit-ok","修改成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-批量修改某些字段",notes="") |
|
||||
@ApiEntityParams( value = FormDefTag.class, props={ }, remark = "form_def_tag", paramType = "body" ) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDefTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
|
||||
public Result editSomeFields( @ApiIgnore @RequestBody Map<String,Object> params) { |
|
||||
try{ |
|
||||
User user= LoginUtils.getCurrentUserInfo(); |
|
||||
formDefTagService.editSomeFields(params); |
|
||||
return Result.ok("edit-ok","更新成功"); |
|
||||
}catch (BizException e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-批量删除",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
|
||||
}) |
|
||||
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
|
||||
public Result batchDelFormDefTag(@RequestBody List<FormDefTag> formDefTags) { |
|
||||
User user= LoginUtils.getCurrentUserInfo(); |
|
||||
try{ |
|
||||
if(formDefTags.size()<=0){ |
|
||||
return Result.error("formDefTag-batchDel-data-err-0","请上送待删除数据列表"); |
|
||||
} |
|
||||
List<FormDefTag> datasDb=formDefTagService.listByIds(formDefTags.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
|
||||
|
|
||||
List<FormDefTag> can=new ArrayList<>(); |
|
||||
List<FormDefTag> no=new ArrayList<>(); |
|
||||
for (FormDefTag data : datasDb) { |
|
||||
if(true){ |
|
||||
can.add(data); |
|
||||
}else{ |
|
||||
no.add(data); |
|
||||
} |
|
||||
} |
|
||||
List<String> msgs=new ArrayList<>(); |
|
||||
if(can.size()>0){ |
|
||||
formDefTagService.removeByIds(can); |
|
||||
msgs.add(LangTips.transMsg("del-ok-num","成功删除%s条数据.",can.size())); |
|
||||
} |
|
||||
|
|
||||
if(no.size()>0){ |
|
||||
msgs.add(LangTips.transMsg("not-allow-del-num","以下%s条数据不能删除:【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
|
||||
} |
|
||||
if(can.size()>0){ |
|
||||
return Result.ok(msgs.stream().collect(Collectors.joining())); |
|
||||
}else { |
|
||||
return Result.error(msgs.stream().collect(Collectors.joining())); |
|
||||
} |
|
||||
}catch (BizException e) { |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "form_def_tag-根据主键查询一条数据",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormDefTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/queryById",method=RequestMethod.GET) |
|
||||
public Result queryById(FormDefTag formDefTag) { |
|
||||
FormDefTag data = (FormDefTag) formDefTagService.getById(formDefTag); |
|
||||
return Result.ok().setData(data); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,174 +0,0 @@ |
|||||
package com.mdp.form.ctrl; |
|
||||
|
|
||||
import java.util.*; |
|
||||
import java.util.stream.Collectors; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestMethod; |
|
||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
import io.swagger.annotations.*; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.mdp.core.entity.Result; |
|
||||
import com.mdp.core.query.QueryTools; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.entity.LangTips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
import com.mdp.core.utils.RequestUtils; |
|
||||
import com.mdp.core.utils.NumberUtil; |
|
||||
import com.mdp.safe.client.entity.User; |
|
||||
import com.mdp.safe.client.utils.LoginUtils; |
|
||||
import com.mdp.swagger.ApiEntityParams; |
|
||||
import io.swagger.annotations.*; |
|
||||
import springfox.documentation.annotations.ApiIgnore; |
|
||||
|
|
||||
import javax.servlet.http.HttpServletRequest; |
|
||||
|
|
||||
import com.mdp.form.service.FormViewService; |
|
||||
import com.mdp.form.entity.FormView; |
|
||||
|
|
||||
@RestController |
|
||||
@RequestMapping(value="/**/form/formView") |
|
||||
@Api(tags={"表单页面-操作接口"}) |
|
||||
public class FormViewController { |
|
||||
|
|
||||
static Logger logger =LoggerFactory.getLogger(FormViewController.class); |
|
||||
|
|
||||
@Autowired |
|
||||
private FormViewService formViewService; |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-查询列表",notes=" ") |
|
||||
@ApiEntityParams(FormView.class) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormView.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|
||||
}) |
|
||||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|
||||
public Result listFormView(@ApiIgnore @RequestParam Map<String,Object> params){ |
|
||||
try { |
|
||||
User user=LoginUtils.getCurrentUserInfo(); |
|
||||
QueryWrapper<FormView> qw = QueryTools.initQueryWrapper(FormView.class , params); |
|
||||
IPage page=QueryTools.initPage(params); |
|
||||
List<Map<String,Object>> datas = formViewService.selectListMapByWhere(page,qw,params); |
|
||||
return Result.ok("query-ok","查询成功").setData(datas).setTotal(page.getTotal()); |
|
||||
}catch (BizException e) { |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
@ApiOperation( value = "表单页面-新增",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormView.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|
||||
public Result addFormView(@RequestBody FormView formView) { |
|
||||
formViewService.save(formView); |
|
||||
return Result.ok("add-ok","添加成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-删除",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
|
||||
}) |
|
||||
@RequestMapping(value="/del",method=RequestMethod.POST) |
|
||||
public Result delFormView(@RequestBody FormView formView){ |
|
||||
formViewService.removeById(formView); |
|
||||
return Result.ok("del-ok","删除成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-修改",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormView.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|
||||
public Result editFormView(@RequestBody FormView formView) { |
|
||||
formViewService.updateById(formView); |
|
||||
return Result.ok("edit-ok","修改成功!"); |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-批量修改某些字段",notes="") |
|
||||
@ApiEntityParams( value = FormView.class, props={ }, remark = "表单页面", paramType = "body" ) |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormView.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
|
||||
public Result editSomeFields( @ApiIgnore @RequestBody Map<String,Object> params) { |
|
||||
try{ |
|
||||
User user= LoginUtils.getCurrentUserInfo(); |
|
||||
formViewService.editSomeFields(params); |
|
||||
return Result.ok("edit-ok","更新成功"); |
|
||||
}catch (BizException e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
logger.error("",e); |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-批量删除",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
|
||||
}) |
|
||||
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
|
||||
public Result batchDelFormView(@RequestBody List<FormView> formViews) { |
|
||||
User user= LoginUtils.getCurrentUserInfo(); |
|
||||
try{ |
|
||||
if(formViews.size()<=0){ |
|
||||
return Result.error("formView-batchDel-data-err-0","请上送待删除数据列表"); |
|
||||
} |
|
||||
List<FormView> datasDb=formViewService.listByIds(formViews.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
|
||||
|
|
||||
List<FormView> can=new ArrayList<>(); |
|
||||
List<FormView> no=new ArrayList<>(); |
|
||||
for (FormView data : datasDb) { |
|
||||
if(true){ |
|
||||
can.add(data); |
|
||||
}else{ |
|
||||
no.add(data); |
|
||||
} |
|
||||
} |
|
||||
List<String> msgs=new ArrayList<>(); |
|
||||
if(can.size()>0){ |
|
||||
formViewService.removeByIds(can); |
|
||||
msgs.add(LangTips.transMsg("del-ok-num","成功删除%s条数据.",can.size())); |
|
||||
} |
|
||||
|
|
||||
if(no.size()>0){ |
|
||||
msgs.add(LangTips.transMsg("not-allow-del-num","以下%s条数据不能删除:【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
|
||||
} |
|
||||
if(can.size()>0){ |
|
||||
return Result.ok(msgs.stream().collect(Collectors.joining())); |
|
||||
}else { |
|
||||
return Result.error(msgs.stream().collect(Collectors.joining())); |
|
||||
} |
|
||||
}catch (BizException e) { |
|
||||
return Result.error(e); |
|
||||
}catch (Exception e) { |
|
||||
return Result.error(e); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
@ApiOperation( value = "表单页面-根据主键查询一条数据",notes=" ") |
|
||||
@ApiResponses({ |
|
||||
@ApiResponse(code = 200,response=FormView.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|
||||
}) |
|
||||
@RequestMapping(value="/queryById",method=RequestMethod.GET) |
|
||||
public Result queryById(FormView formView) { |
|
||||
FormView data = (FormView) formViewService.getById(formView); |
|
||||
return Result.ok().setData(data); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,53 +0,0 @@ |
|||||
package com.mdp.form.entity; |
|
||||
import lombok.Data; |
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
|
||||
import com.mdp.core.dao.annotation.TableIds; |
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||
import io.swagger.annotations.ApiModel; |
|
||||
import io.swagger.annotations.ApiModelProperty; |
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 组织 com 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDataTag所有属性名: <br> |
|
||||
* "dataId","表单数据编号","tagId","标签编号","tagName","标签名字","id","主键","createTime","添加事件";<br> |
|
||||
* 当前主键(包括多主键):<br> |
|
||||
* id;<br> |
|
||||
*/ |
|
||||
@Data |
|
||||
@TableName("form_data_tag") |
|
||||
@ApiModel(description="form_data_tag") |
|
||||
public class FormDataTag implements java.io.Serializable { |
|
||||
|
|
||||
private static final long serialVersionUID = 1L; |
|
||||
@TableId(type = IdType.ASSIGN_ID) |
|
||||
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String id; |
|
||||
|
|
||||
@ApiModelProperty(notes="表单数据编号",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String dataId; |
|
||||
|
|
||||
@ApiModelProperty(notes="标签编号",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String tagId; |
|
||||
|
|
||||
@ApiModelProperty(notes="标签名字",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String tagName; |
|
||||
|
|
||||
@ApiModelProperty(notes="添加事件",allowEmptyValue=true,example="",allowableValues="") |
|
||||
Date createTime; |
|
||||
|
|
||||
/** |
|
||||
*主键 |
|
||||
**/ |
|
||||
public FormDataTag(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* form_data_tag |
|
||||
**/ |
|
||||
public FormDataTag() { |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
package com.mdp.form.entity; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public class FormDataTagVo { |
|
||||
|
|
||||
List<FormDataTag> tags; |
|
||||
String formId; |
|
||||
String dataId; |
|
||||
public List<FormDataTag> getTags() { |
|
||||
return tags; |
|
||||
} |
|
||||
public void setTags(List<FormDataTag> tags) { |
|
||||
this.tags = tags; |
|
||||
} |
|
||||
|
|
||||
public String getFormId() { |
|
||||
return formId; |
|
||||
} |
|
||||
public void setFormId(String formId) { |
|
||||
this.formId = formId; |
|
||||
} |
|
||||
public String getDataId() { |
|
||||
return dataId; |
|
||||
} |
|
||||
public void setDataId(String dataId) { |
|
||||
this.dataId = dataId; |
|
||||
} |
|
||||
} |
|
||||
@ -1,53 +0,0 @@ |
|||||
package com.mdp.form.entity; |
|
||||
import lombok.Data; |
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
|
||||
import com.mdp.core.dao.annotation.TableIds; |
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||
import io.swagger.annotations.ApiModel; |
|
||||
import io.swagger.annotations.ApiModelProperty; |
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 组织 com 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDefTag所有属性名: <br> |
|
||||
* "formId","表单编号","tagId","标签编号","tagName","标签名字","id","主键","createTime","添加事件";<br> |
|
||||
* 当前主键(包括多主键):<br> |
|
||||
* id;<br> |
|
||||
*/ |
|
||||
@Data |
|
||||
@TableName("form_def_tag") |
|
||||
@ApiModel(description="form_def_tag") |
|
||||
public class FormDefTag implements java.io.Serializable { |
|
||||
|
|
||||
private static final long serialVersionUID = 1L; |
|
||||
@TableId(type = IdType.ASSIGN_ID) |
|
||||
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String id; |
|
||||
|
|
||||
@ApiModelProperty(notes="表单编号",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String formId; |
|
||||
|
|
||||
@ApiModelProperty(notes="标签编号",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String tagId; |
|
||||
|
|
||||
@ApiModelProperty(notes="标签名字",allowEmptyValue=true,example="",allowableValues="") |
|
||||
String tagName; |
|
||||
|
|
||||
@ApiModelProperty(notes="添加事件",allowEmptyValue=true,example="",allowableValues="") |
|
||||
Date createTime; |
|
||||
|
|
||||
/** |
|
||||
*主键 |
|
||||
**/ |
|
||||
public FormDefTag(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* form_def_tag |
|
||||
**/ |
|
||||
public FormDefTag() { |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
package com.mdp.form.entity; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public class FormDefTagVo { |
|
||||
|
|
||||
List<FormDefTag> tags; |
|
||||
String formId; |
|
||||
public List<FormDefTag> getTags() { |
|
||||
return tags; |
|
||||
} |
|
||||
public void setTags(List<FormDefTag> tags) { |
|
||||
this.tags = tags; |
|
||||
} |
|
||||
|
|
||||
public String getFormId() { |
|
||||
return formId; |
|
||||
} |
|
||||
public void setFormId(String formId) { |
|
||||
this.formId = formId; |
|
||||
} |
|
||||
} |
|
||||
@ -1,25 +0,0 @@ |
|||||
package com.mdp.form.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDataTag; |
|
||||
|
|
||||
public interface FormDataTagMapper extends BaseMapper<FormDataTag> { |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
List<Map<String,Object>> selectListMapByWhere(IPage page, @Param("ew") QueryWrapper ew,@Param("ext") Map<String,Object> ext); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@ -1,17 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||
<mapper namespace="com.mdp.form.mapper.FormDataTagMapper"> |
|
||||
|
|
||||
<select id="selectListMapByWhere" resultType="HashMap"> |
|
||||
select * from form_data_tag res |
|
||||
<where> |
|
||||
${@com.mdp.Util@trimWhere(ew.customSqlSegment)} |
|
||||
<!--下面可以添加更多查询条件,正常的if 条件都是支持的--> |
|
||||
|
|
||||
</where> |
|
||||
<!--下面双引号内可以添加默认排序,如果前端没有上传排序,将使用引号内的排序规则--> |
|
||||
${@com.mdp.Util@trimOrderBy(ew.customSqlSegment,'')} |
|
||||
<!--下面双引号内可以添加默认分组,如果前端没有上传分组,将使用引号内的分组规则--> |
|
||||
${@com.mdp.Util@trimGroupBy(ew.customSqlSegment,'')} |
|
||||
</select> |
|
||||
</mapper> |
|
||||
@ -1,25 +0,0 @@ |
|||||
package com.mdp.form.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDefTag; |
|
||||
|
|
||||
public interface FormDefTagMapper extends BaseMapper<FormDefTag> { |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
List<Map<String,Object>> selectListMapByWhere(IPage page, @Param("ew") QueryWrapper ew,@Param("ext") Map<String,Object> ext); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@ -1,17 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||
<mapper namespace="com.mdp.form.mapper.FormDefTagMapper"> |
|
||||
|
|
||||
<select id="selectListMapByWhere" resultType="HashMap"> |
|
||||
select * from form_def_tag res |
|
||||
<where> |
|
||||
${@com.mdp.Util@trimWhere(ew.customSqlSegment)} |
|
||||
<!--下面可以添加更多查询条件,正常的if 条件都是支持的--> |
|
||||
|
|
||||
</where> |
|
||||
<!--下面双引号内可以添加默认排序,如果前端没有上传排序,将使用引号内的排序规则--> |
|
||||
${@com.mdp.Util@trimOrderBy(ew.customSqlSegment,'')} |
|
||||
<!--下面双引号内可以添加默认分组,如果前端没有上传分组,将使用引号内的分组规则--> |
|
||||
${@com.mdp.Util@trimGroupBy(ew.customSqlSegment,'')} |
|
||||
</select> |
|
||||
</mapper> |
|
||||
@ -1,25 +0,0 @@ |
|||||
package com.mdp.form.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
import com.mdp.form.entity.FormView; |
|
||||
|
|
||||
public interface FormViewMapper extends BaseMapper<FormView> { |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
List<Map<String,Object>> selectListMapByWhere(IPage page, @Param("ew") QueryWrapper ew,@Param("ext") Map<String,Object> ext); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@ -1,17 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||
<mapper namespace="com.mdp.form.mapper.FormViewMapper"> |
|
||||
|
|
||||
<select id="selectListMapByWhere" resultType="HashMap"> |
|
||||
select * from form_view res |
|
||||
<where> |
|
||||
${@com.mdp.Util@trimWhere(ew.customSqlSegment)} |
|
||||
<!--下面可以添加更多查询条件,正常的if 条件都是支持的--> |
|
||||
|
|
||||
</where> |
|
||||
<!--下面双引号内可以添加默认排序,如果前端没有上传排序,将使用引号内的排序规则--> |
|
||||
${@com.mdp.Util@trimOrderBy(ew.customSqlSegment,'')} |
|
||||
<!--下面双引号内可以添加默认分组,如果前端没有上传分组,将使用引号内的分组规则--> |
|
||||
${@com.mdp.Util@trimGroupBy(ew.customSqlSegment,'')} |
|
||||
</select> |
|
||||
</mapper> |
|
||||
@ -1,115 +0,0 @@ |
|||||
package com.mdp.form.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.Date; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
import com.mdp.core.service.BaseService; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDataTag; |
|
||||
import com.mdp.form.mapper.FormDataTagMapper; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
|
|
||||
/** |
|
||||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|
||||
* 组织 com 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDataTag 表 form_data_tag 当前主键(包括多主键): id; |
|
||||
***/ |
|
||||
@Service |
|
||||
public class FormDataTagService extends BaseService<FormDataTagMapper,FormDataTag> { |
|
||||
static Logger logger =LoggerFactory.getLogger(FormDataTagService.class); |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
public List<Map<String,Object>> selectListMapByWhere(IPage page, QueryWrapper ew, Map<String,Object> ext){ |
|
||||
return baseMapper.selectListMapByWhere(page,ew,ext); |
|
||||
} |
|
||||
|
|
||||
/** 请在此类添加自定义函数 */ |
|
||||
public void batchInsertTags(String tagIds,String tagNames,String dataId,String formId){ |
|
||||
if(!StringUtils.isEmpty(tagIds) && !StringUtils.isEmpty(tagNames) ) { |
|
||||
String[] tagIdsArr=tagIds.split(","); |
|
||||
String[] tagIdsNamesArr=tagNames.split(","); |
|
||||
if(tagIdsArr.length==tagIdsNamesArr.length) { |
|
||||
List<FormDataTag> tags=new ArrayList<>(); |
|
||||
int index=0; |
|
||||
for (String tagId : tagIdsArr) { |
|
||||
FormDataTag formDataTag =new FormDataTag(); |
|
||||
formDataTag.setDataId(dataId); |
|
||||
formDataTag.setTagId(tagId); |
|
||||
formDataTag.setTagName(tagIdsNamesArr[index]); |
|
||||
formDataTag.setId(this.createKey("id")); |
|
||||
index=index+1; |
|
||||
} |
|
||||
this.batchInsert(tags); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public Tips batchInsertOrDeleteTags( String dataId,List<FormDataTag> tags) { |
|
||||
Tips tips =new Tips("成功更新标签"); |
|
||||
List<String> tagIds=new ArrayList<>(); |
|
||||
for (FormDataTag tag : tags) { |
|
||||
tagIds.add(tag.getTagId()); |
|
||||
} |
|
||||
FormDataTag tagQuery=new FormDataTag(); |
|
||||
tagQuery.setDataId(dataId); |
|
||||
List<FormDataTag> dbTags=this.selectListByWhere(tagQuery); |
|
||||
List<FormDataTag> needDeleteList=new ArrayList<>(); |
|
||||
List<FormDataTag> needAddList=new ArrayList<>(); |
|
||||
Date date=new Date(); |
|
||||
boolean existsDbTags=dbTags!=null && dbTags.size()>0; |
|
||||
if(tags==null || tags.size()<=0) {//清空标签 |
|
||||
//清除流程实例标签表 |
|
||||
if(existsDbTags) { |
|
||||
this.batchDelete(dbTags); |
|
||||
} |
|
||||
//TODO 清除流程实例参数表的tagIds,tagNames字段 |
|
||||
tips.setMsg("删除标签成功"); |
|
||||
return tips; |
|
||||
} |
|
||||
for (FormDataTag tag : tags) { |
|
||||
boolean exists=false; |
|
||||
if(existsDbTags) { |
|
||||
for (FormDataTag dbTag : dbTags) { |
|
||||
if(dbTag.getTagId().equals(tag.getTagId())) { |
|
||||
exists=true; |
|
||||
needDeleteList.add(dbTag); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
if(exists==false) { |
|
||||
tag.setDataId(dataId); |
|
||||
tag.setId(this.createKey("id")); |
|
||||
tag.setCreateTime(date); |
|
||||
needAddList.add(tag); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
if(needAddList.size()>0) { |
|
||||
this.batchInsert(needAddList); |
|
||||
} |
|
||||
if(needDeleteList.size()>0) { |
|
||||
this.batchDelete(needDeleteList); |
|
||||
} |
|
||||
return tips; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@ -1,120 +0,0 @@ |
|||||
package com.mdp.form.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
|
|
||||
import java.util.*; |
|
||||
|
|
||||
import org.springframework.stereotype.Service; |
|
||||
import com.mdp.core.service.BaseService; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDefTag; |
|
||||
import com.mdp.form.mapper.FormDefTagMapper; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
|
|
||||
/** |
|
||||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|
||||
* 组织 com 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDefTag 表 form_def_tag 当前主键(包括多主键): id; |
|
||||
***/ |
|
||||
@Service |
|
||||
public class FormDefTagService extends BaseService<FormDefTagMapper,FormDefTag> { |
|
||||
static Logger logger =LoggerFactory.getLogger(FormDefTagService.class); |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
public List<Map<String,Object>> selectListMapByWhere(IPage page, QueryWrapper ew, Map<String,Object> ext){ |
|
||||
return baseMapper.selectListMapByWhere(page,ew,ext); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** 请在此类添加自定义函数 */ |
|
||||
/** 请在此类添加自定义函数 |
|
||||
* @return */ |
|
||||
|
|
||||
public void batchInsertTags(String tagIds,String tagNames,String branchId,String userid,String formId){ |
|
||||
if(!StringUtils.isEmpty(tagIds) && !StringUtils.isEmpty(tagNames) ) { |
|
||||
String[] tagIdsArr=tagIds.split(","); |
|
||||
String[] tagIdsNamesArr=tagNames.split(","); |
|
||||
if(tagIdsArr.length==tagIdsNamesArr.length) { |
|
||||
List<FormDefTag> tags=new ArrayList<>(); |
|
||||
int index=0; |
|
||||
for (String tagId : tagIdsArr) { |
|
||||
FormDefTag formDefTag =new FormDefTag(); |
|
||||
formDefTag.setFormId(formId); |
|
||||
formDefTag.setTagId(tagId); |
|
||||
formDefTag.setTagName(tagIdsNamesArr[index]); |
|
||||
formDefTag.setId(this.createKey("id")); |
|
||||
index=index+1; |
|
||||
} |
|
||||
this.batchInsert(tags); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public Tips batchInsertOrDeleteTags(String formId,List<FormDefTag> tags) { |
|
||||
Tips tips =new Tips("成功更新标签"); |
|
||||
Map<String,Object> m=new HashMap<>(); |
|
||||
m.put("formId", formId); |
|
||||
List<String> tagIds=new ArrayList<>(); |
|
||||
for (FormDefTag tag : tags) { |
|
||||
tagIds.add(tag.getTagId()); |
|
||||
} |
|
||||
m.put("tagIds", tagIds); |
|
||||
FormDefTag tagQuery=new FormDefTag(); |
|
||||
tagQuery.setFormId(formId); |
|
||||
List<FormDefTag> dbTags=this.selectListByWhere(tagQuery); |
|
||||
List<FormDefTag> needDeleteList=new ArrayList<>(); |
|
||||
List<FormDefTag> needAddList=new ArrayList<>(); |
|
||||
Date date=new Date(); |
|
||||
boolean existsDbTags=dbTags!=null && dbTags.size()>0; |
|
||||
if(tags==null || tags.size()<=0) {//清空标签 |
|
||||
//清除流程实例标签表 |
|
||||
if(existsDbTags) { |
|
||||
this.batchDelete(dbTags); |
|
||||
} |
|
||||
//TODO 清除流程实例参数表的tagIds,tagNames字段 |
|
||||
tips.setMsg("删除标签成功"); |
|
||||
return tips; |
|
||||
} |
|
||||
for (FormDefTag tag : tags) { |
|
||||
boolean exists=false; |
|
||||
if(existsDbTags) { |
|
||||
for (FormDefTag dbTag : dbTags) { |
|
||||
if(dbTag.getTagId().equals(tag.getTagId())) { |
|
||||
exists=true; |
|
||||
needDeleteList.add(dbTag); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
if(exists==false) { |
|
||||
tag.setFormId(formId); |
|
||||
tag.setId(this.createKey("id")); |
|
||||
tag.setCreateTime(date); |
|
||||
needAddList.add(tag); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
if(needAddList.size()>0) { |
|
||||
this.batchInsert(needAddList); |
|
||||
} |
|
||||
if(needDeleteList.size()>0) { |
|
||||
this.batchDelete(needDeleteList); |
|
||||
} |
|
||||
return tips; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@ -1,37 +0,0 @@ |
|||||
package com.mdp.form.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
import com.mdp.core.service.BaseService; |
|
||||
import static com.mdp.core.utils.BaseUtils.*; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
import com.mdp.core.err.BizException; |
|
||||
|
|
||||
import com.mdp.form.entity.FormView; |
|
||||
import com.mdp.form.mapper.FormViewMapper; |
|
||||
/** |
|
||||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|
||||
* 组织 com 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormView 表 form_view 当前主键(包括多主键): id; |
|
||||
***/ |
|
||||
@Service |
|
||||
public class FormViewService extends BaseService<FormViewMapper,FormView> { |
|
||||
static Logger logger =LoggerFactory.getLogger(FormViewService.class); |
|
||||
|
|
||||
/** |
|
||||
* 自定义查询,支持多表关联 |
|
||||
* @param page 分页条件 |
|
||||
* @param ew 一定要,并且必须加@Param("ew")注解 |
|
||||
* @param ext 如果xml中需要根据某些值进行特殊处理,可以通过这个进行传递,非必须,注解也可以不加 |
|
||||
* @return |
|
||||
*/ |
|
||||
public List<Map<String,Object>> selectListMapByWhere(IPage page, QueryWrapper ew, Map<String,Object> ext){ |
|
||||
return baseMapper.selectListMapByWhere(page,ew,ext); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue