From 5738e9042e7b17b058170870f69ed79b56178cfb Mon Sep 17 00:00:00 2001 From: erzhongxmu Date: Fri, 13 Oct 2023 17:25:10 +0800 Subject: [PATCH] 1 --- .../controller/JeecgFormDemoController.java | 215 ------ .../controller/JeecgListDemoController.java | 612 ------------------ .../com/jeecg/demo/dao/JeecgMinidaoDao.java | 91 --- .../jeecg/demo/entity/JeecgDemoEntity.java | 390 ----------- .../com/jeecg/demo/entity/JeecgDemoPage.java | 17 - .../com/jeecg/demo/entity/JeecgLogReport.java | 84 --- .../jeecg/demo/service/JeecgDemoServiceI.java | 17 - .../service/impl/JeecgDemoServiceImpl.java | 140 ---- .../sql/JeecgMinidaoDao_getAllEntities.sql | 25 - .../sql/JeecgMinidaoDao_getLogChartData.sql | 15 - .../sql/JeecgMinidaoDao_getLogReportData.sql | 34 - 11 files changed, 1640 deletions(-) delete mode 100644 src/main/java/com/jeecg/demo/controller/JeecgFormDemoController.java delete mode 100644 src/main/java/com/jeecg/demo/controller/JeecgListDemoController.java delete mode 100644 src/main/java/com/jeecg/demo/dao/JeecgMinidaoDao.java delete mode 100644 src/main/java/com/jeecg/demo/entity/JeecgDemoEntity.java delete mode 100644 src/main/java/com/jeecg/demo/entity/JeecgDemoPage.java delete mode 100644 src/main/java/com/jeecg/demo/entity/JeecgLogReport.java delete mode 100644 src/main/java/com/jeecg/demo/service/JeecgDemoServiceI.java delete mode 100644 src/main/java/com/jeecg/demo/service/impl/JeecgDemoServiceImpl.java delete mode 100644 src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getAllEntities.sql delete mode 100644 src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogChartData.sql delete mode 100644 src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogReportData.sql diff --git a/src/main/java/com/jeecg/demo/controller/JeecgFormDemoController.java b/src/main/java/com/jeecg/demo/controller/JeecgFormDemoController.java deleted file mode 100644 index 7fbe87ab..00000000 --- a/src/main/java/com/jeecg/demo/controller/JeecgFormDemoController.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.jeecg.demo.controller; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.Logger; -import org.jeecgframework.core.common.controller.BaseController; -import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; -import org.jeecgframework.core.common.model.json.AjaxJson; -import org.jeecgframework.core.common.model.json.ComboTree; -import org.jeecgframework.core.util.JSONHelper; -import org.jeecgframework.tag.vo.easyui.ComboTreeModel; -import org.jeecgframework.web.system.pojo.base.TSDepart; -import org.jeecgframework.web.system.service.SystemService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import com.jeecg.demo.dao.JeecgMinidaoDao; - -import net.sf.json.JSONArray; - -/** - * @author jeecg - * @ClassName: JeecgFormDemoController - * @Description: TODO(演示例子处理类) - */ -@Controller -@RequestMapping("/jeecgFormDemoController") -public class JeecgFormDemoController extends BaseController { - private static final Logger logger = Logger.getLogger(JeecgFormDemoController.class); - - @Autowired - private SystemService systemService; - - @Autowired - private JeecgMinidaoDao jeecgMinidaoDao; - - @RequestMapping(params = "uitag") - public ModelAndView uitag(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/form_uitag"); - } - - @RequestMapping(params = "formValidDemo") - public ModelAndView formValidDemo(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/form_valid"); - } - - @RequestMapping(params = "testsubmit=1", method = {RequestMethod.GET, RequestMethod.POST}) - public ModelAndView testsubmit(HttpServletRequest request) { - logger.info("请求成功byebye"); - return new ModelAndView("com/jeecg/demo/form_valid"); - } - - @RequestMapping(params = "nature") - public ModelAndView easyDemo(HttpServletRequest request) { - logger.info("demo-nature"); - //ztree同步加载 - JSONArray jsonArray = JSONArray.fromObject(getZtreeData()); - request.setAttribute("regions", jsonArray.toString().replaceAll("pid", "pId")); - return new ModelAndView("com/jeecg/demo/form_nature"); - } - - @RequestMapping(params = "ueditor") - public ModelAndView ueditor(HttpServletRequest request) { - logger.info("ueditor"); - return new ModelAndView("com/jeecg/demo/ueditor"); - } - - - /** - * 下拉联动数据---省市区 - */ - @RequestMapping(params = "regionSelect", method = RequestMethod.GET) - @ResponseBody - public List> cityselect(HttpServletRequest req) throws Exception { - logger.info("----省市区联动-----"); - String pid = req.getParameter("pid"); - //List> list=jeecgMinidaoDao.getProCity(pid); - return jeecgMinidaoDao.getProCity(pid); - } - - /** - * Ztree - * 获取所有的省市区数据 - * - * @return - */ - public List> getZtreeData() { - return jeecgMinidaoDao.getAllRegions(); - } - - /** - * 父级DEMO下拉菜单 - */ - @RequestMapping(params = "getComboTreeData") - @ResponseBody - public List getComboTreeData(HttpServletRequest request, ComboTree comboTree) { - CriteriaQuery cq = new CriteriaQuery(TSDepart.class); - if (comboTree.getId() != null) { - cq.eq("TSPDepart.id", comboTree.getId()); - } - if (comboTree.getId() == null) { - cq.isNull("TSPDepart"); - } - cq.add(); - List demoList = systemService.getListByCriteriaQuery(cq, false); -// List comboTrees = new ArrayList(); - ComboTreeModel comboTreeModel = new ComboTreeModel("id", "departname", "TSDeparts"); - List comboTrees = systemService.ComboTree(demoList, comboTreeModel, null, false); - return comboTrees; - } - - /** - * 加载ztree - * - * @param response - * @param request - * @return - */ - @RequestMapping(params = "getTreeData", method = {RequestMethod.GET, RequestMethod.POST}) - @ResponseBody - public AjaxJson getTreeData(TSDepart depatr, HttpServletResponse response, HttpServletRequest request) { - AjaxJson j = new AjaxJson(); - try { -// List depatrList = new ArrayList(); - StringBuffer hql = new StringBuffer(" from TSDepart t"); - //hql.append(" and (parent.id is null or parent.id='')"); - List depatrList = this.systemService.findHql(hql.toString()); - List> dataList = new ArrayList>(); - Map map = null; - for (TSDepart tsdepart : depatrList) { - String sqls = null; - Object[] paramss = null; - map = new HashMap(); - map.put("id", tsdepart.getId()); - map.put("name", tsdepart.getDepartname()); - if (tsdepart.getTSPDepart() != null) { - map.put("pId", tsdepart.getTSPDepart().getId()); - map.put("open", false); - } else { - map.put("pId", "1"); - map.put("open", false); - } - sqls = "select count(1) from t_s_depart t where t.parentdepartid = ?"; - paramss = new Object[]{tsdepart.getId()}; - long counts = this.systemService.getCountForJdbcParam(sqls, paramss); - if (counts > 0) { - dataList.add(map); - } else { - TSDepart de = this.systemService.get(TSDepart.class, tsdepart.getId()); - if (de != null) { - map.put("id", de.getId()); - map.put("name", de.getDepartname()); - if (tsdepart.getTSPDepart() != null) { - map.put("pId", tsdepart.getTSPDepart().getId()); - map.put("open", false); - } else { - map.put("pId", "1"); - map.put("open", false); - } - dataList.add(map); - } else { - map.put("open", false); - dataList.add(map); - } - } - } - j.setObj(dataList); - } catch (Exception e) { - e.printStackTrace(); - } - return j; - } - - - /** - * 自动完成请求返回数据 - * - * @param request - * @param response - */ - @RequestMapping(params = "getAutocompleteData", method = {RequestMethod.GET, RequestMethod.POST}) - public void getAutocompleteData(HttpServletRequest request, HttpServletResponse response) { - String searchVal = request.getParameter("searchVal"); - String hql = "from TSUser where userName like '%" + searchVal + "%'"; - List autoList = systemService.findHql(hql); - try { - response.setContentType("application/json;charset=UTF-8"); - response.setHeader("Pragma", "No-cache"); - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expires", 0); - response.getWriter().write(JSONHelper.listtojson(new String[]{"userName"}, 1, autoList)); - response.getWriter().flush(); - } catch (Exception e1) { - e1.printStackTrace(); - } finally { - try { - response.getWriter().close(); - } catch (IOException e) { - } - } - - } - -} diff --git a/src/main/java/com/jeecg/demo/controller/JeecgListDemoController.java b/src/main/java/com/jeecg/demo/controller/JeecgListDemoController.java deleted file mode 100644 index 6d1b7ed9..00000000 --- a/src/main/java/com/jeecg/demo/controller/JeecgListDemoController.java +++ /dev/null @@ -1,612 +0,0 @@ -package com.jeecg.demo.controller; -import java.io.IOException; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.log4j.Logger; -import org.jeecgframework.core.common.controller.BaseController; -import org.jeecgframework.core.common.exception.BusinessException; -import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; -import org.jeecgframework.core.common.model.json.AjaxJson; -import org.jeecgframework.core.common.model.json.DataGrid; -import org.jeecgframework.core.constant.Globals; -import org.jeecgframework.core.util.DateUtils; -import org.jeecgframework.core.util.ExceptionUtil; -import org.jeecgframework.core.util.MyBeanUtils; -import org.jeecgframework.core.util.ResourceUtil; -import org.jeecgframework.core.util.StringUtil; -import org.jeecgframework.p3.core.util.oConvertUtils; -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; -import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; -import org.jeecgframework.tag.core.easyui.TagUtil; -import org.jeecgframework.web.system.pojo.base.TSDepart; -import org.jeecgframework.web.system.pojo.base.TSLog; -import org.jeecgframework.web.system.service.SystemService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; - -import com.github.abel533.echarts.Option; -import com.github.abel533.echarts.axis.CategoryAxis; -import com.github.abel533.echarts.axis.ValueAxis; -import com.github.abel533.echarts.code.Trigger; -import com.github.abel533.echarts.data.PieData; -import com.github.abel533.echarts.series.Bar; -import com.github.abel533.echarts.series.Pie; -import com.jeecg.demo.dao.JeecgMinidaoDao; -import com.jeecg.demo.entity.JeecgDemoEntity; -import com.jeecg.demo.entity.JeecgDemoPage; -import com.jeecg.demo.entity.JeecgLogReport; -import com.jeecg.demo.service.JeecgDemoServiceI; - -/** - * @Title: Controller - * @Description: jeecg_demo - * @author onlineGenerator - * @date 2017-03-22 20:11:23 - * @version V1.0 - * - */ -@Controller -@RequestMapping("/jeecgListDemoController") -public class JeecgListDemoController extends BaseController { - /** - * Logger for this class - */ - private static final Logger logger = Logger.getLogger(JeecgListDemoController.class); - - @Autowired - private JeecgDemoServiceI jeecgDemoService; - @Autowired - private SystemService systemService; - - @Autowired - private JeecgMinidaoDao jeecgMinidaoDao; - - - - /** - * 采用minidao查询数据 - * @param request - * @return - */ - //JeecgListDemoController.do?minidaoListDemo - @RequestMapping(params = "minidaoListDemo") - public ModelAndView minidaoListDemo(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/taglist_minidao"); - } - - /** - * 行编辑列表 - */ - //JeecgListDemoController.do?rowListDemo - @RequestMapping(params = "rowListDemo") - public ModelAndView rowListDemo(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/list_rowedtior"); - } - - /** - * jeecg_demo列表 页面跳转 - * - * @return - */ - @RequestMapping(params = "list") - public ModelAndView list(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/jeecgDemoList"); - } - - /** - * 自定义查询条件 - */ - //JeecgListDemoController.do?mysearchListDemo - @RequestMapping(params = "mysearchListDemo") - public ModelAndView mysearchListDemo(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/taglist_mysearch"); - } - - - @RequestMapping(params = "minidaoDatagrid") - public void minidaoDatagrid(JeecgDemoEntity jeecgDemo,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - /** - * 注意:minidao会遵循springjdbc规则,会自动把数据库以下划线的字段,转化为驼峰写法 - * 例如数据库表字段:{USER_NAME} - * 转化实体对应字段:{userName} - */ - List list = jeecgMinidaoDao.getAllEntities(jeecgDemo, dataGrid.getPage(), dataGrid.getRows()); - Integer count = jeecgMinidaoDao.getCount(); - dataGrid.setTotal(count); - dataGrid.setResults(list); - String total_salary = String.valueOf(jeecgMinidaoDao.getSumSalary()); - /* - * 说明:格式为 字段名:值(可选,不写该值时为分页数据的合计) 多个合计 以 , 分割 - */ - dataGrid.setFooter("salary:"+(total_salary.equalsIgnoreCase("null")?"0.0":total_salary)+",age,email:合计"); - TagUtil.datagrid(response, dataGrid); - } - - - /** - * easyui AJAX请求数据 - * - * @param request - * @param response - * @param dataGrid - */ - - @RequestMapping(params = "datagrid") - public void datagrid(JeecgDemoEntity jeecgDemo,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(JeecgDemoEntity.class, dataGrid); - //查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jeecgDemo, request.getParameterMap()); - try{ - //自定义追加查询条件 - }catch (Exception e) { - throw new BusinessException(e.getMessage()); - } - cq.add(); - this.jeecgDemoService.getDataGridReturn(cq, true); - //String total_salary = String.valueOf(jeecgMinidaoDao.getSumSalary()); - /* - * 说明:格式为 字段名:值(可选,不写该值时为分页数据的合计) 多个合计 以 , 分割 - */ - //dataGrid.setFooter("salary:"+(total_salary.equalsIgnoreCase("null")?"0.0":total_salary)+",age,email:合计"); - List list=dataGrid.getResults(); - Map> extMap = new HashMap>(); - for(JeecgDemoEntity temp:list){ - //此为针对原来的行数据,拓展的新字段 - Map m = new HashMap(); - m.put("extField",this.jeecgMinidaoDao.getOrgCode(temp.getDepId())); - extMap.put(temp.getId(), m); - } - //dataGrid.setFooter("extField,salary,age,name:合计"); - TagUtil.datagrid(response, dataGrid,extMap); - dataGrid.setFooter("salary,age,name:合计"); - TagUtil.datagrid(response, dataGrid); - } - - @RequestMapping(params = "addTab") - public ModelAndView addTab(HttpServletRequest request) { - //String type = oConvertUtils.getString(request.getParameter("type")); - return new ModelAndView("com/jeecg/demo/demoTab"); - - } - - @RequestMapping(params = "goCheck") - public ModelAndView goCheck( HttpServletRequest request) { - logger.info("----审核-----"); - String id=request.getParameter("id"); - if (StringUtil.isNotEmpty(id)) { - JeecgDemoEntity jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, id); - request.setAttribute("jeecgDemoPage", jeecgDemo); - } - return new ModelAndView("com/jeecg/demo/jeecgDemo-check"); - - } - - @RequestMapping(params = "doCheck") - @ResponseBody - public AjaxJson doCheck(String content,String id,String status) { - logger.info("-------审核意见:"+content);//demo简单作打印,实际项目可酌情处理 - String message = null; - AjaxJson j = new AjaxJson(); - JeecgDemoEntity jeecgDemo = systemService.getEntity(JeecgDemoEntity.class, id); - message = "审核成功"; - try{ - jeecgDemo.setStatus(status); - this.jeecgDemoService.updateEntitie(jeecgDemo); - systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); - }catch(Exception e){ - e.printStackTrace(); - message = "审核失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - @RequestMapping(params = "addWithbtn") - public ModelAndView addWithbtn(HttpServletRequest request) { - return new ModelAndView("com/jeecg/demo/jeecgDemo-add-btn"); - - } - - /** - * JeecgDemo 打印预览跳转 - * @param jeecgDemo - * @param req - * @return - */ - @RequestMapping(params = "print") - public ModelAndView print(JeecgDemoEntity jeecgDemo, HttpServletRequest req) { - // 获取部门信息 - List departList = systemService.getList(TSDepart.class); - req.setAttribute("departList", departList); - - if (StringUtil.isNotEmpty(jeecgDemo.getId())) { - jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId()); - req.setAttribute("jgDemo", jeecgDemo); - if ("0".equals(jeecgDemo.getSex())) { - req.setAttribute("sex", "男"); - } - if ("1".equals(jeecgDemo.getSex())) { - req.setAttribute("sex", "女"); - } - } - return new ModelAndView("com/jeecg/demo/jeecgDemo-print"); - } - - /** - * 删除jeecg_demo - * - * @return - */ - @RequestMapping(params = "doDel") - @ResponseBody - public AjaxJson doDel(JeecgDemoEntity jeecgDemo, HttpServletRequest request) { - String message = null; - AjaxJson j = new AjaxJson(); - jeecgDemo = systemService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId()); - message = "删除成功"; - try{ - jeecgDemoService.delete(jeecgDemo); - systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); - }catch(Exception e){ - e.printStackTrace(); - message = "删除失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - - /** - * 批量删除jeecg_demo - * - * @return - */ - @RequestMapping(params = "doBatchDel") - @ResponseBody - public AjaxJson doBatchDel(String ids,HttpServletRequest request){ - String message = null; - AjaxJson j = new AjaxJson(); - message = "删除成功"; - try{ - for(String id:ids.split(",")){ - JeecgDemoEntity jeecgDemo = systemService.getEntity(JeecgDemoEntity.class, - id - ); - jeecgDemoService.delete(jeecgDemo); - systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); - } - }catch(Exception e){ - e.printStackTrace(); - message = "删除失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - - - /** - * 添加jeecg_demo - * - * @param jeecgDemo - * @return - */ - @RequestMapping(params = "doAdd") - @ResponseBody - public AjaxJson doAdd(JeecgDemoEntity jeecgDemo, HttpServletRequest request) { - String message = null; - AjaxJson j = new AjaxJson(); - message = "添加成功"; - try{ - jeecgDemoService.save(jeecgDemo); - systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); - }catch(Exception e){ - e.printStackTrace(); - message = "添加失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - - /** - * 更新jeecg_demo - * - * @param jeecgDemo - * @return - */ - @RequestMapping(params = "doUpdate") - @ResponseBody - public AjaxJson doUpdate(JeecgDemoEntity jeecgDemo, HttpServletRequest request) { - String message = null; - AjaxJson j = new AjaxJson(); - message = "更新成功"; - JeecgDemoEntity t = jeecgDemoService.get(JeecgDemoEntity.class, jeecgDemo.getId()); - try { - MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t); - jeecgDemoService.saveOrUpdate(t); - systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - message = "更新失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - - - /** - * jeecg_demo新增页面跳转 - * - * @return - */ - @RequestMapping(params = "goAdd") - public ModelAndView goAdd(JeecgDemoEntity jeecgDemo, HttpServletRequest req) { - if (StringUtil.isNotEmpty(jeecgDemo.getId())) { - jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId()); - req.setAttribute("jeecgDemoPage", jeecgDemo); - } - return new ModelAndView("com/jeecg/demo/jeecgDemo-add"); - } - /** - * jeecg_demo编辑页面跳转 - * - * @return - */ - @RequestMapping(params = "goUpdate") - public ModelAndView goUpdate(JeecgDemoEntity jeecgDemo, HttpServletRequest req) { - if (StringUtil.isNotEmpty(jeecgDemo.getId())) { - jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId()); - req.setAttribute("jeecgDemoPage", jeecgDemo); - } - return new ModelAndView("com/jeecg/demo/jeecgDemo-update"); - } - - /** - * 导入功能跳转 - * - * @return - */ - @RequestMapping(params = "upload") - public ModelAndView upload(HttpServletRequest req) { - req.setAttribute("controller_name","JeecgListDemoController"); - return new ModelAndView("common/upload/pub_excel_upload"); - } - - /** - * 导出excel - * - * @param request - * @param response - */ - @RequestMapping(params = "exportXls") - public String exportXls(JeecgDemoEntity jeecgDemo,HttpServletRequest request,HttpServletResponse response - , DataGrid dataGrid,ModelMap modelMap) { - CriteriaQuery cq = new CriteriaQuery(JeecgDemoEntity.class, dataGrid); - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jeecgDemo, request.getParameterMap()); - List jeecgDemos = this.jeecgDemoService.getListByCriteriaQuery(cq,false); - modelMap.put(NormalExcelConstants.FILE_NAME,"jeecg_demo"); - modelMap.put(NormalExcelConstants.CLASS,JeecgDemoEntity.class); - modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),"导出信息")); - modelMap.put(NormalExcelConstants.DATA_LIST,jeecgDemos); - return NormalExcelConstants.JEECG_EXCEL_VIEW; - } - /** - * 导出excel 使模板 - * - * @param request - * @param response - */ - @RequestMapping(params = "exportXlsByT") - public String exportXlsByT(JeecgDemoEntity jeecgDemo,HttpServletRequest request,HttpServletResponse response - , DataGrid dataGrid,ModelMap modelMap) { - modelMap.put(NormalExcelConstants.FILE_NAME,"jeecg_demo"); - modelMap.put(NormalExcelConstants.CLASS,JeecgDemoEntity.class); - modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), - "导出信息")); - modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList()); - return NormalExcelConstants.JEECG_EXCEL_VIEW; - } - - @SuppressWarnings("unchecked") - @RequestMapping(params = "importExcel", method = RequestMethod.POST) - @ResponseBody - public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) { - AjaxJson j = new AjaxJson(); - - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map fileMap = multipartRequest.getFileMap(); - for (Map.Entry entity : fileMap.entrySet()) { - MultipartFile file = entity.getValue();// 获取上传文件对象 - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setNeedSave(true); - try { - List listJeecgDemoEntitys = ExcelImportUtil.importExcel(file.getInputStream(),JeecgDemoEntity.class,params); - for (JeecgDemoEntity jeecgDemo : listJeecgDemoEntitys) { - jeecgDemoService.save(jeecgDemo); - } - j.setMsg("文件导入成功!"); - } catch (Exception e) { - j.setMsg("文件导入失败!"); - logger.error(ExceptionUtil.getExceptionMessage(e)); - }finally{ - try { - file.getInputStream().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return j; - } - - @RequestMapping(method = RequestMethod.GET) - @ResponseBody - public List list() { - List listJeecgDemos=jeecgDemoService.getList(JeecgDemoEntity.class); - return listJeecgDemos; - } - - /** - * 保存新增/更新的行数据 - * @param page - * @return - */ - @RequestMapping(params = "saveRows") - @ResponseBody - public AjaxJson saveRows(JeecgDemoPage page){ - String message = null; - List demos=page.getDemos(); - AjaxJson j = new AjaxJson(); - if(CollectionUtils.isNotEmpty(demos)){ - for(JeecgDemoEntity jeecgDemo:demos){ - if (StringUtil.isNotEmpty(jeecgDemo.getId())) { - JeecgDemoEntity t =jeecgDemoService.get(JeecgDemoEntity.class, jeecgDemo.getId()); - try { - message = "JeecgDemo例子: " + jeecgDemo.getName() + "被更新成功"; - MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t); - jeecgDemoService.saveOrUpdate(t); - systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - try { - message = "JeecgDemo例子: " + jeecgDemo.getName() + "被添加成功"; - //jeecgDemo.setStatus("0"); - jeecgDemoService.save(jeecgDemo); - systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - } - - } - } - } - return j; - } - - //jeecgListDemoController.do?log - @RequestMapping(params = "log") - public ModelAndView log() { - return new ModelAndView("com/jeecg/demo/logList"); - } - - //jeecgListDemoController.do?logDatagrid - @RequestMapping(params = "logDatagrid") - public void logDatagrid(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(TSLog.class, dataGrid); - - //日志级别查询条件 - String loglevel = request.getParameter("loglevel"); - if (loglevel != null && !"0".equals(loglevel)) { - cq.eq("loglevel", org.jeecgframework.core.util.oConvertUtils.getShort(loglevel)); - cq.add(); - } - //时间范围查询条件 - String operatetime_begin = request.getParameter("operatetime_begin"); - String operatetime_end = request.getParameter("operatetime_end"); - if(oConvertUtils.isNotEmpty(operatetime_begin)){ - try { - cq.ge("operatetime", DateUtils.parseDate(operatetime_begin, "yyyy-MM-dd hh:mm:ss")); - } catch (ParseException e) { - logger.error(e); - } - cq.add(); - } - if(oConvertUtils.isNotEmpty(operatetime_end)){ - try { - cq.le("operatetime", DateUtils.parseDate(operatetime_end, "yyyy-MM-dd hh:mm:ss")); - } catch (ParseException e) { - logger.error(e); - } - cq.add(); - } - this.systemService.getDataGridReturn(cq, true); - TagUtil.datagrid(response, dataGrid); - } - - @RequestMapping(params = "goOnlyData") - public ModelAndView goOnlyData(HttpServletRequest req,JeecgLogReport log) { - return new ModelAndView("com/jeecg/demo/logrp-onlyData"); - } - - @RequestMapping(params = "logrpDatagrid") - public void logrpDatagrid(HttpServletResponse response,JeecgLogReport log, DataGrid dataGrid) { - //CriteriaQuery cq = new CriteriaQuery(JeecgLogReport.class, dataGrid); - List list=this.jeecgMinidaoDao.getLogReportData(log); - dataGrid.setResults(list); - TagUtil.datagrid(response, dataGrid); - } - - @RequestMapping(params = "goChart") - public ModelAndView goChart(HttpServletRequest req,JeecgLogReport log) { - List> list=this.jeecgMinidaoDao.getLogChartData(log); - net.sf.json.JSONArray arr=net.sf.json.JSONArray.fromObject(list); - req.setAttribute("logs",arr); - return new ModelAndView("com/jeecg/demo/logrp-chart"); - } - @RequestMapping(params = "goEchart") - public ModelAndView goEchart(HttpServletRequest req,JeecgLogReport log) { - return new ModelAndView("com/jeecg/demo/echart"); - } - @RequestMapping(params = "doEchart",method ={RequestMethod.GET, RequestMethod.POST}) - @ResponseBody - public AjaxJson doEchart(HttpServletRequest req,JeecgLogReport log) { - //创建Option - Option option = new Option(); - option.title("日志").tooltip(Trigger.axis).legend("登录次数"); - //横轴为值轴 - option.xAxis(new ValueAxis().boundaryGap(0d, 0.01)); - //创建类目轴 - CategoryAxis category = new CategoryAxis(); - //柱状数据 - Bar bar = new Bar("登录次数"); - //饼图数据 - Pie pie = new Pie("登录次数"); - //循环数据 - List> list=this.jeecgMinidaoDao.getLogChartData(log); - - for (Map objectMap : list) { - //设置类目 - category.data(objectMap.get("name")); - //类目对应的柱状图 - bar.data(objectMap.get("value")); - //饼图数据 - System.out.println("value************"+objectMap.get("value")); - pie.data(new PieData(objectMap.get("name").toString(), objectMap.get("value"))); - } - //设置类目轴 - option.yAxis(category); - //饼图的圆心和半径 - pie.center(900,380).radius(100); - //设置数据 - option.series(bar, pie); - - - AjaxJson j = new AjaxJson(); - j.setObj(option); - System.out.println(j.toString()); - return j; - } -} diff --git a/src/main/java/com/jeecg/demo/dao/JeecgMinidaoDao.java b/src/main/java/com/jeecg/demo/dao/JeecgMinidaoDao.java deleted file mode 100644 index 64c2f331..00000000 --- a/src/main/java/com/jeecg/demo/dao/JeecgMinidaoDao.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.jeecg.demo.dao; - -import java.util.List; -import java.util.Map; - -import com.zzjee.ba.entity.BaGoodsCategoryEntity; -import com.zzjee.ba.vo.BaGoodsCategoryVoo; -import org.jeecgframework.minidao.annotation.Arguments; -import org.jeecgframework.minidao.annotation.MiniDao; -import org.jeecgframework.minidao.annotation.ResultType; -import org.jeecgframework.minidao.annotation.Sql; - -import com.jeecg.demo.entity.JeecgDemoEntity; -import com.jeecg.demo.entity.JeecgLogReport; - -/** - * Minidao例子 - * - */ -@MiniDao -public interface JeecgMinidaoDao { - - /** - * @Description - * @Author xushanchang - * @Date 2021/7/411:08 - * @Param - * @return - **/ - @Arguments("pid") - @Sql("select ID,NAME,PID from t_s_region where pid=:pid order by name_en") - List> getProCity(String pid); - - @Sql("select ID,NAME,PID from t_s_region order by name_en") - List> getAllRegions(); - - @Sql("select ID,category_name as categoryName,PID,category_level categoryLevel from ba_goods_category ") - List getAllBaGoodsCategorys(); - - @Arguments("pid") - @Sql("select ID,category_name as categoryName,PID from ba_goods_category where pid=:pid") - List getAllBaGoodsCategorys(String pid); - - @Arguments({"jeecgDemo", "page", "rows"}) - @ResultType(JeecgDemoEntity.class) - public List getAllEntities(JeecgDemoEntity jeecgDemo, int page, int rows); - - @Arguments({"baGoodsCategory", "page", "rows"}) - @ResultType(BaGoodsCategoryEntity.class) - public List getAllEntities(BaGoodsCategoryEntity baGoodsCategory, int page, int rows); - - @Sql("SELECT count(*) FROM jeecg_demo") - Integer getCount(); - - @Sql("SELECT SUM(salary) FROM jeecg_demo") - Integer getSumSalary(); - - @Arguments("id") - @ResultType(String.class) - @Sql("SELECT org_code FROM t_s_depart where id=:id") - public java.lang.String getOrgCode(String id); - - /*@Arguments({"jeecgMinidao", "page", "rows"}) - public List getAllEntities(JeecgMinidaoEntity jeecgMinidao, int page, int rows); - - @Arguments({"jeecgMinidao", "page", "rows"}) - @ResultType(JeecgMinidaoEntity.class) - public List getAllEntities2(JeecgMinidaoEntity jeecgMinidao, int page, int rows);*/ - - //@Arguments("id") - //JeecgMinidaoEntity getJeecgMinidao(String id); - -/* -*/ - - /*@Arguments("jeecgMinidao") - int update(JeecgMinidaoEntity jeecgMinidao); - - @Arguments("jeecgMinidao") - void insert(JeecgMinidaoEntity jeecgMinidao); - - @Arguments("jeecgMinidao") - void delete(JeecgMinidaoEntity jeecgMinidao);*/ - - @Arguments("log") - @ResultType(JeecgLogReport.class) - List getLogReportData(JeecgLogReport log); - - @Arguments("log") - List> getLogChartData(JeecgLogReport log); -} diff --git a/src/main/java/com/jeecg/demo/entity/JeecgDemoEntity.java b/src/main/java/com/jeecg/demo/entity/JeecgDemoEntity.java deleted file mode 100644 index 69aee186..00000000 --- a/src/main/java/com/jeecg/demo/entity/JeecgDemoEntity.java +++ /dev/null @@ -1,390 +0,0 @@ -package com.jeecg.demo.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; - -import org.hibernate.annotations.GenericGenerator; -import org.jeecgframework.poi.excel.annotation.Excel; - -/** - * @Title: Entity - * @Description: jeecg_demo - * @author onlineGenerator - * @date 2017-03-22 20:11:23 - * @version V1.0 - * - */ -@Entity -@Table(name = "jeecg_demo", schema = "") -@SuppressWarnings("serial") -public class JeecgDemoEntity implements java.io.Serializable { - /**id*/ - private java.lang.String id; - /**名称*/ - @Excel(name="名称",width=32) - private java.lang.String name; - /**年龄*/ - @Excel(name="年龄") - private java.lang.Integer age; - /**生日*/ - @Excel(name="生日",format = "yyyy-MM-dd") - private java.util.Date birthday; - /**个人介绍*/ - @Excel(name="个人介绍") - private java.lang.String content; - /**部门*/ - @Excel(name="部门",dictTable="t_s_depart",dicCode="id",dicText="departname") - private java.lang.String depId; - /**邮箱*/ - @Excel(name="邮箱",width=32) - private java.lang.String email; - /**电话*/ - @Excel(name="电话",width=12) - private java.lang.String phone; - /**工资*/ - @Excel(name="工资") - private java.lang.String salary; - /**性别*/ - @Excel(name="性别",dicCode="sex") - private java.lang.String sex; - /**入职状态*/ - @Excel(name="入职状态",dicCode="sf_yn") - private java.lang.String status; - /**createDate*/ - private java.util.Date createDate; - /**创建人id*/ - private java.lang.String createBy; - /**创建人*/ - private java.lang.String createName; - /**修改人id*/ - private java.lang.String updateBy; - /**修改时间*/ - private java.util.Date updateDate; - /**修改人*/ - private java.lang.String updateName; - /** 组织 */ - @Excel(name="部门编码",width=200) - private java.lang.String sysOrgCode; - /** 公司 */ - private java.lang.String sysCompanyCode; - - private java.lang.String touxiang; - private java.lang.String fujian; - - - /** - *方法: 取得java.lang.String - *@return: java.lang.String id - */ - @Id - @GeneratedValue(generator = "paymentableGenerator") - @GenericGenerator(name = "paymentableGenerator", strategy = "uuid") - @Column(name ="ID",nullable=false,length=32) - public java.lang.String getId(){ - return this.id; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String id - */ - public void setId(java.lang.String id){ - this.id = id; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 名称 - */ - @Column(name ="NAME",nullable=false,length=255) - public java.lang.String getName(){ - return this.name; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 名称 - */ - public void setName(java.lang.String name){ - this.name = name; - } - /** - *方法: 取得java.lang.Integer - *@return: java.lang.Integer 年龄 - */ - @Column(name ="AGE",nullable=true,length=10) - public java.lang.Integer getAge(){ - return this.age; - } - - /** - *方法: 设置java.lang.Integer - *@param: java.lang.Integer 年龄 - */ - public void setAge(java.lang.Integer age){ - this.age = age; - } - /** - *方法: 取得java.util.Date - *@return: java.util.Date 生日 - */ - @Column(name ="BIRTHDAY",nullable=true) - public java.util.Date getBirthday(){ - return this.birthday; - } - - /** - *方法: 设置java.util.Date - *@param: java.util.Date 生日 - */ - public void setBirthday(java.util.Date birthday){ - this.birthday = birthday; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 个人介绍 - */ - @Column(name ="CONTENT",nullable=true,length=255) - public java.lang.String getContent(){ - return this.content; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 个人介绍 - */ - public void setContent(java.lang.String content){ - this.content = content; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 部门 - */ - @Column(name ="DEP_ID",nullable=true,length=255) - public java.lang.String getDepId(){ - return this.depId; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 部门 - */ - public void setDepId(java.lang.String depId){ - this.depId = depId; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 邮箱 - */ - @Column(name ="EMAIL",nullable=true,length=255) - public java.lang.String getEmail(){ - return this.email; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 邮箱 - */ - public void setEmail(java.lang.String email){ - this.email = email; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 电话 - */ - @Column(name ="PHONE",nullable=true,length=255) - public java.lang.String getPhone(){ - return this.phone; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 电话 - */ - public void setPhone(java.lang.String phone){ - this.phone = phone; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 工资 - */ - @Column(name ="SALARY",nullable=true,scale=2,length=19) - public java.lang.String getSalary(){ - return this.salary; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 工资 - */ - public void setSalary(java.lang.String salary){ - this.salary = salary; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 性别 - */ - @Column(name ="SEX",nullable=true,length=255) - public java.lang.String getSex(){ - return this.sex; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 性别 - */ - public void setSex(java.lang.String sex){ - this.sex = sex; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 入职状态 - */ - @Column(name ="STATUS",nullable=true,length=255) - public java.lang.String getStatus(){ - return this.status; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 入职状态 - */ - public void setStatus(java.lang.String status){ - this.status = status; - } - /** - *方法: 取得java.util.Date - *@return: java.util.Date createDate - */ - @Column(name ="CREATE_DATE",nullable=true) - public java.util.Date getCreateDate(){ - return this.createDate; - } - - /** - *方法: 设置java.util.Date - *@param: java.util.Date createDate - */ - public void setCreateDate(java.util.Date createDate){ - this.createDate = createDate; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 创建人id - */ - @Column(name ="CREATE_BY",nullable=true,length=32) - public java.lang.String getCreateBy(){ - return this.createBy; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 创建人id - */ - public void setCreateBy(java.lang.String createBy){ - this.createBy = createBy; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 创建人 - */ - @Column(name ="CREATE_NAME",nullable=true,length=32) - public java.lang.String getCreateName(){ - return this.createName; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 创建人 - */ - public void setCreateName(java.lang.String createName){ - this.createName = createName; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 修改人id - */ - @Column(name ="UPDATE_BY",nullable=true,length=32) - public java.lang.String getUpdateBy(){ - return this.updateBy; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 修改人id - */ - public void setUpdateBy(java.lang.String updateBy){ - this.updateBy = updateBy; - } - /** - *方法: 取得java.util.Date - *@return: java.util.Date 修改时间 - */ - @Column(name ="UPDATE_DATE",nullable=true) - public java.util.Date getUpdateDate(){ - return this.updateDate; - } - - /** - *方法: 设置java.util.Date - *@param: java.util.Date 修改时间 - */ - public void setUpdateDate(java.util.Date updateDate){ - this.updateDate = updateDate; - } - /** - *方法: 取得java.lang.String - *@return: java.lang.String 修改人 - */ - @Column(name ="UPDATE_NAME",nullable=true,length=32) - public java.lang.String getUpdateName(){ - return this.updateName; - } - - /** - *方法: 设置java.lang.String - *@param: java.lang.String 修改人 - */ - public void setUpdateName(java.lang.String updateName){ - this.updateName = updateName; - } - @Column(name = "sys_org_code", nullable = true, length = 15) - public java.lang.String getSysOrgCode() { - return sysOrgCode; - } - - public void setSysOrgCode(java.lang.String sysOrgCode) { - this.sysOrgCode = sysOrgCode; - } - - @Column(name = "sys_company_code", nullable = true, length = 15) - public java.lang.String getSysCompanyCode() { - return sysCompanyCode; - } - - public void setSysCompanyCode(java.lang.String sysCompanyCode) { - this.sysCompanyCode = sysCompanyCode; - } - - @Column(name = "touxiang", nullable = true, length = 255) - public java.lang.String getTouxiang() { - return touxiang; - } - - public void setTouxiang(java.lang.String touxiang) { - this.touxiang = touxiang; - } - - @Column(name = "fujian", nullable = true, length = 255) - public java.lang.String getFujian() { - return fujian; - } - - public void setFujian(java.lang.String fujian) { - this.fujian = fujian; - } - - -} diff --git a/src/main/java/com/jeecg/demo/entity/JeecgDemoPage.java b/src/main/java/com/jeecg/demo/entity/JeecgDemoPage.java deleted file mode 100644 index 86f6953f..00000000 --- a/src/main/java/com/jeecg/demo/entity/JeecgDemoPage.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.jeecg.demo.entity; - -import java.util.List; - -/** - */ -public class JeecgDemoPage { - private List demos; - - public List getDemos() { - return demos; - } - - public void setDemos(List demos) { - this.demos = demos; - } -} diff --git a/src/main/java/com/jeecg/demo/entity/JeecgLogReport.java b/src/main/java/com/jeecg/demo/entity/JeecgLogReport.java deleted file mode 100644 index 12456994..00000000 --- a/src/main/java/com/jeecg/demo/entity/JeecgLogReport.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.jeecg.demo.entity; - -import java.util.Date; - -public class JeecgLogReport { - private String id; - private String name; - private int ct; - private int loginct; - private int outct; - private int xgct; - - - public int getOutct() { - return outct; - } - public void setOutct(int outct) { - this.outct = outct; - } - public int getXgct() { - return xgct; - } - public void setXgct(int xgct) { - this.xgct = xgct; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public int getCt() { - return ct; - } - public void setCt(int ct) { - this.ct = ct; - } - public int getLoginct() { - return loginct; - } - public void setLoginct(int loginct) { - this.loginct = loginct; - } - private Date beginDate; - private Date endDate; - - public Date getBeginDate() { - return beginDate; - } - public void setBeginDate(Date beginDate) { - this.beginDate = beginDate; - } - public Date getEndDate() { - return endDate; - } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - - private int value; - private String color; - - - public int getValue() { - return value; - } - public void setValue(int value) { - this.value = value; - } - public String getColor() { - return color; - } - public void setColor(String color) { - this.color = color; - } - -} diff --git a/src/main/java/com/jeecg/demo/service/JeecgDemoServiceI.java b/src/main/java/com/jeecg/demo/service/JeecgDemoServiceI.java deleted file mode 100644 index 2129607f..00000000 --- a/src/main/java/com/jeecg/demo/service/JeecgDemoServiceI.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.jeecg.demo.service; -import com.jeecg.demo.entity.JeecgDemoEntity; -import org.jeecgframework.core.common.service.CommonService; - -import java.io.Serializable; - -public interface JeecgDemoServiceI extends CommonService{ - - public void delete(JeecgDemoEntity entity) throws Exception; - - public Serializable save(JeecgDemoEntity entity) throws Exception; - - public void saveOrUpdate(JeecgDemoEntity entity) throws Exception; - - - -} diff --git a/src/main/java/com/jeecg/demo/service/impl/JeecgDemoServiceImpl.java b/src/main/java/com/jeecg/demo/service/impl/JeecgDemoServiceImpl.java deleted file mode 100644 index e04c038b..00000000 --- a/src/main/java/com/jeecg/demo/service/impl/JeecgDemoServiceImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.jeecg.demo.service.impl; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.jeecgframework.core.common.service.impl.CommonServiceImpl; -import org.jeecgframework.core.util.ApplicationContextUtil; -import org.jeecgframework.core.util.MyClassLoader; -import org.jeecgframework.core.util.StringUtil; -import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.jeecg.demo.entity.JeecgDemoEntity; -import com.jeecg.demo.service.JeecgDemoServiceI; - -@Service("jeecgDemoService") -@Transactional -public class JeecgDemoServiceImpl extends CommonServiceImpl implements JeecgDemoServiceI { - - - @Override - public void delete(JeecgDemoEntity entity) throws Exception{ - super.delete(entity); - //执行删除操作增强业务 - this.doDelBus(entity); - } - - @Override - public Serializable save(JeecgDemoEntity entity) throws Exception{ - Serializable t = super.save(entity); - //执行新增操作增强业务 - this.doAddBus(entity); - return t; - } - - @Override - public void saveOrUpdate(JeecgDemoEntity entity) throws Exception{ - super.saveOrUpdate(entity); - //执行更新操作增强业务 - this.doUpdateBus(entity); - } - - /** - * 新增操作增强业务 - * @param t - * @return - */ - private void doAddBus(JeecgDemoEntity t) throws Exception{ - } - /** - * 更新操作增强业务 - * @param t - * @return - */ - private void doUpdateBus(JeecgDemoEntity t) throws Exception{ - } - /** - * 删除操作增强业务 - * @param t - * @return - */ - private void doDelBus(JeecgDemoEntity t) throws Exception{ - } - - private Map populationMap(JeecgDemoEntity t){ - Map map = new HashMap(); - map.put("id", t.getId()); - map.put("name", t.getName()); - map.put("age", t.getAge()); - map.put("birthday", t.getBirthday()); - map.put("content", t.getContent()); - map.put("dep_id", t.getDepId()); - map.put("email", t.getEmail()); - map.put("phone", t.getPhone()); - map.put("salary", t.getSalary()); - map.put("sex", t.getSex()); - map.put("status", t.getStatus()); - map.put("create_date", t.getCreateDate()); - map.put("create_by", t.getCreateBy()); - map.put("create_name", t.getCreateName()); - map.put("update_by", t.getUpdateBy()); - map.put("update_date", t.getUpdateDate()); - map.put("update_name", t.getUpdateName()); - return map; - } - - /** - * 替换sql中的变量 - * @param sql - * @param t - * @return - */ - public String replaceVal(String sql,JeecgDemoEntity t){ - sql = sql.replace("#{id}",String.valueOf(t.getId())); - sql = sql.replace("#{name}",String.valueOf(t.getName())); - sql = sql.replace("#{age}",String.valueOf(t.getAge())); - sql = sql.replace("#{birthday}",String.valueOf(t.getBirthday())); - sql = sql.replace("#{content}",String.valueOf(t.getContent())); - sql = sql.replace("#{dep_id}",String.valueOf(t.getDepId())); - sql = sql.replace("#{email}",String.valueOf(t.getEmail())); - sql = sql.replace("#{phone}",String.valueOf(t.getPhone())); - sql = sql.replace("#{salary}",String.valueOf(t.getSalary())); - sql = sql.replace("#{sex}",String.valueOf(t.getSex())); - sql = sql.replace("#{status}",String.valueOf(t.getStatus())); - sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate())); - sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy())); - sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName())); - sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy())); - sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate())); - sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName())); - sql = sql.replace("#{UUID}",UUID.randomUUID().toString()); - return sql; - } - - /** - * 执行JAVA增强 - */ - private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map data) throws Exception { - if(StringUtil.isNotEmpty(cgJavaValue)){ - Object obj = null; - try { - if("class".equals(cgJavaType)){ - //因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断 - obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance(); - }else if("spring".equals(cgJavaType)){ - obj = ApplicationContextUtil.getContext().getBean(cgJavaValue); - } - if(obj instanceof CgformEnhanceJavaInter){ - CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj; - javaInter.execute("jeecg_demo",data); - } - } catch (Exception e) { - e.printStackTrace(); - throw new Exception("执行JAVA增强出现异常!"); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getAllEntities.sql b/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getAllEntities.sql deleted file mode 100644 index 619a84ad..00000000 --- a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getAllEntities.sql +++ /dev/null @@ -1,25 +0,0 @@ -SELECT * FROM jeecg_demo WHERE 1=1 -<#if jeecgDemo.name ?exists && jeecgDemo.name ?length gt 0> - and name = :jeecgDemo.name - -<#if jeecgDemo.age ?exists && jeecgDemo.age ?length gt 0> - and age = :jeecgDemo.age - -<#if jeecgDemo.depId ?exists && jeecgDemo.depId ?length gt 0> - and dep_id = :jeecgDemo.depId - -<#if jeecgDemo.email ?exists && jeecgDemo.email ?length gt 0> - and email = :jeecgDemo.email - -<#if jeecgDemo.phone ?exists && jeecgDemo.phone ?length gt 0> - and phone = :jeecgDemo.phone - -<#if jeecgDemo.salary ?exists && jeecgDemo.salary ?length gt 0> - and salary = :jeecgDemo.salary - -<#if jeecgDemo.sex ?exists && jeecgDemo.sex ?length gt 0> - and sex = :jeecgDemo.sex - -<#if jeecgDemo.status ?exists && jeecgDemo.status ?length gt 0> - and status = :jeecgDemo.status - diff --git a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogChartData.sql b/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogChartData.sql deleted file mode 100644 index 594628b6..00000000 --- a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogChartData.sql +++ /dev/null @@ -1,15 +0,0 @@ -SELECT - broswer as name, - count(1) as 'value', - CASE -WHEN broswer = 'Firefox' THEN - '#FF00FF' -WHEN broswer = 'IE' THEN - '#FFFF00' -ELSE - '#43CD80' -END as color -FROM - t_s_log -GROUP BY - broswer; \ No newline at end of file diff --git a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogReportData.sql b/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogReportData.sql deleted file mode 100644 index 5c0177ec..00000000 --- a/src/main/java/com/jeecg/demo/sql/JeecgMinidaoDao_getLogReportData.sql +++ /dev/null @@ -1,34 +0,0 @@ -SELECT -a.userid as id, -b.username as name, - count(*) as ct, - sum( - CASE - WHEN RIGHT (logcontent, 4) IN ('登录成功', 'cess') THEN - 1 - ELSE - 0 - END - ) as loginct, - sum( - CASE - WHEN RIGHT (logcontent, 2) = '退出' THEN - 1 - ELSE - 0 - END - ) as outct, - sum( - CASE - WHEN RIGHT (logcontent, 4) IN ('删除成功', '更新成功','录入成功') THEN - 1 - ELSE - 0 - END - ) as xgct -FROM - t_s_log a join t_s_base_user b on b.id=a.userid -GROUP BY - a.userid -ORDER BY - ct DESC