| | |
| | | |
| | | |
| | | -- ---------------------------- |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.se.system.service.inte.ISysStatusCtrlService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.se.common.log.annotation.Log; |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | | import com.se.common.core.web.controller.BaseController; |
| | | import com.se.common.core.web.domain.AjaxResult; |
| | | import com.se.common.core.utils.poi.ExcelUtil; |
| | | import com.se.common.core.web.page.TableDataInfo; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§Controller |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/ctrl") |
| | | public class SysStatusCtrlController extends BaseController |
| | | { |
| | | @Resource |
| | | private ISysStatusCtrlService sysStatusCtrlService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§å表 |
| | | */ |
| | | @RequiresPermissions("system:ctrl:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | startPage(); |
| | | List<SysStatusCtrl> list = sysStatusCtrlService.selectSysStatusCtrlList(sysStatusCtrl); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç³»ç»ç¶æçæ§å表 |
| | | */ |
| | | @RequiresPermissions("system:ctrl:export") |
| | | @Log(title = "ç³»ç»ç¶æçæ§", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | List<SysStatusCtrl> list = sysStatusCtrlService.selectSysStatusCtrlList(sysStatusCtrl); |
| | | ExcelUtil<SysStatusCtrl> util = new ExcelUtil<SysStatusCtrl>(SysStatusCtrl.class); |
| | | util.exportExcel(response, list, "ç³»ç»ç¶æçæ§æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·åç³»ç»ç¶æçæ§è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("system:ctrl:query") |
| | | @GetMapping(value = "/{statusId}") |
| | | public AjaxResult getInfo(@PathVariable("statusId") Long statusId) |
| | | { |
| | | return success(sysStatusCtrlService.selectSysStatusCtrlByStatusId(statusId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç³»ç»ç¶æçæ§ |
| | | */ |
| | | @RequiresPermissions("system:ctrl:add") |
| | | @Log(title = "ç³»ç»ç¶æçæ§", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | return toAjax(sysStatusCtrlService.insertSysStatusCtrl(sysStatusCtrl)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç³»ç»ç¶æçæ§ |
| | | */ |
| | | @RequiresPermissions("system:ctrl:edit") |
| | | @Log(title = "ç³»ç»ç¶æçæ§", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | return toAjax(sysStatusCtrlService.updateSysStatusCtrl(sysStatusCtrl)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç³»ç»ç¶æçæ§ |
| | | */ |
| | | @RequiresPermissions("system:ctrl:remove") |
| | | @Log(title = "ç³»ç»ç¶æçæ§", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{statusIds}") |
| | | public AjaxResult remove(@PathVariable Long[] statusIds) |
| | | { |
| | | return toAjax(sysStatusCtrlService.deleteSysStatusCtrlByStatusIds(statusIds)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.se.system.service.inte.ISysTaskCtrlService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.se.common.log.annotation.Log; |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.system.domain.SysTaskCtrl; |
| | | import com.se.common.core.web.controller.BaseController; |
| | | import com.se.common.core.web.domain.AjaxResult; |
| | | import com.se.common.core.utils.poi.ExcelUtil; |
| | | import com.se.common.core.web.page.TableDataInfo; |
| | | |
| | | /** |
| | | * åç³»ç»ä»»å¡æ§å¶Controller |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/taskCtrl") |
| | | public class SysTaskCtrlController extends BaseController |
| | | { |
| | | @Resource |
| | | private ISysTaskCtrlService sysTaskCtrlService; |
| | | |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶å表 |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | startPage(); |
| | | List<SysTaskCtrl> list = sysTaskCtrlService.selectSysTaskCtrlList(sysTaskCtrl); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåç³»ç»ä»»å¡æ§å¶å表 |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:export") |
| | | @Log(title = "åç³»ç»ä»»å¡æ§å¶", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | List<SysTaskCtrl> list = sysTaskCtrlService.selectSysTaskCtrlList(sysTaskCtrl); |
| | | ExcelUtil<SysTaskCtrl> util = new ExcelUtil<SysTaskCtrl>(SysTaskCtrl.class); |
| | | util.exportExcel(response, list, "åç³»ç»ä»»å¡æ§å¶æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·ååç³»ç»ä»»å¡æ§å¶è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:query") |
| | | @GetMapping(value = "/{taskId}") |
| | | public AjaxResult getInfo(@PathVariable("taskId") Long taskId) |
| | | { |
| | | return success(sysTaskCtrlService.selectSysTaskCtrlByTaskId(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:add") |
| | | @Log(title = "åç³»ç»ä»»å¡æ§å¶", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | return toAjax(sysTaskCtrlService.insertSysTaskCtrl(sysTaskCtrl)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:edit") |
| | | @Log(title = "åç³»ç»ä»»å¡æ§å¶", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | return toAjax(sysTaskCtrlService.updateSysTaskCtrl(sysTaskCtrl)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | @RequiresPermissions("system:taskCtrl:remove") |
| | | @Log(title = "åç³»ç»ä»»å¡æ§å¶", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{taskIds}") |
| | | public AjaxResult remove(@PathVariable Long[] taskIds) |
| | | { |
| | | return toAjax(sysTaskCtrlService.deleteSysTaskCtrlByTaskIds(taskIds)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.domain; |
| | | |
| | | import com.se.common.core.annotation.Excel; |
| | | import com.se.common.core.web.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§å¯¹è±¡ sys_status_ctrl |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public class SysStatusCtrl extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ç¶æID */ |
| | | private Long statusId; |
| | | |
| | | /** åç§° */ |
| | | @Excel(name = "åç§°") |
| | | private String sysName; |
| | | |
| | | /** IP */ |
| | | @Excel(name = "IP") |
| | | private String ip; |
| | | |
| | | /** URL */ |
| | | @Excel(name = "URL") |
| | | private String url; |
| | | |
| | | /** è¯·æ±æ¹æ³ */ |
| | | @Excel(name = "è¯·æ±æ¹æ³") |
| | | private String method; |
| | | |
| | | /** æ¾ç¤ºé¡ºåº */ |
| | | @Excel(name = "æ¾ç¤ºé¡ºåº") |
| | | private Long orderNum; |
| | | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | public void setStatusId(Long statusId) |
| | | { |
| | | this.statusId = statusId; |
| | | } |
| | | |
| | | public Long getStatusId() |
| | | { |
| | | return statusId; |
| | | } |
| | | public void setSysName(String sysName) |
| | | { |
| | | this.sysName = sysName; |
| | | } |
| | | |
| | | public String getSysName() |
| | | { |
| | | return sysName; |
| | | } |
| | | public void setIp(String ip) |
| | | { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getIp() |
| | | { |
| | | return ip; |
| | | } |
| | | public void setUrl(String url) |
| | | { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getUrl() |
| | | { |
| | | return url; |
| | | } |
| | | public void setMethod(String method) |
| | | { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getMethod() |
| | | { |
| | | return method; |
| | | } |
| | | public void setOrderNum(Long orderNum) |
| | | { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Long getOrderNum() |
| | | { |
| | | return orderNum; |
| | | } |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("statusId", getStatusId()) |
| | | .append("sysName", getSysName()) |
| | | .append("ip", getIp()) |
| | | .append("url", getUrl()) |
| | | .append("method", getMethod()) |
| | | .append("orderNum", getOrderNum()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.domain; |
| | | |
| | | import com.se.common.core.annotation.Excel; |
| | | import com.se.common.core.web.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | /** |
| | | * åç³»ç»ä»»å¡æ§å¶å¯¹è±¡ sys_task_ctrl |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public class SysTaskCtrl extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ä»»å¡ID */ |
| | | private Long taskId; |
| | | |
| | | /** ä»»å¡ID */ |
| | | @Excel(name = "ä»»å¡ID") |
| | | private String prjId; |
| | | |
| | | /** ä»»å¡åç§° */ |
| | | @Excel(name = "ä»»å¡åç§°") |
| | | private String prjName; |
| | | |
| | | /** æ³å®ID */ |
| | | @Excel(name = "æ³å®ID") |
| | | private String thinkId; |
| | | |
| | | /** æ³å®åç§° */ |
| | | @Excel(name = "æ³å®åç§°") |
| | | private String thinkName; |
| | | |
| | | /** æ¯å¦ä¿åï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "æ¯å¦ä¿å", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String isSave; |
| | | |
| | | /** èç¹ */ |
| | | @Excel(name = "èç¹") |
| | | private String node; |
| | | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | public void setTaskId(Long taskId) |
| | | { |
| | | this.taskId = taskId; |
| | | } |
| | | |
| | | public Long getTaskId() |
| | | { |
| | | return taskId; |
| | | } |
| | | public void setPrjId(String prjId) |
| | | { |
| | | this.prjId = prjId; |
| | | } |
| | | |
| | | public String getPrjId() |
| | | { |
| | | return prjId; |
| | | } |
| | | public void setPrjName(String prjName) |
| | | { |
| | | this.prjName = prjName; |
| | | } |
| | | |
| | | public String getPrjName() |
| | | { |
| | | return prjName; |
| | | } |
| | | public void setThinkId(String thinkId) |
| | | { |
| | | this.thinkId = thinkId; |
| | | } |
| | | |
| | | public String getThinkId() |
| | | { |
| | | return thinkId; |
| | | } |
| | | public void setThinkName(String thinkName) |
| | | { |
| | | this.thinkName = thinkName; |
| | | } |
| | | |
| | | public String getThinkName() |
| | | { |
| | | return thinkName; |
| | | } |
| | | public void setIsSave(String isSave) |
| | | { |
| | | this.isSave = isSave; |
| | | } |
| | | |
| | | public String getIsSave() |
| | | { |
| | | return isSave; |
| | | } |
| | | public void setNode(String node) |
| | | { |
| | | this.node = node; |
| | | } |
| | | |
| | | public String getNode() |
| | | { |
| | | return node; |
| | | } |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("taskId", getTaskId()) |
| | | .append("prjId", getPrjId()) |
| | | .append("prjName", getPrjName()) |
| | | .append("thinkId", getThinkId()) |
| | | .append("thinkName", getThinkName()) |
| | | .append("isSave", getIsSave()) |
| | | .append("node", getNode()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§Mapperæ¥å£ |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public interface SysStatusCtrlMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç³»ç»ç¶æçæ§ |
| | | */ |
| | | public SysStatusCtrl selectSysStatusCtrlByStatusId(Long statusId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§å表 |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç³»ç»ç¶æçæ§éå |
| | | */ |
| | | public List<SysStatusCtrl> selectSysStatusCtrlList(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * æ°å¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysStatusCtrl(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysStatusCtrl(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * å é¤ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysStatusCtrlByStatusId(Long statusId); |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusIds éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysStatusCtrlByStatusIds(Long[] statusIds); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysTaskCtrl; |
| | | |
| | | /** |
| | | * åç³»ç»ä»»å¡æ§å¶Mapperæ¥å£ |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public interface SysTaskCtrlMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | public SysTaskCtrl selectSysTaskCtrlByTaskId(Long taskId); |
| | | |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶å表 |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return åç³»ç»ä»»å¡æ§å¶éå |
| | | */ |
| | | public List<SysTaskCtrl> selectSysTaskCtrlList(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * æ°å¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysTaskCtrl(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * ä¿®æ¹åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysTaskCtrl(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * å é¤åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysTaskCtrlByTaskId(Long taskId); |
| | | |
| | | /** |
| | | * æ¹éå é¤åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskIds éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysTaskCtrlByTaskIds(Long[] taskIds); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import com.se.common.core.utils.DateUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.mapper.SysStatusCtrlMapper; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | | import com.se.system.service.inte.ISysStatusCtrlService; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | @Service |
| | | public class SysStatusCtrlServiceImpl implements ISysStatusCtrlService |
| | | { |
| | | @Resource |
| | | private SysStatusCtrlMapper sysStatusCtrlMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç³»ç»ç¶æçæ§ |
| | | */ |
| | | @Override |
| | | public SysStatusCtrl selectSysStatusCtrlByStatusId(Long statusId) |
| | | { |
| | | return sysStatusCtrlMapper.selectSysStatusCtrlByStatusId(statusId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§å表 |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç³»ç»ç¶æçæ§ |
| | | */ |
| | | @Override |
| | | public List<SysStatusCtrl> selectSysStatusCtrlList(SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | return sysStatusCtrlMapper.selectSysStatusCtrlList(sysStatusCtrl); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertSysStatusCtrl(SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | sysStatusCtrl.setCreateTime(DateUtils.getNowDate()); |
| | | return sysStatusCtrlMapper.insertSysStatusCtrl(sysStatusCtrl); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateSysStatusCtrl(SysStatusCtrl sysStatusCtrl) |
| | | { |
| | | sysStatusCtrl.setUpdateTime(DateUtils.getNowDate()); |
| | | return sysStatusCtrlMapper.updateSysStatusCtrl(sysStatusCtrl); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusIds éè¦å é¤çç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysStatusCtrlByStatusIds(Long[] statusIds) |
| | | { |
| | | return sysStatusCtrlMapper.deleteSysStatusCtrlByStatusIds(statusIds); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç³»ç»ç¶æçæ§ä¿¡æ¯ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysStatusCtrlByStatusId(Long statusId) |
| | | { |
| | | return sysStatusCtrlMapper.deleteSysStatusCtrlByStatusId(statusId); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import com.se.common.core.utils.DateUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.mapper.SysTaskCtrlMapper; |
| | | import com.se.system.domain.SysTaskCtrl; |
| | | import com.se.system.service.inte.ISysTaskCtrlService; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * åç³»ç»ä»»å¡æ§å¶Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | @Service |
| | | public class SysTaskCtrlServiceImpl implements ISysTaskCtrlService |
| | | { |
| | | @Resource |
| | | private SysTaskCtrlMapper sysTaskCtrlMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | @Override |
| | | public SysTaskCtrl selectSysTaskCtrlByTaskId(Long taskId) |
| | | { |
| | | return sysTaskCtrlMapper.selectSysTaskCtrlByTaskId(taskId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶å表 |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | @Override |
| | | public List<SysTaskCtrl> selectSysTaskCtrlList(SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | return sysTaskCtrlMapper.selectSysTaskCtrlList(sysTaskCtrl); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertSysTaskCtrl(SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | sysTaskCtrl.setCreateTime(DateUtils.getNowDate()); |
| | | return sysTaskCtrlMapper.insertSysTaskCtrl(sysTaskCtrl); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateSysTaskCtrl(SysTaskCtrl sysTaskCtrl) |
| | | { |
| | | sysTaskCtrl.setUpdateTime(DateUtils.getNowDate()); |
| | | return sysTaskCtrlMapper.updateSysTaskCtrl(sysTaskCtrl); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskIds éè¦å é¤çåç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysTaskCtrlByTaskIds(Long[] taskIds) |
| | | { |
| | | return sysTaskCtrlMapper.deleteSysTaskCtrlByTaskIds(taskIds); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åç³»ç»ä»»å¡æ§å¶ä¿¡æ¯ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysTaskCtrlByTaskId(Long taskId) |
| | | { |
| | | return sysTaskCtrlMapper.deleteSysTaskCtrlByTaskId(taskId); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysStatusCtrl; |
| | | |
| | | /** |
| | | * ç³»ç»ç¶æçæ§Serviceæ¥å£ |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public interface ISysStatusCtrlService |
| | | { |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç³»ç»ç¶æçæ§ |
| | | */ |
| | | public SysStatusCtrl selectSysStatusCtrlByStatusId(Long statusId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç¶æçæ§å表 |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç³»ç»ç¶æçæ§éå |
| | | */ |
| | | public List<SysStatusCtrl> selectSysStatusCtrlList(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * æ°å¢ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysStatusCtrl(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param sysStatusCtrl ç³»ç»ç¶æçæ§ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysStatusCtrl(SysStatusCtrl sysStatusCtrl); |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»ç¶æçæ§ |
| | | * |
| | | * @param statusIds éè¦å é¤çç³»ç»ç¶æçæ§ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysStatusCtrlByStatusIds(Long[] statusIds); |
| | | |
| | | /** |
| | | * å é¤ç³»ç»ç¶æçæ§ä¿¡æ¯ |
| | | * |
| | | * @param statusId ç³»ç»ç¶æçæ§ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysStatusCtrlByStatusId(Long statusId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysTaskCtrl; |
| | | |
| | | /** |
| | | * åç³»ç»ä»»å¡æ§å¶Serviceæ¥å£ |
| | | * |
| | | * @author se |
| | | * @date 2024-12-07 |
| | | */ |
| | | public interface ISysTaskCtrlService |
| | | { |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return åç³»ç»ä»»å¡æ§å¶ |
| | | */ |
| | | public SysTaskCtrl selectSysTaskCtrlByTaskId(Long taskId); |
| | | |
| | | /** |
| | | * æ¥è¯¢åç³»ç»ä»»å¡æ§å¶å表 |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return åç³»ç»ä»»å¡æ§å¶éå |
| | | */ |
| | | public List<SysTaskCtrl> selectSysTaskCtrlList(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * æ°å¢åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysTaskCtrl(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * ä¿®æ¹åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param sysTaskCtrl åç³»ç»ä»»å¡æ§å¶ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysTaskCtrl(SysTaskCtrl sysTaskCtrl); |
| | | |
| | | /** |
| | | * æ¹éå é¤åç³»ç»ä»»å¡æ§å¶ |
| | | * |
| | | * @param taskIds éè¦å é¤çåç³»ç»ä»»å¡æ§å¶ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysTaskCtrlByTaskIds(Long[] taskIds); |
| | | |
| | | /** |
| | | * å é¤åç³»ç»ä»»å¡æ§å¶ä¿¡æ¯ |
| | | * |
| | | * @param taskId åç³»ç»ä»»å¡æ§å¶ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysTaskCtrlByTaskId(Long taskId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.se.system.mapper.SysStatusCtrlMapper"> |
| | | |
| | | <resultMap type="SysStatusCtrl" id="SysStatusCtrlResult"> |
| | | <result property="statusId" column="status_id" /> |
| | | <result property="sysName" column="sys_name" /> |
| | | <result property="ip" column="ip" /> |
| | | <result property="url" column="url" /> |
| | | <result property="method" column="method" /> |
| | | <result property="orderNum" column="order_num" /> |
| | | <result property="status" column="status" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSysStatusCtrlVo"> |
| | | select status_id, sys_name, ip, url, method, order_num, status, create_by, create_time, update_by, update_time, remark from sys_status_ctrl |
| | | </sql> |
| | | |
| | | <select id="selectSysStatusCtrlList" parameterType="SysStatusCtrl" resultMap="SysStatusCtrlResult"> |
| | | <include refid="selectSysStatusCtrlVo"/> |
| | | <where> |
| | | <if test="sysName != null and sysName != ''"> and sys_name like concat('%', #{sysName}, '%')</if> |
| | | <if test="ip != null and ip != ''"> and ip = #{ip}</if> |
| | | <if test="url != null and url != ''"> and url = #{url}</if> |
| | | <if test="method != null and method != ''"> and method = #{method}</if> |
| | | <if test="orderNum != null "> and order_num = #{orderNum}</if> |
| | | <if test="status != null and status != ''"> and status = #{status}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectSysStatusCtrlByStatusId" parameterType="Long" resultMap="SysStatusCtrlResult"> |
| | | <include refid="selectSysStatusCtrlVo"/> |
| | | where status_id = #{statusId} |
| | | </select> |
| | | |
| | | <insert id="insertSysStatusCtrl" parameterType="SysStatusCtrl" useGeneratedKeys="true" keyProperty="statusId"> |
| | | insert into sys_status_ctrl |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="sysName != null">sys_name,</if> |
| | | <if test="ip != null">ip,</if> |
| | | <if test="url != null">url,</if> |
| | | <if test="method != null">method,</if> |
| | | <if test="orderNum != null">order_num,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="sysName != null">#{sysName},</if> |
| | | <if test="ip != null">#{ip},</if> |
| | | <if test="url != null">#{url},</if> |
| | | <if test="method != null">#{method},</if> |
| | | <if test="orderNum != null">#{orderNum},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateSysStatusCtrl" parameterType="SysStatusCtrl"> |
| | | update sys_status_ctrl |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="sysName != null">sys_name = #{sysName},</if> |
| | | <if test="ip != null">ip = #{ip},</if> |
| | | <if test="url != null">url = #{url},</if> |
| | | <if test="method != null">method = #{method},</if> |
| | | <if test="orderNum != null">order_num = #{orderNum},</if> |
| | | <if test="status != null">status = #{status},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | </trim> |
| | | where status_id = #{statusId} |
| | | </update> |
| | | |
| | | <delete id="deleteSysStatusCtrlByStatusId" parameterType="Long"> |
| | | delete from sys_status_ctrl where status_id = #{statusId} |
| | | </delete> |
| | | |
| | | <delete id="deleteSysStatusCtrlByStatusIds" parameterType="String"> |
| | | delete from sys_status_ctrl where status_id in |
| | | <foreach item="statusId" collection="array" open="(" separator="," close=")"> |
| | | #{statusId} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.se.system.mapper.SysTaskCtrlMapper"> |
| | | |
| | | <resultMap type="SysTaskCtrl" id="SysTaskCtrlResult"> |
| | | <result property="taskId" column="task_id" /> |
| | | <result property="prjId" column="prj_id" /> |
| | | <result property="prjName" column="prj_name" /> |
| | | <result property="thinkId" column="think_id" /> |
| | | <result property="thinkName" column="think_name" /> |
| | | <result property="isSave" column="is_save" /> |
| | | <result property="node" column="node" /> |
| | | <result property="status" column="status" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSysTaskCtrlVo"> |
| | | select task_id, prj_id, prj_name, think_id, think_name, is_save, node, status, create_by, create_time, update_by, update_time, remark from sys_task_ctrl |
| | | </sql> |
| | | |
| | | <select id="selectSysTaskCtrlList" parameterType="SysTaskCtrl" resultMap="SysTaskCtrlResult"> |
| | | <include refid="selectSysTaskCtrlVo"/> |
| | | <where> |
| | | <if test="prjId != null and prjId != ''"> and prj_id = #{prjId}</if> |
| | | <if test="prjName != null and prjName != ''"> and prj_name like concat('%', #{prjName}, '%')</if> |
| | | <if test="thinkId != null and thinkId != ''"> and think_id = #{thinkId}</if> |
| | | <if test="thinkName != null and thinkName != ''"> and think_name like concat('%', #{thinkName}, '%')</if> |
| | | <if test="isSave != null and isSave != ''"> and is_save = #{isSave}</if> |
| | | <if test="node != null and node != ''"> and node = #{node}</if> |
| | | <if test="status != null and status != ''"> and status = #{status}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectSysTaskCtrlByTaskId" parameterType="Long" resultMap="SysTaskCtrlResult"> |
| | | <include refid="selectSysTaskCtrlVo"/> |
| | | where task_id = #{taskId} |
| | | </select> |
| | | |
| | | <insert id="insertSysTaskCtrl" parameterType="SysTaskCtrl" useGeneratedKeys="true" keyProperty="taskId"> |
| | | insert into sys_task_ctrl |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="prjId != null">prj_id,</if> |
| | | <if test="prjName != null">prj_name,</if> |
| | | <if test="thinkId != null">think_id,</if> |
| | | <if test="thinkName != null">think_name,</if> |
| | | <if test="isSave != null">is_save,</if> |
| | | <if test="node != null">node,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="prjId != null">#{prjId},</if> |
| | | <if test="prjName != null">#{prjName},</if> |
| | | <if test="thinkId != null">#{thinkId},</if> |
| | | <if test="thinkName != null">#{thinkName},</if> |
| | | <if test="isSave != null">#{isSave},</if> |
| | | <if test="node != null">#{node},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateSysTaskCtrl" parameterType="SysTaskCtrl"> |
| | | update sys_task_ctrl |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="prjId != null">prj_id = #{prjId},</if> |
| | | <if test="prjName != null">prj_name = #{prjName},</if> |
| | | <if test="thinkId != null">think_id = #{thinkId},</if> |
| | | <if test="thinkName != null">think_name = #{thinkName},</if> |
| | | <if test="isSave != null">is_save = #{isSave},</if> |
| | | <if test="node != null">node = #{node},</if> |
| | | <if test="status != null">status = #{status},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | </trim> |
| | | where task_id = #{taskId} |
| | | </update> |
| | | |
| | | <delete id="deleteSysTaskCtrlByTaskId" parameterType="Long"> |
| | | delete from sys_task_ctrl where task_id = #{taskId} |
| | | </delete> |
| | | |
| | | <delete id="deleteSysTaskCtrlByTaskIds" parameterType="String"> |
| | | delete from sys_task_ctrl where task_id in |
| | | <foreach item="taskId" collection="array" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.se.common.log.annotation.Log; |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import ${packageName}.domain.${ClassName}; |
| | | import ${packageName}.service.I${ClassName}Service; |
| | | import com.se.common.core.web.controller.BaseController; |
| | | import com.se.common.core.web.domain.AjaxResult; |
| | | import com.se.common.core.utils.poi.ExcelUtil; |
| | | #if($table.crud || $table.sub) |
| | | import com.se.common.core.web.page.TableDataInfo; |
| | | #elseif($table.tree) |
| | | #end |
| | | |
| | | /** |
| | | * ${functionName}Controller |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/${businessName}") |
| | | public class ${ClassName}Controller extends BaseController |
| | | { |
| | | @Autowired |
| | | private I${ClassName}Service ${className}Service; |
| | | |
| | | /** |
| | | * æ¥è¯¢${functionName}å表 |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:list") |
| | | @GetMapping("/list") |
| | | #if($table.crud || $table.sub) |
| | | public TableDataInfo list(${ClassName} ${className}) |
| | | { |
| | | startPage(); |
| | | List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); |
| | | return getDataTable(list); |
| | | } |
| | | #elseif($table.tree) |
| | | public AjaxResult list(${ClassName} ${className}) |
| | | { |
| | | List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); |
| | | return success(list); |
| | | } |
| | | #end |
| | | |
| | | /** |
| | | * 导åº${functionName}å表 |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:export") |
| | | @Log(title = "${functionName}", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ${ClassName} ${className}) |
| | | { |
| | | List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); |
| | | ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); |
| | | util.exportExcel(response, list, "${functionName}æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·å${functionName}详ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:query") |
| | | @GetMapping(value = "/{${pkColumn.javaField}}") |
| | | public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) |
| | | { |
| | | return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢${functionName} |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:add") |
| | | @Log(title = "${functionName}", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ${ClassName} ${className}) |
| | | { |
| | | return toAjax(${className}Service.insert${ClassName}(${className})); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹${functionName} |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:edit") |
| | | @Log(title = "${functionName}", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ${ClassName} ${className}) |
| | | { |
| | | return toAjax(${className}Service.update${ClassName}(${className})); |
| | | } |
| | | |
| | | /** |
| | | * å é¤${functionName} |
| | | */ |
| | | @RequiresPermissions("${permissionPrefix}:remove") |
| | | @Log(title = "${functionName}", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{${pkColumn.javaField}s}") |
| | | public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) |
| | | { |
| | | return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.domain; |
| | | |
| | | #foreach ($import in $importList) |
| | | import ${import}; |
| | | #end |
| | | import com.se.common.core.annotation.Excel; |
| | | #if($table.crud || $table.sub) |
| | | #elseif($table.tree) |
| | | #end |
| | | |
| | | /** |
| | | * ${functionName}对象 ${tableName} |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | #if($table.crud || $table.sub) |
| | | #set($Entity="BaseEntity") |
| | | #elseif($table.tree) |
| | | #set($Entity="TreeEntity") |
| | | #end |
| | | public class ${ClassName} extends ${Entity} |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | #foreach ($column in $columns) |
| | | #if(!$table.isSuperColumn($column.javaField)) |
| | | /** $column.columnComment */ |
| | | #if($column.list) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($parentheseIndex != -1) |
| | | @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
| | | #elseif($column.javaType == 'Date') |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") |
| | | #else |
| | | @Excel(name = "${comment}") |
| | | #end |
| | | #end |
| | | private $column.javaType $column.javaField; |
| | | |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | /** $table.subTable.functionNameä¿¡æ¯ */ |
| | | private List<${subClassName}> ${subclassName}List; |
| | | |
| | | #end |
| | | #foreach ($column in $columns) |
| | | #if(!$table.isSuperColumn($column.javaField)) |
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) |
| | | #set($AttrName=$column.javaField) |
| | | #else |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #end |
| | | public void set${AttrName}($column.javaType $column.javaField) |
| | | { |
| | | this.$column.javaField = $column.javaField; |
| | | } |
| | | |
| | | public $column.javaType get${AttrName}() |
| | | { |
| | | return $column.javaField; |
| | | } |
| | | #end |
| | | #end |
| | | |
| | | #if($table.sub) |
| | | public List<${subClassName}> get${subClassName}List() |
| | | { |
| | | return ${subclassName}List; |
| | | } |
| | | |
| | | public void set${subClassName}List(List<${subClassName}> ${subclassName}List) |
| | | { |
| | | this.${subclassName}List = ${subclassName}List; |
| | | } |
| | | |
| | | #end |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | #foreach ($column in $columns) |
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) |
| | | #set($AttrName=$column.javaField) |
| | | #else |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #end |
| | | .append("${column.javaField}", get${AttrName}()) |
| | | #end |
| | | #if($table.sub) |
| | | .append("${subclassName}List", get${subClassName}List()) |
| | | #end |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.mapper; |
| | | |
| | | import java.util.List; |
| | | import ${packageName}.domain.${ClassName}; |
| | | #if($table.sub) |
| | | import ${packageName}.domain.${subClassName}; |
| | | #end |
| | | |
| | | /** |
| | | * ${functionName}Mapperæ¥å£ |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | public interface ${ClassName}Mapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ${functionName} |
| | | */ |
| | | public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); |
| | | |
| | | /** |
| | | * æ¥è¯¢${functionName}å表 |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ${functionName}éå |
| | | */ |
| | | public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * æ°å¢${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | public int insert${ClassName}(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * ä¿®æ¹${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | public int update${ClassName}(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * å é¤${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); |
| | | |
| | | /** |
| | | * æ¹éå é¤${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField}s éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); |
| | | #if($table.sub) |
| | | |
| | | /** |
| | | * æ¹éå é¤${subTable.functionName} |
| | | * |
| | | * @param ${pkColumn.javaField}s éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢${subTable.functionName} |
| | | * |
| | | * @param ${subclassName}List ${subTable.functionName}å表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batch${subClassName}(List<${subClassName}> ${subclassName}List); |
| | | |
| | | |
| | | /** |
| | | * éè¿${functionName}主é®å é¤${subTable.functionName}ä¿¡æ¯ |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ID |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); |
| | | #end |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.service; |
| | | |
| | | import java.util.List; |
| | | import ${packageName}.domain.${ClassName}; |
| | | |
| | | /** |
| | | * ${functionName}Serviceæ¥å£ |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | public interface I${ClassName}Service |
| | | { |
| | | /** |
| | | * æ¥è¯¢${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ${functionName} |
| | | */ |
| | | public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); |
| | | |
| | | /** |
| | | * æ¥è¯¢${functionName}å表 |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ${functionName}éå |
| | | */ |
| | | public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * æ°å¢${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | public int insert${ClassName}(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * ä¿®æ¹${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | public int update${ClassName}(${ClassName} ${className}); |
| | | |
| | | /** |
| | | * æ¹éå é¤${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField}s éè¦å é¤ç${functionName}主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); |
| | | |
| | | /** |
| | | * å é¤${functionName}ä¿¡æ¯ |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.service.impl; |
| | | |
| | | import java.util.List; |
| | | #foreach ($column in $columns) |
| | | #if($column.javaField == 'createTime' || $column.javaField == 'updateTime') |
| | | import com.se.common.core.utils.DateUtils; |
| | | #break |
| | | #end |
| | | #end |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | #if($table.sub) |
| | | import java.util.ArrayList; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import ${packageName}.domain.${subClassName}; |
| | | #end |
| | | import ${packageName}.mapper.${ClassName}Mapper; |
| | | import ${packageName}.domain.${ClassName}; |
| | | import ${packageName}.service.I${ClassName}Service; |
| | | |
| | | /** |
| | | * ${functionName}Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | @Service |
| | | public class ${ClassName}ServiceImpl implements I${ClassName}Service |
| | | { |
| | | @Autowired |
| | | private ${ClassName}Mapper ${className}Mapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ${functionName} |
| | | */ |
| | | @Override |
| | | public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) |
| | | { |
| | | return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢${functionName}å表 |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ${functionName} |
| | | */ |
| | | @Override |
| | | public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) |
| | | { |
| | | return ${className}Mapper.select${ClassName}List(${className}); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | #if($table.sub) |
| | | @Transactional |
| | | #end |
| | | @Override |
| | | public int insert${ClassName}(${ClassName} ${className}) |
| | | { |
| | | #foreach ($column in $columns) |
| | | #if($column.javaField == 'createTime') |
| | | ${className}.setCreateTime(DateUtils.getNowDate()); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | int rows = ${className}Mapper.insert${ClassName}(${className}); |
| | | insert${subClassName}(${className}); |
| | | return rows; |
| | | #else |
| | | return ${className}Mapper.insert${ClassName}(${className}); |
| | | #end |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹${functionName} |
| | | * |
| | | * @param ${className} ${functionName} |
| | | * @return ç»æ |
| | | */ |
| | | #if($table.sub) |
| | | @Transactional |
| | | #end |
| | | @Override |
| | | public int update${ClassName}(${ClassName} ${className}) |
| | | { |
| | | #foreach ($column in $columns) |
| | | #if($column.javaField == 'updateTime') |
| | | ${className}.setUpdateTime(DateUtils.getNowDate()); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); |
| | | insert${subClassName}(${className}); |
| | | #end |
| | | return ${className}Mapper.update${ClassName}(${className}); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤${functionName} |
| | | * |
| | | * @param ${pkColumn.javaField}s éè¦å é¤ç${functionName}ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | #if($table.sub) |
| | | @Transactional |
| | | #end |
| | | @Override |
| | | public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) |
| | | { |
| | | #if($table.sub) |
| | | ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); |
| | | #end |
| | | return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); |
| | | } |
| | | |
| | | /** |
| | | * å é¤${functionName}ä¿¡æ¯ |
| | | * |
| | | * @param ${pkColumn.javaField} ${functionName}ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | #if($table.sub) |
| | | @Transactional |
| | | #end |
| | | @Override |
| | | public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) |
| | | { |
| | | #if($table.sub) |
| | | ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); |
| | | #end |
| | | return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); |
| | | } |
| | | #if($table.sub) |
| | | |
| | | /** |
| | | * æ°å¢${subTable.functionName}ä¿¡æ¯ |
| | | * |
| | | * @param ${className} ${functionName}对象 |
| | | */ |
| | | public void insert${subClassName}(${ClassName} ${className}) |
| | | { |
| | | List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); |
| | | ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); |
| | | if (StringUtils.isNotNull(${subclassName}List)) |
| | | { |
| | | List<${subClassName}> list = new ArrayList<${subClassName}>(); |
| | | for (${subClassName} ${subclassName} : ${subclassName}List) |
| | | { |
| | | ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); |
| | | list.add(${subclassName}); |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | ${className}Mapper.batch${subClassName}(list); |
| | | } |
| | | } |
| | | } |
| | | #end |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.domain; |
| | | |
| | | #foreach ($import in $subImportList) |
| | | import ${import}; |
| | | #end |
| | | import com.se.common.core.annotation.Excel; |
| | | |
| | | /** |
| | | * ${subTable.functionName}对象 ${subTableName} |
| | | * |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | public class ${subClassName} extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | #foreach ($column in $subTable.columns) |
| | | #if(!$table.isSuperColumn($column.javaField)) |
| | | /** $column.columnComment */ |
| | | #if($column.list) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($parentheseIndex != -1) |
| | | @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
| | | #elseif($column.javaType == 'Date') |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") |
| | | #else |
| | | @Excel(name = "${comment}") |
| | | #end |
| | | #end |
| | | private $column.javaType $column.javaField; |
| | | |
| | | #end |
| | | #end |
| | | #foreach ($column in $subTable.columns) |
| | | #if(!$table.isSuperColumn($column.javaField)) |
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) |
| | | #set($AttrName=$column.javaField) |
| | | #else |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #end |
| | | public void set${AttrName}($column.javaType $column.javaField) |
| | | { |
| | | this.$column.javaField = $column.javaField; |
| | | } |
| | | |
| | | public $column.javaType get${AttrName}() |
| | | { |
| | | return $column.javaField; |
| | | } |
| | | #end |
| | | #end |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | #foreach ($column in $subTable.columns) |
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) |
| | | #set($AttrName=$column.javaField) |
| | | #else |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #end |
| | | .append("${column.javaField}", get${AttrName}()) |
| | | #end |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢${functionName}å表 |
| | | export function list${BusinessName}(query) { |
| | | return request({ |
| | | url: '/${moduleName}/${businessName}/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢${functionName}è¯¦ç» |
| | | export function get${BusinessName}(${pkColumn.javaField}) { |
| | | return request({ |
| | | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢${functionName} |
| | | export function add${BusinessName}(data) { |
| | | return request({ |
| | | url: '/${moduleName}/${businessName}', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹${functionName} |
| | | export function update${BusinessName}(data) { |
| | | return request({ |
| | | url: '/${moduleName}/${businessName}', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤${functionName} |
| | | export function del${BusinessName}(${pkColumn.javaField}) { |
| | | return request({ |
| | | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, |
| | | method: 'delete' |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- èå SQL |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}èå'); |
| | | |
| | | -- æé®ç¶èåID |
| | | SELECT @parentId := LAST_INSERT_ID(); |
| | | |
| | | -- æé® SQL |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}æ¥è¯¢', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); |
| | | |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}æ°å¢', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); |
| | | |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}ä¿®æ¹', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); |
| | | |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}å é¤', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); |
| | | |
| | | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| | | values('${functionName}导åº', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | #foreach($column in $columns) |
| | | #if($column.query) |
| | | #set($dictType=$column.dictType) |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-input |
| | | v-model="queryParams.${column.javaField}" |
| | | placeholder="请è¾å
¥${comment}" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-date-picker clearable |
| | | v-model="queryParams.${column.javaField}" |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | <el-form-item label="${comment}"> |
| | | <el-date-picker |
| | | v-model="daterange${AttrName}" |
| | | style="width: 240px" |
| | | value-format="yyyy-MM-dd" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['${moduleName}:${businessName}:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="info" |
| | | plain |
| | | icon="el-icon-sort" |
| | | size="mini" |
| | | @click="toggleExpandAll" |
| | | >å±å¼/æå </el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table |
| | | v-if="refreshTable" |
| | | v-loading="loading" |
| | | :data="${businessName}List" |
| | | row-key="${treeCode}" |
| | | :default-expand-all="isExpandAll" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | > |
| | | #foreach($column in $columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk) |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "imageUpload") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> |
| | | <template slot-scope="scope"> |
| | | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $column.dictType) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| | | <template slot-scope="scope"> |
| | | #if($column.htmlType == "checkbox") |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| | | #else |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> |
| | | #end |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $javaField) |
| | | #if(${foreach.index} == 1) |
| | | <el-table-column label="${comment}" prop="${javaField}" /> |
| | | #else |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['${moduleName}:${businessName}:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-plus" |
| | | @click="handleAdd(scope.row)" |
| | | v-hasPermi="['${moduleName}:${businessName}:add']" |
| | | >æ°å¢</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['${moduleName}:${businessName}:remove']" |
| | | >å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- æ·»å æä¿®æ¹${functionName}å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | #foreach($column in $columns) |
| | | #set($field=$column.javaField) |
| | | #if($column.insert && !$column.pk) |
| | | #if(($column.usableColumn) || (!$column.superColumn)) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #set($dictType=$column.dictType) |
| | | #if("" != $treeParentCode && $column.javaField == $treeParentCode) |
| | | <el-form-item label="${comment}" prop="${treeParentCode}"> |
| | | <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="è¯·éæ©${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" placeholder="请è¾å
¥${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | | <editor v-model="form.${field}" :min-height="192"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :value="parseInt(dict.value)" |
| | | #else |
| | | :value="dict.value" |
| | | #end |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox>è¯·éæ©åå
¸çæ</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :label="parseInt(dict.value)" |
| | | #else |
| | | :label="dict.value" |
| | | #end |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio label="1">è¯·éæ©åå
¸çæ</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-date-picker clearable |
| | | v-model="form.${field}" |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | #end |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
| | | import Treeselect from "@riophae/vue-treeselect"; |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| | | |
| | | export default { |
| | | name: "${BusinessName}", |
| | | #if(${dicts} != '') |
| | | dicts: [${dicts}], |
| | | #end |
| | | components: { |
| | | Treeselect |
| | | }, |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // ${functionName}è¡¨æ ¼æ°æ® |
| | | ${businessName}List: [], |
| | | // ${functionName}æ é项 |
| | | ${businessName}Options: [], |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¯å¦å±å¼ï¼é»è®¤å
¨é¨å±å¼ |
| | | isExpandAll: true, |
| | | // éæ°æ¸²æè¡¨æ ¼ç¶æ |
| | | refreshTable: true, |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | // $commentæ¶é´èå´ |
| | | daterange${AttrName}: [], |
| | | #end |
| | | #end |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | #foreach ($column in $columns) |
| | | #if($column.query) |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | #foreach ($column in $columns) |
| | | #if($column.required) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | $column.javaField: [ |
| | | { required: true, message: "$commentä¸è½ä¸ºç©º", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
| | | ]#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢${functionName}å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | this.queryParams.params = {}; |
| | | #break |
| | | #end |
| | | #end |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { |
| | | this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; |
| | | this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; |
| | | } |
| | | #end |
| | | #end |
| | | list${BusinessName}(this.queryParams).then(response => { |
| | | this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | /** 转æ¢${functionName}æ°æ®ç»æ */ |
| | | normalizer(node) { |
| | | if (node.children && !node.children.length) { |
| | | delete node.children; |
| | | } |
| | | return { |
| | | id: node.${treeCode}, |
| | | label: node.${treeName}, |
| | | children: node.children |
| | | }; |
| | | }, |
| | | /** æ¥è¯¢${functionName}䏿æ ç»æ */ |
| | | getTreeselect() { |
| | | list${BusinessName}().then(response => { |
| | | this.${businessName}Options = []; |
| | | const data = { ${treeCode}: 0, ${treeName}: '顶级èç¹', children: [] }; |
| | | data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); |
| | | this.${businessName}Options.push(data); |
| | | }); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | #else |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | this.daterange${AttrName} = []; |
| | | #end |
| | | #end |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd(row) { |
| | | this.reset(); |
| | | this.getTreeselect(); |
| | | if (row != null && row.${treeCode}) { |
| | | this.form.${treeParentCode} = row.${treeCode}; |
| | | } else { |
| | | this.form.${treeParentCode} = 0; |
| | | } |
| | | this.open = true; |
| | | this.title = "æ·»å ${functionName}"; |
| | | }, |
| | | /** å±å¼/æå æä½ */ |
| | | toggleExpandAll() { |
| | | this.refreshTable = false; |
| | | this.isExpandAll = !this.isExpandAll; |
| | | this.$nextTick(() => { |
| | | this.refreshTable = true; |
| | | }); |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | this.getTreeselect(); |
| | | if (row != null) { |
| | | this.form.${treeParentCode} = row.${treeCode}; |
| | | } |
| | | get${BusinessName}(row.${pkColumn.javaField}).then(response => { |
| | | this.form = response.data; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | this.form.$column.javaField = this.form.${column.javaField}.split(","); |
| | | #end |
| | | #end |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹${functionName}"; |
| | | }); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm() { |
| | | this.#[[$]]#refs["form"].validate(valid => { |
| | | if (valid) { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | this.form.$column.javaField = this.form.${column.javaField}.join(","); |
| | | #end |
| | | #end |
| | | if (this.form.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(this.form).then(response => { |
| | | this.#[[$modal]]#.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | add${BusinessName}(this.form).then(response => { |
| | | this.#[[$modal]]#.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | this.#[[$modal]]#.confirm('æ¯å¦ç¡®è®¤å é¤${functionName}ç¼å·ä¸º"' + row.${pkColumn.javaField} + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return del${BusinessName}(row.${pkColumn.javaField}); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.#[[$modal]]#.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | #foreach($column in $columns) |
| | | #if($column.query) |
| | | #set($dictType=$column.dictType) |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-input |
| | | v-model="queryParams.${column.javaField}" |
| | | placeholder="请è¾å
¥${comment}" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-date-picker clearable |
| | | v-model="queryParams.${column.javaField}" |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="è¯·éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | <el-form-item label="${comment}"> |
| | | <el-date-picker |
| | | v-model="daterange${AttrName}" |
| | | style="width: 240px" |
| | | value-format="yyyy-MM-dd" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['${moduleName}:${businessName}:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['${moduleName}:${businessName}:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['${moduleName}:${businessName}:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['${moduleName}:${businessName}:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | #foreach($column in $columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "imageUpload") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> |
| | | <template slot-scope="scope"> |
| | | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $column.dictType) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| | | <template slot-scope="scope"> |
| | | #if($column.htmlType == "checkbox") |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| | | #else |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> |
| | | #end |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $javaField) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #end |
| | | #end |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['${moduleName}:${businessName}:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['${moduleName}:${businessName}:remove']" |
| | | >å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹${functionName}å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | #foreach($column in $columns) |
| | | #set($field=$column.javaField) |
| | | #if($column.insert && !$column.pk) |
| | | #if(($column.usableColumn) || (!$column.superColumn)) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #set($dictType=$column.dictType) |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" placeholder="请è¾å
¥${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | | <editor v-model="form.${field}" :min-height="192"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :value="parseInt(dict.value)" |
| | | #else |
| | | :value="dict.value" |
| | | #end |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox>è¯·éæ©åå
¸çæ</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :label="parseInt(dict.value)" |
| | | #else |
| | | :label="dict.value" |
| | | #end |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio label="1">è¯·éæ©åå
¸çæ</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-date-picker clearable |
| | | v-model="form.${field}" |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="è¯·éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | <el-divider content-position="center">${subTable.functionName}ä¿¡æ¯</el-divider> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">æ·»å </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">å é¤</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="åºå·" align="center" prop="index" width="50"/> |
| | | #foreach($column in $subTable.columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk || $javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && $column.htmlType == "input") |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.$javaField" placeholder="请è¾å
¥$comment" /> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="$comment" prop="${javaField}" width="240"> |
| | | <template slot-scope="scope"> |
| | | <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="è¯·éæ©$comment" /> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.$javaField" placeholder="è¯·éæ©$comment"> |
| | | <el-option |
| | | v-for="dict in dict.type.$column.dictType" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.$javaField" placeholder="è¯·éæ©$comment"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | #end |
| | | #end |
| | | </el-table> |
| | | #end |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
| | | |
| | | export default { |
| | | name: "${BusinessName}", |
| | | #if(${dicts} != '') |
| | | dicts: [${dicts}], |
| | | #end |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | #if($table.sub) |
| | | // å表é䏿°æ® |
| | | checked${subClassName}: [], |
| | | #end |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // ${functionName}è¡¨æ ¼æ°æ® |
| | | ${businessName}List: [], |
| | | #if($table.sub) |
| | | // ${subTable.functionName}è¡¨æ ¼æ°æ® |
| | | ${subclassName}List: [], |
| | | #end |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | // $commentæ¶é´èå´ |
| | | daterange${AttrName}: [], |
| | | #end |
| | | #end |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | #foreach ($column in $columns) |
| | | #if($column.query) |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | #foreach ($column in $columns) |
| | | #if($column.required) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | $column.javaField: [ |
| | | { required: true, message: "$commentä¸è½ä¸ºç©º", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
| | | ]#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢${functionName}å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | this.queryParams.params = {}; |
| | | #break |
| | | #end |
| | | #end |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { |
| | | this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; |
| | | this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; |
| | | } |
| | | #end |
| | | #end |
| | | list${BusinessName}(this.queryParams).then(response => { |
| | | this.${businessName}List = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | #else |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }; |
| | | #if($table.sub) |
| | | this.${subclassName}List = []; |
| | | #end |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | this.daterange${AttrName} = []; |
| | | #end |
| | | #end |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.${pkColumn.javaField}) |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "æ·»å ${functionName}"; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids |
| | | get${BusinessName}(${pkColumn.javaField}).then(response => { |
| | | this.form = response.data; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | this.form.$column.javaField = this.form.${column.javaField}.split(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | this.${subclassName}List = response.data.${subclassName}List; |
| | | #end |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹${functionName}"; |
| | | }); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm() { |
| | | this.#[[$]]#refs["form"].validate(valid => { |
| | | if (valid) { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | this.form.$column.javaField = this.form.${column.javaField}.join(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | this.form.${subclassName}List = this.${subclassName}List; |
| | | #end |
| | | if (this.form.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(this.form).then(response => { |
| | | this.#[[$modal]]#.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | add${BusinessName}(this.form).then(response => { |
| | | this.#[[$modal]]#.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; |
| | | this.#[[$modal]]#.confirm('æ¯å¦ç¡®è®¤å é¤${functionName}ç¼å·ä¸º"' + ${pkColumn.javaField}s + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return del${BusinessName}(${pkColumn.javaField}s); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.#[[$modal]]#.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | }, |
| | | #if($table.sub) |
| | | /** ${subTable.functionName}åºå· */ |
| | | row${subClassName}Index({ row, rowIndex }) { |
| | | row.index = rowIndex + 1; |
| | | }, |
| | | /** ${subTable.functionName}æ·»å æé®æä½ */ |
| | | handleAdd${subClassName}() { |
| | | let obj = {}; |
| | | #foreach($column in $subTable.columns) |
| | | #if($column.pk || $column.javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && "" != $javaField) |
| | | obj.$column.javaField = ""; |
| | | #end |
| | | #end |
| | | this.${subclassName}List.push(obj); |
| | | }, |
| | | /** ${subTable.functionName}å é¤æé®æä½ */ |
| | | handleDelete${subClassName}() { |
| | | if (this.checked${subClassName}.length == 0) { |
| | | this.#[[$modal]]#.msgError("请å
éæ©è¦å é¤ç${subTable.functionName}æ°æ®"); |
| | | } else { |
| | | const ${subclassName}List = this.${subclassName}List; |
| | | const checked${subClassName} = this.checked${subClassName}; |
| | | this.${subclassName}List = ${subclassName}List.filter(function(item) { |
| | | return checked${subClassName}.indexOf(item.index) == -1 |
| | | }); |
| | | } |
| | | }, |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | handle${subClassName}SelectionChange(selection) { |
| | | this.checked${subClassName} = selection.map(item => item.index) |
| | | }, |
| | | #end |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('${moduleName}/${businessName}/export', { |
| | | ...this.queryParams |
| | | }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> |
| | | #foreach($column in $columns) |
| | | #if($column.query) |
| | | #set($dictType=$column.dictType) |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-input |
| | | v-model="queryParams.${column.javaField}" |
| | | placeholder="请è¾å
¥${comment}" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-date-picker clearable |
| | | v-model="queryParams.${column.javaField}" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | <el-form-item label="${comment}" style="width: 308px"> |
| | | <el-date-picker |
| | | v-model="daterange${AttrName}" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="Plus" |
| | | @click="handleAdd" |
| | | v-hasPermi="['${moduleName}:${businessName}:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="info" |
| | | plain |
| | | icon="Sort" |
| | | @click="toggleExpandAll" |
| | | >å±å¼/æå </el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table |
| | | v-if="refreshTable" |
| | | v-loading="loading" |
| | | :data="${businessName}List" |
| | | row-key="${treeCode}" |
| | | :default-expand-all="isExpandAll" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | > |
| | | #foreach($column in $columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk) |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> |
| | | <template #default="scope"> |
| | | <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "imageUpload") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> |
| | | <template #default="scope"> |
| | | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $column.dictType) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| | | <template #default="scope"> |
| | | #if($column.htmlType == "checkbox") |
| | | <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| | | #else |
| | | <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/> |
| | | #end |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $javaField) |
| | | #if(${foreach.index} == 1) |
| | | <el-table-column label="${comment}" prop="${javaField}" /> |
| | | #else |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">ä¿®æ¹</el-button> |
| | | <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">æ°å¢</el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- æ·»å æä¿®æ¹${functionName}å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| | | <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px"> |
| | | #foreach($column in $columns) |
| | | #set($field=$column.javaField) |
| | | #if($column.insert && !$column.pk) |
| | | #if(($column.usableColumn) || (!$column.superColumn)) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #set($dictType=$column.dictType) |
| | | #if("" != $treeParentCode && $column.javaField == $treeParentCode) |
| | | <el-form-item label="${comment}" prop="${treeParentCode}"> |
| | | <el-tree-select |
| | | v-model="form.${treeParentCode}" |
| | | :data="${businessName}Options" |
| | | :props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }" |
| | | value-key="${treeCode}" |
| | | placeholder="è¯·éæ©${comment}" |
| | | check-strictly |
| | | /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" placeholder="请è¾å
¥${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | | <editor v-model="form.${field}" :min-height="192"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :value="parseInt(dict.value)" |
| | | #else |
| | | :value="dict.value" |
| | | #end |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox>è¯·éæ©åå
¸çæ</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :label="parseInt(dict.value)" |
| | | #else |
| | | :label="dict.value" |
| | | #end |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio label="1">è¯·éæ©åå
¸çæ</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-date-picker clearable |
| | | v-model="form.${field}" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | #end |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="${BusinessName}"> |
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | #if(${dicts} != '') |
| | | #set($dictsNoSymbol=$dicts.replace("'", "")) |
| | | const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); |
| | | #end |
| | | |
| | | const ${businessName}List = ref([]); |
| | | const ${businessName}Options = ref([]); |
| | | const open = ref(false); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const title = ref(""); |
| | | const isExpandAll = ref(true); |
| | | const refreshTable = ref(true); |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | const daterange${AttrName} = ref([]); |
| | | #end |
| | | #end |
| | | |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | #foreach ($column in $columns) |
| | | #if($column.query) |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }, |
| | | rules: { |
| | | #foreach ($column in $columns) |
| | | #if($column.required) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | $column.javaField: [ |
| | | { required: true, message: "$commentä¸è½ä¸ºç©º", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
| | | ]#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢${functionName}å表 */ |
| | | function getList() { |
| | | loading.value = true; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | queryParams.value.params = {}; |
| | | #break |
| | | #end |
| | | #end |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | if (null != daterange${AttrName} && '' != daterange${AttrName}) { |
| | | queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; |
| | | queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; |
| | | } |
| | | #end |
| | | #end |
| | | list${BusinessName}(queryParams.value).then(response => { |
| | | ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); |
| | | loading.value = false; |
| | | }); |
| | | } |
| | | |
| | | /** æ¥è¯¢${functionName}䏿æ ç»æ */ |
| | | function getTreeselect() { |
| | | list${BusinessName}().then(response => { |
| | | ${businessName}Options.value = []; |
| | | const data = { ${treeCode}: 0, ${treeName}: '顶级èç¹', children: [] }; |
| | | data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); |
| | | ${businessName}Options.value.push(data); |
| | | }); |
| | | } |
| | | |
| | | // åæ¶æé® |
| | | function cancel() { |
| | | open.value = false; |
| | | reset(); |
| | | } |
| | | |
| | | // 表åéç½® |
| | | function reset() { |
| | | form.value = { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | #else |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }; |
| | | proxy.resetForm("${businessName}Ref"); |
| | | } |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | function handleQuery() { |
| | | getList(); |
| | | } |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | function resetQuery() { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | daterange${AttrName}.value = []; |
| | | #end |
| | | #end |
| | | proxy.resetForm("queryRef"); |
| | | handleQuery(); |
| | | } |
| | | |
| | | /** æ°å¢æé®æä½ */ |
| | | function handleAdd(row) { |
| | | reset(); |
| | | getTreeselect(); |
| | | if (row != null && row.${treeCode}) { |
| | | form.value.${treeParentCode} = row.${treeCode}; |
| | | } else { |
| | | form.value.${treeParentCode} = 0; |
| | | } |
| | | open.value = true; |
| | | title.value = "æ·»å ${functionName}"; |
| | | } |
| | | |
| | | /** å±å¼/æå æä½ */ |
| | | function toggleExpandAll() { |
| | | refreshTable.value = false; |
| | | isExpandAll.value = !isExpandAll.value; |
| | | nextTick(() => { |
| | | refreshTable.value = true; |
| | | }); |
| | | } |
| | | |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | async function handleUpdate(row) { |
| | | reset(); |
| | | await getTreeselect(); |
| | | if (row != null) { |
| | | form.value.${treeParentCode} = row.${treeCode}; |
| | | } |
| | | get${BusinessName}(row.${pkColumn.javaField}).then(response => { |
| | | form.value = response.data; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | form.value.$column.javaField = form.value.${column.javaField}.split(","); |
| | | #end |
| | | #end |
| | | open.value = true; |
| | | title.value = "ä¿®æ¹${functionName}"; |
| | | }); |
| | | } |
| | | |
| | | /** æäº¤æé® */ |
| | | function submitForm() { |
| | | proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { |
| | | if (valid) { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | form.value.$column.javaField = form.value.${column.javaField}.join(","); |
| | | #end |
| | | #end |
| | | if (form.value.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(form.value).then(response => { |
| | | proxy.#[[$modal]]#.msgSuccess("ä¿®æ¹æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } else { |
| | | add${BusinessName}(form.value).then(response => { |
| | | proxy.#[[$modal]]#.msgSuccess("æ°å¢æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** å é¤æé®æä½ */ |
| | | function handleDelete(row) { |
| | | proxy.#[[$modal]]#.confirm('æ¯å¦ç¡®è®¤å é¤${functionName}ç¼å·ä¸º"' + row.${pkColumn.javaField} + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return del${BusinessName}(row.${pkColumn.javaField}); |
| | | }).then(() => { |
| | | getList(); |
| | | proxy.#[[$modal]]#.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | } |
| | | |
| | | getList(); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> |
| | | #foreach($column in $columns) |
| | | #if($column.query) |
| | | #set($dictType=$column.dictType) |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-input |
| | | v-model="queryParams.${column.javaField}" |
| | | placeholder="请è¾å
¥${comment}" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="è¯·éæ©${comment}" clearable> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-date-picker clearable |
| | | v-model="queryParams.${column.javaField}" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | <el-form-item label="${comment}" style="width: 308px"> |
| | | <el-date-picker |
| | | v-model="daterange${AttrName}" |
| | | value-format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="Plus" |
| | | @click="handleAdd" |
| | | v-hasPermi="['${moduleName}:${businessName}:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="Edit" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['${moduleName}:${businessName}:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="Delete" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['${moduleName}:${businessName}:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Download" |
| | | @click="handleExport" |
| | | v-hasPermi="['${moduleName}:${businessName}:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | #foreach($column in $columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> |
| | | <template #default="scope"> |
| | | <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "imageUpload") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> |
| | | <template #default="scope"> |
| | | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $column.dictType) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| | | <template #default="scope"> |
| | | #if($column.htmlType == "checkbox") |
| | | <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| | | #else |
| | | <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/> |
| | | #end |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $javaField) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #end |
| | | #end |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">ä¿®æ¹</el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹${functionName}å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| | | <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px"> |
| | | #foreach($column in $columns) |
| | | #set($field=$column.javaField) |
| | | #if($column.insert && !$column.pk) |
| | | #if(($column.usableColumn) || (!$column.superColumn)) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #set($dictType=$column.dictType) |
| | | #if($column.htmlType == "input") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" placeholder="请è¾å
¥${comment}" /> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | | <editor v-model="form.${field}" :min-height="192"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :value="parseInt(dict.value)" |
| | | #else |
| | | :value="dict.value" |
| | | #end |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "select" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="è¯·éæ©${comment}"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "checkbox" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox>è¯·éæ©åå
¸çæ</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && "" != $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in ${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long") |
| | | :label="parseInt(dict.value)" |
| | | #else |
| | | :label="dict.value" |
| | | #end |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio label="1">è¯·éæ©åå
¸çæ</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "datetime") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-date-picker clearable |
| | | v-model="form.${field}" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©${comment}"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-input v-model="form.${field}" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | #end |
| | | #end |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | <el-divider content-position="center">${subTable.functionName}ä¿¡æ¯</el-divider> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="Plus" @click="handleAdd${subClassName}">æ·»å </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">å é¤</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="åºå·" align="center" prop="index" width="50"/> |
| | | #foreach($column in $subTable.columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk || $javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && $column.htmlType == "input") |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.$javaField" placeholder="请è¾å
¥$comment" /> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "datetime") |
| | | <el-table-column label="$comment" prop="${javaField}" width="240"> |
| | | <template #default="scope"> |
| | | <el-date-picker clearable |
| | | v-model="scope.row.$javaField" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©$comment"> |
| | | </el-date-picker> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.$javaField" placeholder="è¯·éæ©$comment"> |
| | | <el-option |
| | | v-for="dict in $column.dictType" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) |
| | | <el-table-column label="$comment" prop="${javaField}" width="150"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.$javaField" placeholder="è¯·éæ©$comment"> |
| | | <el-option label="è¯·éæ©åå
¸çæ" value="" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | #end |
| | | #end |
| | | </el-table> |
| | | #end |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="${BusinessName}"> |
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | #if(${dicts} != '') |
| | | #set($dictsNoSymbol=$dicts.replace("'", "")) |
| | | const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); |
| | | #end |
| | | |
| | | const ${businessName}List = ref([]); |
| | | #if($table.sub) |
| | | const ${subclassName}List = ref([]); |
| | | #end |
| | | const open = ref(false); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | #if($table.sub) |
| | | const checked${subClassName} = ref([]); |
| | | #end |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const title = ref(""); |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | const daterange${AttrName} = ref([]); |
| | | #end |
| | | #end |
| | | |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | #foreach ($column in $columns) |
| | | #if($column.query) |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }, |
| | | rules: { |
| | | #foreach ($column in $columns) |
| | | #if($column.required) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | $column.javaField: [ |
| | | { required: true, message: "$commentä¸è½ä¸ºç©º", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
| | | ]#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢${functionName}å表 */ |
| | | function getList() { |
| | | loading.value = true; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | queryParams.value.params = {}; |
| | | #break |
| | | #end |
| | | #end |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | if (null != daterange${AttrName} && '' != daterange${AttrName}) { |
| | | queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; |
| | | queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; |
| | | } |
| | | #end |
| | | #end |
| | | list${BusinessName}(queryParams.value).then(response => { |
| | | ${businessName}List.value = response.rows; |
| | | total.value = response.total; |
| | | loading.value = false; |
| | | }); |
| | | } |
| | | |
| | | // åæ¶æé® |
| | | function cancel() { |
| | | open.value = false; |
| | | reset(); |
| | | } |
| | | |
| | | // 表åéç½® |
| | | function reset() { |
| | | form.value = { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | #else |
| | | $column.javaField: null#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }; |
| | | #if($table.sub) |
| | | ${subclassName}List.value = []; |
| | | #end |
| | | proxy.resetForm("${businessName}Ref"); |
| | | } |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | function resetQuery() { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | daterange${AttrName}.value = []; |
| | | #end |
| | | #end |
| | | proxy.resetForm("queryRef"); |
| | | handleQuery(); |
| | | } |
| | | |
| | | // å¤éæ¡é䏿°æ® |
| | | function handleSelectionChange(selection) { |
| | | ids.value = selection.map(item => item.${pkColumn.javaField}); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | |
| | | /** æ°å¢æé®æä½ */ |
| | | function handleAdd() { |
| | | reset(); |
| | | open.value = true; |
| | | title.value = "æ·»å ${functionName}"; |
| | | } |
| | | |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | function handleUpdate(row) { |
| | | reset(); |
| | | const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value |
| | | get${BusinessName}(_${pkColumn.javaField}).then(response => { |
| | | form.value = response.data; |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | form.value.$column.javaField = form.value.${column.javaField}.split(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | ${subclassName}List.value = response.data.${subclassName}List; |
| | | #end |
| | | open.value = true; |
| | | title.value = "ä¿®æ¹${functionName}"; |
| | | }); |
| | | } |
| | | |
| | | /** æäº¤æé® */ |
| | | function submitForm() { |
| | | proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { |
| | | if (valid) { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "checkbox") |
| | | form.value.$column.javaField = form.value.${column.javaField}.join(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | form.value.${subclassName}List = ${subclassName}List.value; |
| | | #end |
| | | if (form.value.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(form.value).then(response => { |
| | | proxy.#[[$modal]]#.msgSuccess("ä¿®æ¹æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } else { |
| | | add${BusinessName}(form.value).then(response => { |
| | | proxy.#[[$modal]]#.msgSuccess("æ°å¢æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** å é¤æé®æä½ */ |
| | | function handleDelete(row) { |
| | | const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; |
| | | proxy.#[[$modal]]#.confirm('æ¯å¦ç¡®è®¤å é¤${functionName}ç¼å·ä¸º"' + _${pkColumn.javaField}s + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return del${BusinessName}(_${pkColumn.javaField}s); |
| | | }).then(() => { |
| | | getList(); |
| | | proxy.#[[$modal]]#.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | } |
| | | |
| | | #if($table.sub) |
| | | /** ${subTable.functionName}åºå· */ |
| | | function row${subClassName}Index({ row, rowIndex }) { |
| | | row.index = rowIndex + 1; |
| | | } |
| | | |
| | | /** ${subTable.functionName}æ·»å æé®æä½ */ |
| | | function handleAdd${subClassName}() { |
| | | let obj = {}; |
| | | #foreach($column in $subTable.columns) |
| | | #if($column.pk || $column.javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && "" != $javaField) |
| | | obj.$column.javaField = ""; |
| | | #end |
| | | #end |
| | | ${subclassName}List.value.push(obj); |
| | | } |
| | | |
| | | /** ${subTable.functionName}å é¤æé®æä½ */ |
| | | function handleDelete${subClassName}() { |
| | | if (checked${subClassName}.value.length == 0) { |
| | | proxy.#[[$modal]]#.msgError("请å
éæ©è¦å é¤ç${subTable.functionName}æ°æ®"); |
| | | } else { |
| | | const ${subclassName}s = ${subclassName}List.value; |
| | | const checked${subClassName}s = checked${subClassName}.value; |
| | | ${subclassName}List.value = ${subclassName}s.filter(function(item) { |
| | | return checked${subClassName}s.indexOf(item.index) == -1 |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | function handle${subClassName}SelectionChange(selection) { |
| | | checked${subClassName}.value = selection.map(item => item.index) |
| | | } |
| | | |
| | | #end |
| | | /** å¯¼åºæé®æä½ */ |
| | | function handleExport() { |
| | | proxy.download('${moduleName}/${businessName}/export', { |
| | | ...queryParams.value |
| | | }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) |
| | | } |
| | | |
| | | getList(); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="${packageName}.mapper.${ClassName}Mapper"> |
| | | |
| | | <resultMap type="${ClassName}" id="${ClassName}Result"> |
| | | #foreach ($column in $columns) |
| | | <result property="${column.javaField}" column="${column.columnName}" /> |
| | | #end |
| | | </resultMap> |
| | | #if($table.sub) |
| | | |
| | | <resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result"> |
| | | <collection property="${subclassName}List" ofType="${subClassName}" column="${pkColumn.columnName}" select="select${subClassName}List" /> |
| | | </resultMap> |
| | | |
| | | <resultMap type="${subClassName}" id="${subClassName}Result"> |
| | | #foreach ($column in $subTable.columns) |
| | | <result property="${column.javaField}" column="${column.columnName}" /> |
| | | #end |
| | | </resultMap> |
| | | #end |
| | | |
| | | <sql id="select${ClassName}Vo"> |
| | | select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} |
| | | </sql> |
| | | |
| | | <select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result"> |
| | | <include refid="select${ClassName}Vo"/> |
| | | <where> |
| | | #foreach($column in $columns) |
| | | #set($queryType=$column.queryType) |
| | | #set($javaField=$column.javaField) |
| | | #set($javaType=$column.javaType) |
| | | #set($columnName=$column.columnName) |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #if($column.query) |
| | | #if($column.queryType == "EQ") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> |
| | | #elseif($queryType == "NE") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> |
| | | #elseif($queryType == "GT") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> |
| | | #elseif($queryType == "GTE") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> |
| | | #elseif($queryType == "LT") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> |
| | | #elseif($queryType == "LTE") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> |
| | | #elseif($queryType == "LIKE") |
| | | <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> |
| | | #elseif($queryType == "BETWEEN") |
| | | <if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> |
| | | #end |
| | | #end |
| | | #end |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end"> |
| | | #if($table.crud || $table.tree) |
| | | <include refid="select${ClassName}Vo"/> |
| | | where ${pkColumn.columnName} = #{${pkColumn.javaField}} |
| | | #elseif($table.sub) |
| | | select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end |
| | | from ${tableName} |
| | | where ${pkColumn.columnName} = #{${pkColumn.javaField}} |
| | | #end |
| | | </select> |
| | | #if($table.sub) |
| | | |
| | | <select id="select${subClassName}List" resultMap="${subClassName}Result"> |
| | | select#foreach ($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end |
| | | from ${subTableName} |
| | | where ${subTableFkName} = #{${subTableFkName}} |
| | | </select> |
| | | #end |
| | | |
| | | <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> |
| | | insert into ${tableName} |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | #foreach($column in $columns) |
| | | #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) |
| | | <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if> |
| | | #end |
| | | #end |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | #foreach($column in $columns) |
| | | #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) |
| | | <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if> |
| | | #end |
| | | #end |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="update${ClassName}" parameterType="${ClassName}"> |
| | | update ${tableName} |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | #foreach($column in $columns) |
| | | #if($column.columnName != $pkColumn.columnName) |
| | | <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> |
| | | #end |
| | | #end |
| | | </trim> |
| | | where ${pkColumn.columnName} = #{${pkColumn.javaField}} |
| | | </update> |
| | | |
| | | <delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}"> |
| | | delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} |
| | | </delete> |
| | | |
| | | <delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String"> |
| | | delete from ${tableName} where ${pkColumn.columnName} in |
| | | <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> |
| | | #{${pkColumn.javaField}} |
| | | </foreach> |
| | | </delete> |
| | | #if($table.sub) |
| | | |
| | | <delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String"> |
| | | delete from ${subTableName} where ${subTableFkName} in |
| | | <foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")"> |
| | | #{${subTableFkclassName}} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}"> |
| | | delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} |
| | | </delete> |
| | | |
| | | <insert id="batch${subClassName}"> |
| | | insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) |
| | | </foreach> |
| | | </insert> |
| | | #end |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢è½¯ä»¶å表 |
| | | export function listSoft(query) { |
| | | return request({ |
| | | url: '/system/soft/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢è½¯ä»¶è¯¦ç» |
| | | export function getSoft(softId) { |
| | | return request({ |
| | | url: '/system/soft/' + softId, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢è½¯ä»¶ |
| | | export function addSoft(data) { |
| | | return request({ |
| | | url: '/system/soft', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹è½¯ä»¶ |
| | | export function updateSoft(data) { |
| | | return request({ |
| | | url: '/system/soft', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤è½¯ä»¶ |
| | | export function delSoft(softId) { |
| | | return request({ |
| | | url: '/system/soft/' + softId, |
| | | method: 'delete' |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input |
| | | v-model="queryParams.name" |
| | | placeholder="请è¾å
¥åç§°" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['system:soft:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:soft:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:soft:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:soft:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="softList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="软件ID" align="center" prop="softId" /> |
| | | <el-table-column label="åç§°" align="center" prop="name" /> |
| | | <el-table-column label="ç±»å" align="center" prop="type" /> |
| | | <el-table-column label="许å¯" align="center" prop="lic" /> |
| | | <el-table-column label="æè¿°" align="center" prop="descr" /> |
| | | <el-table-column label="åæ°" align="center" prop="args" /> |
| | | <el-table-column label="ç¶æ" align="center" prop="status" /> |
| | | <el-table-column label="夿³¨" align="center" prop="remark" /> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:soft:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['system:soft:remove']" |
| | | >å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹è½¯ä»¶å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="许å¯" prop="lic"> |
| | | <el-input v-model="form.lic" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | <el-form-item label="æè¿°" prop="descr"> |
| | | <el-input v-model="form.descr" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°" prop="args"> |
| | | <el-input v-model="form.args" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listSoft, getSoft, delSoft, addSoft, updateSoft } from "@/api/system/soft"; |
| | | |
| | | export default { |
| | | name: "Soft", |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // è½¯ä»¶è¡¨æ ¼æ°æ® |
| | | softList: [], |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | name: null, |
| | | type: null, |
| | | lic: null, |
| | | descr: null, |
| | | args: null, |
| | | status: null, |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: "åç§°ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢è½¯ä»¶å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listSoft(this.queryParams).then(response => { |
| | | this.softList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | softId: null, |
| | | name: null, |
| | | type: null, |
| | | lic: null, |
| | | descr: null, |
| | | args: null, |
| | | status: null, |
| | | createBy: null, |
| | | createTime: null, |
| | | updateBy: null, |
| | | updateTime: null, |
| | | remark: null |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.softId) |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "æ·»å 软件"; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const softId = row.softId || this.ids |
| | | getSoft(softId).then(response => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹è½¯ä»¶"; |
| | | }); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.softId != null) { |
| | | updateSoft(this.form).then(response => { |
| | | this.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addSoft(this.form).then(response => { |
| | | this.$modal.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const softIds = row.softId || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤è½¯ä»¶ç¼å·ä¸º"' + softIds + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return delSoft(softIds); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('system/soft/export', { |
| | | ...this.queryParams |
| | | }, `soft_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | tablePrefix: sys_ |
| | | |
| | | -------------------------------------------------------- |
| | | repository ç®å½ä¸ _remote.respositoriesï¼å é¤ã |
| | | repository ç®å½ä¸ _remote.respositoriesï¼å é¤ã |
| | | proxy_read_timeout 604800s; |
| | | |
| | | nohup java -jar wgcloud.jar & |
| | | top -N 10 |
| | | ps -ef | grep wgcloud |
| | | kill -9 10086 |