8 changed files with 1202 additions and 1311 deletions
-
351mdp-form/src/main/java/com/mdp/form/ctrl/FormDataController.java
-
257mdp-form/src/main/java/com/mdp/form/ctrl/FormDataProcessApprovaController.java
-
321mdp-form/src/main/java/com/mdp/form/ctrl/FormDataTagController.java
-
293mdp-form/src/main/java/com/mdp/form/ctrl/FormDefController.java
-
299mdp-form/src/main/java/com/mdp/form/ctrl/FormDefTagController.java
-
279mdp-form/src/main/java/com/mdp/form/ctrl/FormFieldController.java
-
298mdp-form/src/main/java/com/mdp/form/ctrl/FormQxController.java
-
289mdp-form/src/main/java/com/mdp/form/ctrl/FormViewController.java
@ -1,181 +1,174 @@ |
|||||
package com.mdp.form.ctrl; |
package com.mdp.form.ctrl; |
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
import com.mdp.form.entity.FormDataProcessApprova; |
|
||||
import com.mdp.form.entity.FormDataTag; |
|
||||
import com.mdp.form.service.FormDataProcessApprovaService; |
|
||||
|
|
||||
import com.mdp.swagger.ApiEntityParams; |
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore; |
|
||||
import org.apache.commons.logging.Log; |
|
||||
import org.apache.commons.logging.LogFactory; |
|
||||
|
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.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.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
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 io.swagger.annotations.Api; |
|
||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||
import io.swagger.annotations.ApiOperation; |
|
||||
import io.swagger.annotations.ApiResponse; |
|
||||
import io.swagger.annotations.ApiResponses; |
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
import com.mdp.mybatis.PageUtils; |
|
||||
import com.mdp.core.utils.RequestUtils; |
|
||||
import com.mdp.core.entity.Tips; |
|
||||
|
import com.mdp.form.service.FormDataProcessApprovaService; |
||||
|
import com.mdp.form.entity.FormDataProcessApprova; |
||||
|
|
||||
/** |
|
||||
* url编制采用rest风格,如对FORM.form_data_process_approva form_data_process_approva的操作有增删改查,对应的url分别为:<br> |
|
||||
* 新增: form/formDataProcessApprova/add <br> |
|
||||
* 查询: form/formDataProcessApprova/list<br> |
|
||||
* 模糊查询: form/formDataProcessApprova/listKey<br> |
|
||||
* 修改: form/formDataProcessApprova/edit <br> |
|
||||
* 删除: form/formDataProcessApprova/del<br> |
|
||||
* 批量删除: form/formDataProcessApprova/batchDel<br> |
|
||||
* 组织 com.qqkj 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDataProcessApprova 表 FORM.form_data_process_approva 当前主键(包括多主键): id; |
|
||||
***/ |
|
||||
@RestController("mdp.form.formDataProcessApprovaController") |
|
||||
|
@RestController |
||||
@RequestMapping(value="/**/form/formDataProcessApprova") |
@RequestMapping(value="/**/form/formDataProcessApprova") |
||||
@Api(tags={"form_data_process_approva操作接口"}) |
|
||||
|
@Api(tags={"企业入驻审核流程-操作接口"}) |
||||
public class FormDataProcessApprovaController { |
public class FormDataProcessApprovaController { |
||||
|
|
||||
static Log logger=LogFactory.getLog(FormDataProcessApprovaController.class); |
|
||||
|
static Logger logger =LoggerFactory.getLogger(FormDataProcessApprovaController.class); |
||||
|
|
||||
@Autowired |
@Autowired |
||||
private FormDataProcessApprovaService formDataProcessApprovaService; |
private FormDataProcessApprovaService formDataProcessApprovaService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ApiOperation( value = "查询form_data_process_approva信息列表",notes="listFormDataProcessApprova,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") |
|
||||
|
@ApiOperation( value = "企业入驻审核流程-查询列表",notes=" ") |
||||
@ApiEntityParams(FormDataProcessApprova.class) |
@ApiEntityParams(FormDataProcessApprova.class) |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response= FormDataProcessApprova.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},pageInfo:{total:总记录数},data:[数据对象1,数据对象2,...]}") |
|
||||
|
@ApiResponse(code = 200,response=FormDataProcessApprova.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
}) |
}) |
||||
@RequestMapping(value="/list",method=RequestMethod.GET) |
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
public Map<String,Object> listFormDataProcessApprova(@Ignore @RequestParam Map<String,Object> formDataProcessApprova){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
RequestUtils.transformArray(formDataProcessApprova, "ids"); |
|
||||
PageUtils.startPage(formDataProcessApprova); |
|
||||
List<Map<String,Object>> formDataProcessApprovaList = formDataProcessApprovaService.selectListMapByWhere(formDataProcessApprova); //列出FormDataProcessApprova列表 |
|
||||
PageUtils.responePage(m, formDataProcessApprovaList); |
|
||||
m.put("data",formDataProcessApprovaList); |
|
||||
Tips tips=new Tips("查询成功"); |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result listFormDataProcessApprova(@ApiIgnore @RequestParam Map<String,Object> params){ |
||||
|
try { |
||||
|
User user=LoginUtils.getCurrentUserInfo(); |
||||
|
QueryWrapper<FormDataProcessApprova> qw = QueryTools.initQueryWrapper(FormDataProcessApprova.class , params); |
||||
|
IPage page=QueryTools.initPage(params); |
||||
|
List<Map<String,Object>> datas = formDataProcessApprovaService.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_process_approva信息",notes="addFormDataProcessApprova,主键如果为空,后台自动生成") |
|
||||
|
@ApiOperation( value = "企业入驻审核流程-新增",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response=FormDataProcessApprova.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
@ApiResponse(code = 200,response=FormDataProcessApprova.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
}) |
}) |
||||
@RequestMapping(value="/add",method=RequestMethod.POST) |
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
public Map<String,Object> addFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功新增一条数据"); |
|
||||
try{ |
|
||||
if(StringUtils.isEmpty(formDataProcessApprova.getId())) { |
|
||||
formDataProcessApprova.setId(formDataProcessApprovaService.createKey("id")); |
|
||||
}else{ |
|
||||
FormDataProcessApprova formDataProcessApprovaQuery = new FormDataProcessApprova(formDataProcessApprova.getId()); |
|
||||
if(formDataProcessApprovaService.countByWhere(formDataProcessApprovaQuery)>0){ |
|
||||
tips.setFailureMsg("编号重复,请修改编号再提交"); |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
|
||||
} |
|
||||
formDataProcessApprovaService.insert(formDataProcessApprova); |
|
||||
m.put("data",formDataProcessApprova); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result addFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova) { |
||||
|
formDataProcessApprovaService.save(formDataProcessApprova); |
||||
|
return Result.ok("add-ok","添加成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
@ApiOperation( value = "删除一条form_data_process_approva信息",notes="delFormDataProcessApprova,仅需要上传主键字段") |
|
||||
|
@ApiOperation( value = "企业入驻审核流程-删除",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
||||
}) |
}) |
||||
@RequestMapping(value="/del",method=RequestMethod.POST) |
@RequestMapping(value="/del",method=RequestMethod.POST) |
||||
public Map<String,Object> delFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除一条数据"); |
|
||||
try{ |
|
||||
formDataProcessApprovaService.deleteByPk(formDataProcessApprova); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result delFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova){ |
||||
|
formDataProcessApprovaService.removeById(formDataProcessApprova); |
||||
|
return Result.ok("del-ok","删除成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
@ApiOperation( value = "根据主键修改一条form_data_process_approva信息",notes="editFormDataProcessApprova") |
|
||||
|
@ApiOperation( value = "企业入驻审核流程-修改",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response=FormDataProcessApprova.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
@ApiResponse(code = 200,response=FormDataProcessApprova.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
}) |
}) |
||||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
public Map<String,Object> editFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功更新一条数据"); |
|
||||
try{ |
|
||||
formDataProcessApprovaService.updateByPk(formDataProcessApprova); |
|
||||
m.put("data",formDataProcessApprova); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result editFormDataProcessApprova(@RequestBody FormDataProcessApprova formDataProcessApprova) { |
||||
|
formDataProcessApprovaService.updateById(formDataProcessApprova); |
||||
|
return Result.ok("edit-ok","修改成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
|
|
||||
|
@ApiOperation( value = "企业入驻审核流程-批量修改某些字段",notes="") |
||||
|
@ApiEntityParams( value = FormDataProcessApprova.class, props={ }, remark = "企业入驻审核流程", paramType = "body" ) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=FormDataProcessApprova.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(); |
||||
|
formDataProcessApprovaService.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_process_approva信息",notes="batchDelFormDataProcessApprova,仅需要上传主键字段") |
|
||||
|
@ApiOperation( value = "企业入驻审核流程-批量删除",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
}) |
}) |
||||
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
public Map<String,Object> batchDelFormDataProcessApprova(@RequestBody List<FormDataProcessApprova> formDataProcessApprovas) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除"+formDataProcessApprovas.size()+"条数据"); |
|
||||
try{ |
|
||||
formDataProcessApprovaService.batchDelete(formDataProcessApprovas); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result batchDelFormDataProcessApprova(@RequestBody List<FormDataProcessApprova> formDataProcessApprovas) { |
||||
|
User user= LoginUtils.getCurrentUserInfo(); |
||||
|
try{ |
||||
|
if(formDataProcessApprovas.size()<=0){ |
||||
|
return Result.error("formDataProcessApprova-batchDel-data-err-0","请上送待删除数据列表"); |
||||
|
} |
||||
|
List<FormDataProcessApprova> datasDb=formDataProcessApprovaService.listByIds(formDataProcessApprovas.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
||||
|
|
||||
|
List<FormDataProcessApprova> can=new ArrayList<>(); |
||||
|
List<FormDataProcessApprova> no=new ArrayList<>(); |
||||
|
for (FormDataProcessApprova data : datasDb) { |
||||
|
if(true){ |
||||
|
can.add(data); |
||||
|
}else{ |
||||
|
no.add(data); |
||||
|
} |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
formDataProcessApprovaService.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=FormDataProcessApprova.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/queryById",method=RequestMethod.GET) |
||||
|
public Result queryById(FormDataProcessApprova formDataProcessApprova) { |
||||
|
FormDataProcessApprova data = (FormDataProcessApprova) formDataProcessApprovaService.getById(formDataProcessApprova); |
||||
|
return Result.ok().setData(data); |
||||
|
} |
||||
|
|
||||
} |
} |
||||
@ -1,232 +1,175 @@ |
|||||
package com.mdp.form.ctrl; |
package com.mdp.form.ctrl; |
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
import com.mdp.form.entity.FormDefTag; |
|
||||
import com.mdp.form.entity.FormDefTagVo; |
import com.mdp.form.entity.FormDefTagVo; |
||||
import com.mdp.form.entity.FormQx; |
|
||||
import com.mdp.form.service.FormDefService; |
|
||||
import com.mdp.form.service.FormDefTagService; |
|
||||
import com.mdp.swagger.ApiEntityParams; |
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore; |
|
||||
import org.apache.commons.logging.Log; |
|
||||
import org.apache.commons.logging.LogFactory; |
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
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.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
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.Tips; |
||||
|
import com.mdp.core.entity.LangTips; |
||||
import com.mdp.core.err.BizException; |
import com.mdp.core.err.BizException; |
||||
import com.mdp.core.utils.RequestUtils; |
import com.mdp.core.utils.RequestUtils; |
||||
import com.mdp.mybatis.PageUtils; |
|
||||
|
|
||||
import io.swagger.annotations.Api; |
|
||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||
import io.swagger.annotations.ApiOperation; |
|
||||
import io.swagger.annotations.ApiResponse; |
|
||||
import io.swagger.annotations.ApiResponses; |
|
||||
/** |
|
||||
* url编制采用rest风格,如对FORM.form_def_tag form_def_tag的操作有增删改查,对应的url分别为:<br> |
|
||||
* 新增: form/formDefTag/add <br> |
|
||||
* 查询: form/formDefTag/list<br> |
|
||||
* 模糊查询: form/formDefTag/listKey<br> |
|
||||
* 修改: form/formDefTag/edit <br> |
|
||||
* 删除: form/formDefTag/del<br> |
|
||||
* 批量删除: form/formDefTag/batchDel<br> |
|
||||
* 组织 com.qqkj 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormDefTag 表 FORM.form_def_tag 当前主键(包括多主键): form_id; |
|
||||
***/ |
|
||||
@RestController("mdp.form.formDefTagController") |
|
||||
|
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") |
@RequestMapping(value="/**/form/formDefTag") |
||||
@Api(tags={"form_def_tag操作接口"}) |
|
||||
|
@Api(tags={"form_def_tag-操作接口"}) |
||||
public class FormDefTagController { |
public class FormDefTagController { |
||||
|
|
||||
static Log logger=LogFactory.getLog(FormDefTagController.class); |
|
||||
|
static Logger logger =LoggerFactory.getLogger(FormDefTagController.class); |
||||
|
|
||||
@Autowired |
@Autowired |
||||
private FormDefTagService formDefTagService; |
private FormDefTagService formDefTagService; |
||||
|
|
||||
@Autowired |
|
||||
private FormDefService formDefService; |
|
||||
|
|
||||
|
|
||||
@ApiOperation( value = "查询form_def_tag信息列表",notes="listFormDefTag,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") |
|
||||
|
@ApiOperation( value = "form_def_tag-查询列表",notes=" ") |
||||
@ApiEntityParams(FormDefTag.class) |
@ApiEntityParams(FormDefTag.class) |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response= FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},pageInfo:{total:总记录数},data:[数据对象1,数据对象2,...]}") |
|
||||
|
@ApiResponse(code = 200,response=FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
}) |
}) |
||||
@RequestMapping(value="/list",method=RequestMethod.GET) |
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
public Map<String,Object> listFormDefTag(@Ignore @RequestParam Map<String,Object> formDefTag){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
RequestUtils.transformArray(formDefTag, "formIds"); |
|
||||
PageUtils.startPage(formDefTag); |
|
||||
List<Map<String,Object>> formDefTagList = formDefTagService.selectListMapByWhere(formDefTag); //列出FormDefTag列表 |
|
||||
PageUtils.responePage(m, formDefTagList); |
|
||||
m.put("data",formDefTagList); |
|
||||
Tips tips=new Tips("查询成功"); |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 批量打标签 |
|
||||
* [ |
|
||||
* {formId:'':'',branchId:'',userid:'',tags:[ |
|
||||
* {tagId:'',tagName:''} |
|
||||
* ] |
|
||||
* } |
|
||||
* ] |
|
||||
* @param tagsVos |
|
||||
* @return |
|
||||
*/ |
|
||||
@RequestMapping(value="/batchInsertOrDeleteTags",method=RequestMethod.POST) |
|
||||
public Map<String,Object> batchDelFormDefTag(@RequestBody List<FormDefTagVo> tagsVos) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功更新标签"); |
|
||||
try{ |
|
||||
if(tagsVos==null) { |
|
||||
tips.setFailureMsg("请上送参数列表"); |
|
||||
}else if(tagsVos.size()>10) { |
|
||||
tips.setFailureMsg("一次只能同时给十个表单打标签"); |
|
||||
}else { |
|
||||
for (FormDefTagVo tagsVo : tagsVos) { |
|
||||
List<FormDefTag> tags=tagsVo.getTags(); |
|
||||
String formId=tagsVo.getFormId(); |
|
||||
String tagIds=""; |
|
||||
String tagNames=""; |
|
||||
if(tags!=null && tags.size()>0) { |
|
||||
for (FormDefTag tag : tags) { |
|
||||
tagIds=tagIds+","+tag.getTagId(); |
|
||||
tagNames=tagNames+","+tag.getTagName(); |
|
||||
} |
|
||||
tagIds=tagIds.substring(1); |
|
||||
tagNames=tagNames.substring(1); |
|
||||
} |
|
||||
formDefService.updateTagsByFormId(formId,tagIds,tagNames); |
|
||||
formDefTagService.batchInsertOrDeleteTags(formId,tags); |
|
||||
} |
|
||||
} |
|
||||
|
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) { |
}catch (BizException e) { |
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
|
return Result.error(e); |
||||
}catch (Exception e) { |
}catch (Exception e) { |
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
|
return Result.error(e); |
||||
} |
} |
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
} |
||||
|
|
||||
/** |
|
||||
@ApiOperation( value = "新增一条form_def_tag信息",notes="addFormDefTag,主键如果为空,后台自动生成") |
|
||||
|
@ApiOperation( value = "form_def_tag-新增",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response=FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
@ApiResponse(code = 200,response=FormDefTag.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
}) |
}) |
||||
@RequestMapping(value="/add",method=RequestMethod.POST) |
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
public Map<String,Object> addFormDefTag(@RequestBody FormDefTag formDefTag) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功新增一条数据"); |
|
||||
try{ |
|
||||
if(StringUtils.isEmpty(formDefTag.getFormId())) { |
|
||||
formDefTag.setFormId(formDefTagService.createKey("formId")); |
|
||||
}else{ |
|
||||
FormDefTag formDefTagQuery = new FormDefTag(formDefTag.getFormId()); |
|
||||
if(formDefTagService.countByWhere(formDefTagQuery)>0){ |
|
||||
tips.setFailureMsg("编号重复,请修改编号再提交"); |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
|
||||
} |
|
||||
formDefTagService.insert(formDefTag); |
|
||||
m.put("data",formDefTag); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result addFormDefTag(@RequestBody FormDefTag formDefTag) { |
||||
|
formDefTagService.save(formDefTag); |
||||
|
return Result.ok("add-ok","添加成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
@ApiOperation( value = "删除一条form_def_tag信息",notes="delFormDefTag,仅需要上传主键字段") |
|
||||
|
@ApiOperation( value = "form_def_tag-删除",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
||||
}) |
}) |
||||
@RequestMapping(value="/del",method=RequestMethod.POST) |
@RequestMapping(value="/del",method=RequestMethod.POST) |
||||
public Map<String,Object> delFormDefTag(@RequestBody FormDefTag formDefTag){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除一条数据"); |
|
||||
try{ |
|
||||
formDefTagService.deleteByPk(formDefTag); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
public Result delFormDefTag(@RequestBody FormDefTag formDefTag){ |
||||
|
formDefTagService.removeById(formDefTag); |
||||
|
return Result.ok("del-ok","删除成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
@ApiOperation( value = "根据主键修改一条form_def_tag信息",notes="editFormDefTag") |
|
||||
|
@ApiOperation( value = "form_def_tag-修改",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200,response=FormDefTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
@ApiResponse(code = 200,response=FormDefTag.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
}) |
}) |
||||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
public Map<String,Object> editFormDefTag(@RequestBody FormDefTag formDefTag) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功更新一条数据"); |
|
||||
try{ |
|
||||
formDefTagService.updateByPk(formDefTag); |
|
||||
m.put("data",formDefTag); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
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="batchDelFormDefTag,仅需要上传主键字段") |
|
||||
|
@ApiOperation( value = "form_def_tag-批量删除",notes=" ") |
||||
@ApiResponses({ |
@ApiResponses({ |
||||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
}) |
}) |
||||
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
public Map<String,Object> batchDelFormDefTag(@RequestBody List<FormDefTag> formDefTags) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除"+formDefTags.size()+"条数据"); |
|
||||
try{ |
|
||||
formDefTagService.batchDelete(formDefTags); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
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,171 +1,174 @@ |
|||||
package com.mdp.form.ctrl; |
package com.mdp.form.ctrl; |
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
import com.mdp.form.service.FormViewService; |
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore; |
|
||||
import org.apache.commons.logging.Log; |
|
||||
import org.apache.commons.logging.LogFactory; |
|
||||
|
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.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.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
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.Tips; |
||||
import com.mdp.core.service.SequenceService; |
|
||||
import com.mdp.mybatis.PageUtils; |
|
||||
/** |
|
||||
* url编制采用rest风格,如对FORM.form_view的操作有增删改查,对应的url分别为:<br> |
|
||||
* 新增: form/formView/add <br> |
|
||||
* 查询: form/formView/list<br> |
|
||||
* 模糊查询: form/formView/listKey<br> |
|
||||
* 修改: form/formView/edit <br> |
|
||||
* 删除: form/formView/del<br> |
|
||||
* 批量删除: form/formView/batchDel<br> |
|
||||
* 组织 com.qqkj 顶级模块 mdp 大模块 form 小模块 <br> |
|
||||
* 实体 FormView 表 FORM.form_view 当前主键(包括多主键): id; |
|
||||
***/ |
|
||||
@RestController("mdp.form.formViewController") |
|
||||
|
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") |
@RequestMapping(value="/**/form/formView") |
||||
|
@Api(tags={"表单页面-操作接口"}) |
||||
public class FormViewController { |
public class FormViewController { |
||||
|
|
||||
static Log logger=LogFactory.getLog(FormViewController.class); |
|
||||
|
static Logger logger =LoggerFactory.getLogger(FormViewController.class); |
||||
|
|
||||
@Autowired |
@Autowired |
||||
private FormViewService formViewService; |
private FormViewService formViewService; |
||||
|
|
||||
@Autowired |
|
||||
private SequenceService seqService; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 请求,如list |
|
||||
* 分页参数 {currentPage:1,pageSize:10,total:0} |
|
||||
* 根据条件查询数据对象列表,如果不上传分页参数,将不会分页。后台自动分页,无需编程 |
|
||||
*/ |
|
||||
@RequestMapping(value="/list") |
|
||||
public Map<String,Object> listFormView(@Ignore @RequestParam Map<String,Object> formView){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
PageUtils.startPage(formView); |
|
||||
List<Map<String,Object>> formViewList = formViewService.selectListMapByWhere(formView); //列出FormView列表 |
|
||||
m.put("data",formViewList); |
|
||||
PageUtils.responePage(m, formViewList); |
|
||||
Tips tips=new Tips("查询成功"); |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 请求模糊查询、条件字段由上传的参数决定 ,如{字段1:v1,字段2:v1},代表字段1,字段2都以v1作为参数值进行模糊查询,两个条件是or的关系。需要驼峰命名字段名 |
|
||||
* 根据条件查询数据对象列表 |
|
||||
|
|
||||
@RequestMapping(value="/listKey") |
|
||||
public Map<String,Object> listFormViewKey( @RequestParam Map<String,Object> formView){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
List<Map<String,Object>> formViewList = formViewService.selectListMapByKey(formView); //列出FormView列表 |
|
||||
m.put("data",formViewList); |
|
||||
Tips tips=new Tips("查询成功"); |
|
||||
m.put("tips", tips); |
|
||||
setPageInfo(m); |
|
||||
return m; |
|
||||
} |
|
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* 新增一条数据 |
|
||||
|
|
||||
@RequestMapping(value="/add") |
|
||||
public Map<String,Object> addFormView(@RequestBody FormView formView) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功新增一条数据"); |
|
||||
try{ |
|
||||
formView.setId(seqService.getTablePK("formView", "id")); |
|
||||
formViewService.insert(formView); |
|
||||
m.put("data",formView); |
|
||||
|
@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) { |
}catch (BizException e) { |
||||
tips=e.getTips(); |
|
||||
logger.error("执行异常",e); |
|
||||
|
return Result.error(e); |
||||
}catch (Exception e) { |
}catch (Exception e) { |
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("执行异常",e); |
|
||||
|
return Result.error(e); |
||||
} |
} |
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* 根据主键删除1条数据 |
|
||||
|
|
||||
@RequestMapping(value="/del") |
|
||||
public Map<String,Object> delFormView(@RequestBody FormView formView){ |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除一条数据"); |
|
||||
try{ |
|
||||
formViewService.deleteByPk(formView); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("执行异常",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("执行异常",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
@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","添加成功!"); |
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* 根据主键修改一条数据 |
|
||||
|
|
||||
@RequestMapping(value="/edit") |
|
||||
public Map<String,Object> editFormView(@RequestBody FormView formView) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功更新一条数据"); |
|
||||
try{ |
|
||||
formViewService.updateByPk(formView); |
|
||||
m.put("data",formView); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("执行异常",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("执行异常",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
|
|
||||
|
@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); |
||||
|
} |
||||
|
|
||||
/** |
|
||||
* 批量删除 |
|
||||
|
|
||||
@RequestMapping(value="/batchDel") |
|
||||
public Map<String,Object> batchDelFormView(@RequestBody String[] ids) { |
|
||||
Map<String,Object> m = new HashMap<>(); |
|
||||
Tips tips=new Tips("成功删除"+ids.length+"条数据"); |
|
||||
List<FormView> list=new ArrayList<FormView>(); |
|
||||
try{ |
|
||||
for(int i=0;i<ids.length;i++){ |
|
||||
FormView formView=new FormView(); |
|
||||
formView.setId(ids[i]); |
|
||||
list.add(formView); |
|
||||
} |
|
||||
formViewService.batchDelete(list); |
|
||||
}catch (BizException e) { |
|
||||
tips=e.getTips(); |
|
||||
logger.error("执行异常",e); |
|
||||
}catch (Exception e) { |
|
||||
tips.setFailureMsg(e.getMessage()); |
|
||||
logger.error("执行异常",e); |
|
||||
} |
|
||||
m.put("tips", tips); |
|
||||
return m; |
|
||||
} |
} |
||||
*/ |
|
||||
|
|
||||
|
@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); |
||||
|
} |
||||
|
|
||||
} |
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue