/**
  * 保存或更新
  *
  * @param bean
  * @return
  */
 @RequestMapping(params = "save")
 @ResponseBody
 public SuccessMsg save(BasePrintTemplateEntity bean) {
   SuccessMsg json = new SuccessMsg();
   String logType = Globals.LOG_INSERT;
   Map<String, Object> dataMap = new HashMap<>();
   if (StringUtils.isBlank(bean.getId())) {
     bean.setId(null);
     Serializable id = basePrintTemplateService.saveReturnId(bean);
     json.setSuccess(id != null);
     try {
       BeanUtils.setProperty(bean, "id", id);
     } catch (IllegalAccessException e) {
       e.printStackTrace();
     } catch (InvocationTargetException e) {
       e.printStackTrace();
     }
   } else {
     BasePrintTemplateEntity basePrintTemplateEntity =
         basePrintTemplateService.getEntity(BasePrintTemplateEntity.class, bean.getId());
     if (basePrintTemplateEntity != null) basePrintTemplateEntity = new BasePrintTemplateEntity();
     BeanUtil.copyNotNull2Bean(bean, basePrintTemplateEntity);
     json.setSuccess(basePrintTemplateService.update(basePrintTemplateEntity));
     logType = Globals.LOG_UPDATE;
   }
   dataMap.put("bean", bean);
   json.setDataMap(dataMap);
   if (json.isSuccess()) json.setMsg("保存成功!");
   else json.setMsg("保存失败!");
   systemService.addLog(BasePrintTemplateEntity.class.getSimpleName() + json.getMsg(), logType);
   return json;
 }
 /**
  * 删除
  *
  * @param id
  * @return
  */
 @RequestMapping(params = "del")
 @ResponseBody
 public SuccessMsg del(String id) {
   SuccessMsg j = new SuccessMsg();
   BasePrintTemplateEntity d = new BasePrintTemplateEntity();
   d.setId(id);
   j.setSuccess(basePrintTemplateService.delete(d));
   if (j.isSuccess()) j.setMsg("删除成功!");
   else j.setMsg("删除失败!");
   systemService.addLog(
       BasePrintTemplateEntity.class.getSimpleName() + j.getMsg(), Globals.LOG_DEL);
   return j;
 }