feat(system): 添加节假日管理功能- 新增 SysHolidayController、SysHoliday、SysHolidayMapper、SysHolidayServiceImpl 和 ISysHolidayService 类- 实现节假日信息的增删改查和导出功能
- 添加工作日判断方法
- 新增相关 API 接口
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.system.controller; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.system.domain.SysHoliday; |
| | | import com.zhitan.system.service.ISysHolidayService; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * èåæ¥ä¿¡æ¯Controller |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/holiday") |
| | | public class SysHolidayController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysHolidayService sysHolidayService; |
| | | |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysHoliday sysHoliday) |
| | | { |
| | | startPage(); |
| | | List<SysHoliday> list = sysHolidayService.selectSysHolidayList(sysHoliday); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºèåæ¥ä¿¡æ¯å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:export')") |
| | | @Log(title = "èåæ¥ä¿¡æ¯", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SysHoliday sysHoliday) |
| | | { |
| | | List<SysHoliday> list = sysHolidayService.selectSysHolidayList(sysHoliday); |
| | | ExcelUtil<SysHoliday> util = new ExcelUtil<SysHoliday>(SysHoliday.class); |
| | | return util.exportExcel(list, "èåæ¥ä¿¡æ¯æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·åèåæ¥ä¿¡æ¯è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:query')") |
| | | @GetMapping(value = "/{holidayId}") |
| | | public AjaxResult getInfo(@PathVariable("holidayId") Long holidayId) |
| | | { |
| | | return success(sysHolidayService.selectSysHolidayById(holidayId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢èåæ¥ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:add')") |
| | | @Log(title = "èåæ¥ä¿¡æ¯", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysHoliday sysHoliday) |
| | | { |
| | | return toAjax(sysHolidayService.insertSysHoliday(sysHoliday)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹èåæ¥ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:edit')") |
| | | @Log(title = "èåæ¥ä¿¡æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysHoliday sysHoliday) |
| | | { |
| | | return toAjax(sysHolidayService.updateSysHoliday(sysHoliday)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èåæ¥ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:holiday:remove')") |
| | | @Log(title = "èåæ¥ä¿¡æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{holidayIds}") |
| | | public AjaxResult remove(@PathVariable Long[] holidayIds) |
| | | { |
| | | return toAjax(sysHolidayService.deleteSysHolidayByIds(holidayIds)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.system.domain; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * èåæ¥ä¿¡æ¯å¯¹è±¡ sys_holiday |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public class SysHoliday extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** è忥ID */ |
| | | private Long holidayId; |
| | | |
| | | /** è忥åç§° */ |
| | | @Excel(name = "è忥åç§°") |
| | | private String holidayName; |
| | | |
| | | /** èåæ¥æ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "èåæ¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date holidayDate; |
| | | |
| | | /** èåæ¥ç±»åï¼0æ£å¸¸åæ¥ 1工使¥è°ä¼ï¼ */ |
| | | @Excel(name = "èåæ¥ç±»å", readConverterExp = "0=æ£å¸¸åæ¥,1=工使¥è°ä¼") |
| | | private String holidayType; |
| | | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | |
| | | /** 夿³¨ */ |
| | | private String remark; |
| | | |
| | | public Long getHolidayId() { |
| | | return holidayId; |
| | | } |
| | | |
| | | public void setHolidayId(Long holidayId) { |
| | | this.holidayId = holidayId; |
| | | } |
| | | |
| | | public String getHolidayName() { |
| | | return holidayName; |
| | | } |
| | | |
| | | public void setHolidayName(String holidayName) { |
| | | this.holidayName = holidayName; |
| | | } |
| | | |
| | | public Date getHolidayDate() { |
| | | return holidayDate; |
| | | } |
| | | |
| | | public void setHolidayDate(Date holidayDate) { |
| | | this.holidayDate = holidayDate; |
| | | } |
| | | |
| | | public String getHolidayType() { |
| | | return holidayType; |
| | | } |
| | | |
| | | public void setHolidayType(String holidayType) { |
| | | this.holidayType = holidayType; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | @Override |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.system.mapper; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import com.zhitan.system.domain.SysHoliday; |
| | | |
| | | /** |
| | | * èåæ¥ä¿¡æ¯Mapperæ¥å£ |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface SysHolidayMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return èåæ¥ä¿¡æ¯ |
| | | */ |
| | | public SysHoliday selectSysHolidayById(Long holidayId); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥ææ¥è¯¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param date æ¥æ |
| | | * @return èåæ¥ä¿¡æ¯ |
| | | */ |
| | | public SysHoliday selectSysHolidayByDate(Date date); |
| | | |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯å表 |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return èåæ¥ä¿¡æ¯éå |
| | | */ |
| | | public List<SysHoliday> selectSysHolidayList(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * æ°å¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysHoliday(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * ä¿®æ¹èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysHoliday(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * å é¤èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysHolidayById(Long holidayId); |
| | | |
| | | /** |
| | | * æ¹éå é¤èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayIds éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysHolidayByIds(Long[] holidayIds); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import com.zhitan.system.domain.SysHoliday; |
| | | |
| | | /** |
| | | * èåæ¥ä¿¡æ¯Serviceæ¥å£ |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysHolidayService |
| | | { |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return èåæ¥ä¿¡æ¯ |
| | | */ |
| | | public SysHoliday selectSysHolidayById(Long holidayId); |
| | | |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯å表 |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return èåæ¥ä¿¡æ¯éå |
| | | */ |
| | | public List<SysHoliday> selectSysHolidayList(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * æ°å¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSysHoliday(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * ä¿®æ¹èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSysHoliday(SysHoliday sysHoliday); |
| | | |
| | | /** |
| | | * æ¹éå é¤èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayIds éè¦å é¤çèåæ¥ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysHolidayByIds(Long[] holidayIds); |
| | | |
| | | /** |
| | | * å é¤èåæ¥ä¿¡æ¯ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSysHolidayById(Long holidayId); |
| | | |
| | | /** |
| | | * å¤ææ¥ææ¯å¦ä¸ºå·¥ä½æ¥ |
| | | * 工使¥å¤æé»è¾ï¼ |
| | | * 1. 妿æ¯å¨ä¸è³å¨äºï¼ä¸ä¸æ¯æ³å®è忥ï¼åä¸ºå·¥ä½æ¥ |
| | | * 2. 妿æ¯å¨å
æ¥ï¼ä½æ¯ä¸ºè°ä¼å·¥ä½æ¥ï¼åä¸ºå·¥ä½æ¥ |
| | | * |
| | | * @param date éè¦å¤æçæ¥æ |
| | | * @return 妿æ¯å·¥ä½æ¥è¿åtrueï¼å¦åè¿åfalse |
| | | */ |
| | | public boolean isWorkDay(Date date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | | import com.zhitan.system.mapper.SysHolidayMapper; |
| | | import com.zhitan.system.domain.SysHoliday; |
| | | import com.zhitan.system.service.ISysHolidayService; |
| | | |
| | | /** |
| | | * èåæ¥ä¿¡æ¯Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | | public class SysHolidayServiceImpl implements ISysHolidayService |
| | | { |
| | | @Autowired |
| | | private SysHolidayMapper sysHolidayMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return èåæ¥ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public SysHoliday selectSysHolidayById(Long holidayId) |
| | | { |
| | | return sysHolidayMapper.selectSysHolidayById(holidayId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢èåæ¥ä¿¡æ¯å表 |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return èåæ¥ä¿¡æ¯éå |
| | | */ |
| | | @Override |
| | | public List<SysHoliday> selectSysHolidayList(SysHoliday sysHoliday) |
| | | { |
| | | return sysHolidayMapper.selectSysHolidayList(sysHoliday); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertSysHoliday(SysHoliday sysHoliday) |
| | | { |
| | | sysHoliday.setCreateTime(DateUtils.getNowDate()); |
| | | sysHoliday.setCreateBy(SecurityUtils.getUsername()); |
| | | return sysHolidayMapper.insertSysHoliday(sysHoliday); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param sysHoliday èåæ¥ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateSysHoliday(SysHoliday sysHoliday) |
| | | { |
| | | sysHoliday.setUpdateTime(DateUtils.getNowDate()); |
| | | sysHoliday.setUpdateBy(SecurityUtils.getUsername()); |
| | | return sysHolidayMapper.updateSysHoliday(sysHoliday); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤èåæ¥ä¿¡æ¯ |
| | | * |
| | | * @param holidayIds éè¦å é¤çèåæ¥ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysHolidayByIds(Long[] holidayIds) |
| | | { |
| | | return sysHolidayMapper.deleteSysHolidayByIds(holidayIds); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èåæ¥ä¿¡æ¯ä¿¡æ¯ |
| | | * |
| | | * @param holidayId èåæ¥ä¿¡æ¯ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSysHolidayById(Long holidayId) |
| | | { |
| | | return sysHolidayMapper.deleteSysHolidayById(holidayId); |
| | | } |
| | | |
| | | /** |
| | | * å¤ææ¥ææ¯å¦ä¸ºå·¥ä½æ¥ |
| | | * 工使¥å¤æé»è¾ï¼ |
| | | * 1. 妿æ¯å¨ä¸è³å¨äºï¼ä¸ä¸æ¯æ³å®è忥ï¼åä¸ºå·¥ä½æ¥ |
| | | * 2. 妿æ¯å¨å
æ¥ï¼ä½æ¯ä¸ºè°ä¼å·¥ä½æ¥ï¼åä¸ºå·¥ä½æ¥ |
| | | * |
| | | * @param date éè¦å¤æçæ¥æ |
| | | * @return 妿æ¯å·¥ä½æ¥è¿åtrueï¼å¦åè¿åfalse |
| | | */ |
| | | @Override |
| | | public boolean isWorkDay(Date date) |
| | | { |
| | | if (date == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | // æ¥è¯¢è¯¥æ¥ææ¯å¦å¨èåæ¥è¡¨ä¸ |
| | | SysHoliday holiday = sysHolidayMapper.selectSysHolidayByDate(date); |
| | | |
| | | // 妿å¨èåæ¥è¡¨ä¸æ¾å°è®°å½ |
| | | if (holiday != null) |
| | | { |
| | | // 妿æ¯è°ä¼å·¥ä½æ¥ï¼ç±»å为1ï¼ï¼åä¸ºå·¥ä½æ¥ |
| | | if ("1".equals(holiday.getHolidayType())) |
| | | { |
| | | return true; |
| | | } |
| | | // å¦ææ¯æ³å®è忥ï¼ç±»å为0ï¼ï¼å䏿¯å·¥ä½æ¥ |
| | | else if ("0".equals(holiday.getHolidayType())) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 妿ä¸å¨èåæ¥è¡¨ä¸ï¼å夿æ¯å¦ä¸ºå¨ä¸è³å¨äº |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | |
| | | int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); |
| | | |
| | | // Calendar.DAY_OF_WEEK ä¸ï¼1ä»£è¡¨å¨æ¥ï¼2代表å¨ä¸ï¼3代表å¨äºï¼4代表å¨ä¸ï¼5代表å¨åï¼6代表å¨äºï¼7代表å¨å
|
| | | // æä»¥å·¥ä½æ¥å¯¹åºç弿¯2,3,4,5,6ï¼å¨ä¸è³å¨äºï¼ |
| | | return dayOfWeek >= Calendar.MONDAY && dayOfWeek <= Calendar.FRIDAY; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.zhitan.airconditioner.mapper.AirConditionerLogMapper"> |
| | | |
| | | <resultMap type="AirConditionerLog" id="AirConditionerLogResult"> |
| | | <id property="id" column="id" /> |
| | | <result property="airConditionerId" column="air_conditioner_id" /> |
| | | <result property="airConditionerName" column="air_conditioner_name" /> |
| | | <result property="operateType" column="operate_type" /> |
| | | <result property="operateMode" column="operate_mode" /> |
| | | <result property="operateTime" column="operate_time" /> |
| | | <result property="operateResult" column="operate_result" /> |
| | | <result property="operateMsg" column="operate_msg" /> |
| | | <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="selectAirConditionerLogVo"> |
| | | select id, air_conditioner_id, air_conditioner_name, operate_type, operate_mode, operate_time, operate_result, operate_msg, create_by, create_time, update_by, update_time, remark from air_conditioner_log |
| | | </sql> |
| | | |
| | | <select id="selectAirConditionerLogList" parameterType="AirConditionerLog" resultMap="AirConditionerLogResult"> |
| | | <include refid="selectAirConditionerLogVo"/> |
| | | <where> |
| | | <if test="airConditionerId != null "> and air_conditioner_id = #{airConditionerId}</if> |
| | | <if test="airConditionerName != null and airConditionerName != ''"> and air_conditioner_name like concat('%', #{airConditionerName}, '%')</if> |
| | | <if test="operateType != null and operateType != ''"> and operate_type = #{operateType}</if> |
| | | <if test="operateMode != null and operateMode != ''"> and operate_mode = #{operateMode}</if> |
| | | <if test="operateResult != null and operateResult != ''"> and operate_result = #{operateResult}</if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- å¼å§æ¶é´æ£ç´¢ --> |
| | | AND date_format(operate_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- ç»ææ¶é´æ£ç´¢ --> |
| | | AND date_format(operate_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | </where> |
| | | order by operate_time desc |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerLogById" parameterType="Long" resultMap="AirConditionerLogResult"> |
| | | <include refid="selectAirConditionerLogVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerLogByAirConditionerId" parameterType="Long" resultMap="AirConditionerLogResult"> |
| | | <include refid="selectAirConditionerLogVo"/> |
| | | where air_conditioner_id = #{airConditionerId} |
| | | order by operate_time desc |
| | | </select> |
| | | |
| | | <insert id="insertAirConditionerLog" parameterType="AirConditionerLog" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into air_conditioner_log |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="airConditionerId != null">air_conditioner_id,</if> |
| | | <if test="airConditionerName != null">air_conditioner_name,</if> |
| | | <if test="operateType != null">operate_type,</if> |
| | | <if test="operateMode != null">operate_mode,</if> |
| | | <if test="operateTime != null">operate_time,</if> |
| | | <if test="operateResult != null">operate_result,</if> |
| | | <if test="operateMsg != null">operate_msg,</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="airConditionerId != null">#{airConditionerId},</if> |
| | | <if test="airConditionerName != null">#{airConditionerName},</if> |
| | | <if test="operateType != null">#{operateType},</if> |
| | | <if test="operateMode != null">#{operateMode},</if> |
| | | <if test="operateTime != null">#{operateTime},</if> |
| | | <if test="operateResult != null">#{operateResult},</if> |
| | | <if test="operateMsg != null">#{operateMsg},</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> |
| | | |
| | | <delete id="deleteAirConditionerLogById" parameterType="Long"> |
| | | delete from air_conditioner_log where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteAirConditionerLogByIds" parameterType="String"> |
| | | delete from air_conditioner_log where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteAirConditionerLogByAirConditionerId" parameterType="Long"> |
| | | delete from air_conditioner_log where air_conditioner_id = #{airConditionerId} |
| | | </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.zhitan.airconditioner.mapper.AirConditionerMapper"> |
| | | |
| | | <resultMap type="AirConditioner" id="AirConditionerResult"> |
| | | <id property="id" column="id" /> |
| | | <result property="name" column="name" /> |
| | | <result property="controllerId" column="controller_id" /> |
| | | <result property="location" column="location" /> |
| | | <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="selectAirConditionerVo"> |
| | | select id, name, controller_id, location, status, create_by, create_time, update_by, update_time, remark from air_conditioner |
| | | </sql> |
| | | |
| | | <select id="selectAirConditionerList" parameterType="AirConditioner" resultMap="AirConditionerResult"> |
| | | <include refid="selectAirConditionerVo"/> |
| | | <where> |
| | | <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
| | | <if test="controllerId != null and controllerId != ''"> and controller_id = #{controllerId}</if> |
| | | <if test="location != null and location != ''"> and location like concat('%', #{location}, '%')</if> |
| | | <if test="status != null and status != ''"> and status = #{status}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerById" parameterType="Long" resultMap="AirConditionerResult"> |
| | | <include refid="selectAirConditionerVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerByControllerId" parameterType="String" resultMap="AirConditionerResult"> |
| | | <include refid="selectAirConditionerVo"/> |
| | | where controller_id = #{controllerId} |
| | | </select> |
| | | |
| | | <insert id="insertAirConditioner" parameterType="AirConditioner" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into air_conditioner |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="name != null">name,</if> |
| | | <if test="controllerId != null">controller_id,</if> |
| | | <if test="location != null">location,</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="name != null">#{name},</if> |
| | | <if test="controllerId != null">#{controllerId},</if> |
| | | <if test="location != null">#{location},</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="updateAirConditioner" parameterType="AirConditioner"> |
| | | update air_conditioner |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="name != null">name = #{name},</if> |
| | | <if test="controllerId != null">controller_id = #{controllerId},</if> |
| | | <if test="location != null">location = #{location},</if> |
| | | <if test="status != null">status = #{status},</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 id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteAirConditionerById" parameterType="Long"> |
| | | delete from air_conditioner where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteAirConditionerByIds" parameterType="String"> |
| | | delete from air_conditioner where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </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.zhitan.airconditioner.mapper.AirConditionerScheduleMapper"> |
| | | |
| | | <resultMap type="AirConditionerSchedule" id="AirConditionerScheduleResult"> |
| | | <id property="id" column="id" /> |
| | | <result property="airConditionerId" column="air_conditioner_id" /> |
| | | <result property="startTime" column="start_time" /> |
| | | <result property="offTime" column="off_time" /> |
| | | <result property="controlMode" column="control_mode" /> |
| | | <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="selectAirConditionerScheduleVo"> |
| | | select id, air_conditioner_id, start_time, off_time, control_mode, status, create_by, create_time, update_by, update_time, remark from air_conditioner_schedule |
| | | </sql> |
| | | |
| | | <select id="selectAirConditionerScheduleList" parameterType="AirConditionerSchedule" resultMap="AirConditionerScheduleResult"> |
| | | <include refid="selectAirConditionerScheduleVo"/> |
| | | <where> |
| | | <if test="airConditionerId != null "> and air_conditioner_id = #{airConditionerId}</if> |
| | | <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if> |
| | | <if test="offTime != null and offTime != ''"> and off_time = #{offTime}</if> |
| | | <if test="controlMode != null and controlMode != ''"> and control_mode = #{controlMode}</if> |
| | | <if test="status != null and status != ''"> and status = #{status}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerScheduleById" parameterType="Long" resultMap="AirConditionerScheduleResult"> |
| | | <include refid="selectAirConditionerScheduleVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectAirConditionerScheduleByAirConditionerId" parameterType="Long" resultMap="AirConditionerScheduleResult"> |
| | | <include refid="selectAirConditionerScheduleVo"/> |
| | | where air_conditioner_id = #{airConditionerId} |
| | | </select> |
| | | |
| | | <select id="selectActiveSchedules" resultMap="AirConditionerScheduleResult"> |
| | | <include refid="selectAirConditionerScheduleVo"/> |
| | | where status = '0' and start_time <= #{currentTime} and off_time >= #{currentTime} |
| | | </select> |
| | | |
| | | <select id="selectSchedulesByTimePoint" resultMap="AirConditionerScheduleResult"> |
| | | <include refid="selectAirConditionerScheduleVo"/> |
| | | where status = '0' and |
| | | (DATE_FORMAT(start_time, '%H:%i') = #{timePoint} or DATE_FORMAT(off_time, '%H:%i') = #{timePoint}) |
| | | </select> |
| | | |
| | | <insert id="insertAirConditionerSchedule" parameterType="AirConditionerSchedule" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into air_conditioner_schedule |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="airConditionerId != null">air_conditioner_id,</if> |
| | | <if test="startTime != null">start_time,</if> |
| | | <if test="offTime != null">off_time,</if> |
| | | <if test="controlMode != null">control_mode,</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="airConditionerId != null">#{airConditionerId},</if> |
| | | <if test="startTime != null">#{startTime},</if> |
| | | <if test="offTime != null">#{offTime},</if> |
| | | <if test="controlMode != null">#{controlMode},</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="updateAirConditionerSchedule" parameterType="AirConditionerSchedule"> |
| | | update air_conditioner_schedule |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="airConditionerId != null">air_conditioner_id = #{airConditionerId},</if> |
| | | <if test="startTime != null">start_time = #{startTime},</if> |
| | | <if test="offTime != null">off_time = #{offTime},</if> |
| | | <if test="controlMode != null">control_mode = #{controlMode},</if> |
| | | <if test="status != null">status = #{status},</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 id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteAirConditionerScheduleById" parameterType="Long"> |
| | | delete from air_conditioner_schedule where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteAirConditionerScheduleByIds" parameterType="String"> |
| | | delete from air_conditioner_schedule where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteAirConditionerScheduleByAirConditionerId" parameterType="Long"> |
| | | delete from air_conditioner_schedule where air_conditioner_id = #{airConditionerId} |
| | | </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.zhitan.system.mapper.SysHolidayMapper"> |
| | | |
| | | <resultMap type="com.zhitan.system.domain.SysHoliday" id="SysHolidayResult"> |
| | | <id property="holidayId" column="holiday_id" /> |
| | | <result property="holidayName" column="holiday_name" /> |
| | | <result property="holidayDate" column="holiday_date" /> |
| | | <result property="holidayType" column="holiday_type" /> |
| | | <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="selectSysHolidayVo"> |
| | | select holiday_id, holiday_name, holiday_date, holiday_type, status, create_by, create_time, update_by, update_time, remark |
| | | from sys_holiday |
| | | </sql> |
| | | |
| | | <!-- æ¥è¯¢èåæ¥ä¿¡æ¯ --> |
| | | <select id="selectSysHolidayById" parameterType="Long" resultMap="SysHolidayResult"> |
| | | <include refid="selectSysHolidayVo"/> |
| | | where holiday_id = #{holidayId} |
| | | </select> |
| | | |
| | | <!-- æ ¹æ®æ¥ææ¥è¯¢èåæ¥ä¿¡æ¯ --> |
| | | <select id="selectSysHolidayByDate" parameterType="Date" resultMap="SysHolidayResult"> |
| | | <include refid="selectSysHolidayVo"/> |
| | | where holiday_date = #{date} |
| | | and status = '0' |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢èåæ¥ä¿¡æ¯å表 --> |
| | | <select id="selectSysHolidayList" parameterType="com.zhitan.system.domain.SysHoliday" resultMap="SysHolidayResult"> |
| | | <include refid="selectSysHolidayVo"/> |
| | | <where> |
| | | <if test="holidayName != null and holidayName != ''"> |
| | | AND holiday_name like concat('%', #{holidayName}, '%') |
| | | </if> |
| | | <if test="holidayDate != null "> |
| | | AND holiday_date = #{holidayDate} |
| | | </if> |
| | | <if test="holidayType != null and holidayType != ''"> |
| | | AND holiday_type = #{holidayType} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- æ°å¢èåæ¥ä¿¡æ¯ --> |
| | | <insert id="insertSysHoliday" parameterType="com.zhitan.system.domain.SysHoliday" useGeneratedKeys="true" keyProperty="holidayId"> |
| | | insert into sys_holiday |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="holidayName != null and holidayName != ''"> |
| | | holiday_name, |
| | | </if> |
| | | <if test="holidayDate != null"> |
| | | holiday_date, |
| | | </if> |
| | | <if test="holidayType != null and holidayType != ''"> |
| | | holiday_type, |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | status, |
| | | </if> |
| | | <if test="createBy != null and createBy != ''"> |
| | | create_by, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="remark != null and remark != ''"> |
| | | remark, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="holidayName != null and holidayName != ''"> |
| | | #{holidayName}, |
| | | </if> |
| | | <if test="holidayDate != null"> |
| | | #{holidayDate}, |
| | | </if> |
| | | <if test="holidayType != null and holidayType != ''"> |
| | | #{holidayType}, |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | #{status}, |
| | | </if> |
| | | <if test="createBy != null and createBy != ''"> |
| | | #{createBy}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime}, |
| | | </if> |
| | | <if test="remark != null and remark != ''"> |
| | | #{remark}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <!-- ä¿®æ¹èåæ¥ä¿¡æ¯ --> |
| | | <update id="updateSysHoliday" parameterType="com.zhitan.system.domain.SysHoliday"> |
| | | update sys_holiday |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="holidayName != null and holidayName != ''"> |
| | | holiday_name = #{holidayName}, |
| | | </if> |
| | | <if test="holidayDate != null"> |
| | | holiday_date = #{holidayDate}, |
| | | </if> |
| | | <if test="holidayType != null and holidayType != ''"> |
| | | holiday_type = #{holidayType}, |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | status = #{status}, |
| | | </if> |
| | | <if test="updateBy != null and updateBy != ''"> |
| | | update_by = #{updateBy}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime}, |
| | | </if> |
| | | <if test="remark != null"> |
| | | remark = #{remark}, |
| | | </if> |
| | | </trim> |
| | | where holiday_id = #{holidayId} |
| | | </update> |
| | | |
| | | <!-- å é¤èåæ¥ä¿¡æ¯ --> |
| | | <delete id="deleteSysHolidayById" parameterType="Long"> |
| | | delete from sys_holiday where holiday_id = #{holidayId} |
| | | </delete> |
| | | |
| | | <!-- æ¹éå é¤èåæ¥ä¿¡æ¯ --> |
| | | <delete id="deleteSysHolidayByIds" parameterType="String"> |
| | | delete from sys_holiday where holiday_id in |
| | | <foreach item="holidayId" collection="array" open="(" separator="," close=")"> |
| | | #{holidayId} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢è忥å表 |
| | | export function listHoliday(query) { |
| | | return request({ |
| | | url: '/system/holiday/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢èåæ¥è¯¦ç» |
| | | export function getHoliday(holidayId) { |
| | | return request({ |
| | | url: '/system/holiday/' + holidayId, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢è忥 |
| | | export function addHoliday(data) { |
| | | return request({ |
| | | url: '/system/holiday', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹è忥 |
| | | export function updateHoliday(data) { |
| | | return request({ |
| | | url: '/system/holiday', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤è忥 |
| | | export function delHoliday(holidayId) { |
| | | return request({ |
| | | url: '/system/holiday/' + holidayId, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 导åºè忥 |
| | | export function exportHoliday(query) { |
| | | return request({ |
| | | url: '/system/holiday/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="80px"> |
| | | <el-form-item label="è忥åç§°" prop="holidayName"> |
| | | <el-input |
| | | v-model="queryParams.holidayName" |
| | | placeholder="请è¾å
¥è忥åç§°" |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="èåæ¥æ¥æ" prop="holidayDate"> |
| | | <el-date-picker |
| | | v-model="queryParams.holidayDate" |
| | | type="date" |
| | | placeholder="éæ©èåæ¥æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="èåæ¥ç±»å" prop="holidayType"> |
| | | <el-select v-model="queryParams.holidayType" placeholder="èåæ¥ç±»å" clearable style="width: 240px"> |
| | | <el-option |
| | | v-for="dict in sys_holiday_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-select v-model="queryParams.status" placeholder="èåæ¥ç¶æ" clearable style="width: 240px"> |
| | | <el-option |
| | | v-for="dict in sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <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> |
| | | </div> |
| | | |
| | | <div class="table-bg-style"> |
| | | <div class="table-box" style="margin-top: 0"> |
| | | <el-row :gutter="10" class="mb8" style="margin-top: 8px"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:holiday:add']" |
| | | >æ°å¢</el-button |
| | | > |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="Edit" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:holiday:edit']" |
| | | >ä¿®æ¹</el-button |
| | | > |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="Delete" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:holiday:remove']" |
| | | >å é¤</el-button |
| | | > |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:holiday:export']" |
| | | >导åº</el-button |
| | | > |
| | | </el-col> |
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="holidayList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="è忥ID" align="center" prop="holidayId" /> |
| | | <el-table-column label="è忥åç§°" align="center" prop="holidayName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="èåæ¥æ¥æ" align="center" prop="holidayDate" width="100" /> |
| | | <el-table-column label="èåæ¥ç±»å" align="center" prop="holidayType"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_holiday_type" :value="scope.row.holidayType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" align="center" prop="status"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_normal_disable" :value="scope.row.status" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="100"> |
| | | <template #default="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <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="['system:holiday:edit']">ä¿®æ¹</el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:holiday: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" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- æ·»å æä¿®æ¹èåæ¥å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| | | <el-form ref="holidayRef" :model="form" :rules="rules" label-width="100px"> |
| | | <el-form-item label="è忥åç§°" prop="holidayName"> |
| | | <el-input v-model="form.holidayName" placeholder="请è¾å
¥è忥åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="èåæ¥æ¥æ" prop="holidayDate"> |
| | | <el-date-picker |
| | | v-model="form.holidayDate" |
| | | type="date" |
| | | placeholder="éæ©èåæ¥æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="èåæ¥ç±»å" prop="holidayType"> |
| | | <el-select v-model="form.holidayType" placeholder="è¯·éæ©èåæ¥ç±»å" style="width: 100%"> |
| | | <el-option |
| | | v-for="dict in sys_holiday_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.value" |
| | | >{{ dict.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å
容" /> |
| | | </el-form-item> |
| | | </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> |
| | | import { listHoliday, getHoliday, delHoliday, addHoliday, updateHoliday, exportHoliday } from "@/api/system/holiday"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); |
| | | const sys_holiday_type = ref([]); |
| | | |
| | | // åå§åèåæ¥ç±»ååå
¸ |
| | | sys_holiday_type.value = [ |
| | | { value: "0", label: "æ£å¸¸åæ¥" }, |
| | | { value: "1", label: "工使¥è°ä¼" } |
| | | ]; |
| | | |
| | | const holidayList = ref([]); |
| | | const open = ref(false); |
| | | const loading = ref(true); |
| | | const showSearch = ref(true); |
| | | const ids = ref([]); |
| | | const single = ref(true); |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | const title = ref(""); |
| | | |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | holidayName: undefined, |
| | | holidayDate: undefined, |
| | | holidayType: undefined, |
| | | status: undefined |
| | | }, |
| | | rules: { |
| | | holidayName: [ |
| | | { required: true, message: "è忥åç§°ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | holidayDate: [ |
| | | { required: true, message: "èåæ¥æ¥æä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | holidayType: [ |
| | | { required: true, message: "èåæ¥ç±»åä¸è½ä¸ºç©º", trigger: "change" } |
| | | ], |
| | | status: [ |
| | | { required: true, message: "ç¶æä¸è½ä¸ºç©º", trigger: "change" } |
| | | ] |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, form, rules } = toRefs(data); |
| | | |
| | | /** æ¥è¯¢è忥å表 */ |
| | | function getList() { |
| | | loading.value = true; |
| | | listHoliday(queryParams.value).then(response => { |
| | | holidayList.value = response.rows; |
| | | total.value = response.total; |
| | | loading.value = false; |
| | | }); |
| | | } |
| | | |
| | | // åæ¶æé® |
| | | function cancel() { |
| | | open.value = false; |
| | | reset(); |
| | | } |
| | | |
| | | // 表åéç½® |
| | | function reset() { |
| | | form.value = { |
| | | holidayId: undefined, |
| | | holidayName: undefined, |
| | | holidayDate: undefined, |
| | | holidayType: "0", |
| | | status: "0", |
| | | remark: undefined |
| | | }; |
| | | proxy.resetForm("holidayRef"); |
| | | } |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | } |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | handleQuery(); |
| | | } |
| | | |
| | | /** å¤éæ¡é䏿°æ® */ |
| | | function handleSelectionChange(selection) { |
| | | ids.value = selection.map(item => item.holidayId); |
| | | single.value = selection.length != 1; |
| | | multiple.value = !selection.length; |
| | | } |
| | | |
| | | /** æ°å¢æé®æä½ */ |
| | | function handleAdd() { |
| | | reset(); |
| | | open.value = true; |
| | | title.value = "æ·»å è忥"; |
| | | } |
| | | |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | function handleUpdate(row) { |
| | | reset(); |
| | | const holidayId = row.holidayId || ids.value[0]; |
| | | getHoliday(holidayId).then(response => { |
| | | form.value = response.data; |
| | | open.value = true; |
| | | title.value = "ä¿®æ¹è忥"; |
| | | }); |
| | | } |
| | | |
| | | /** æäº¤æé® */ |
| | | function submitForm() { |
| | | proxy.$refs["holidayRef"].validate(valid => { |
| | | if (valid) { |
| | | if (form.value.holidayId != undefined) { |
| | | updateHoliday(form.value).then(response => { |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } else { |
| | | addHoliday(form.value).then(response => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** å é¤æé®æä½ */ |
| | | function handleDelete(row) { |
| | | const holidayIds = row.holidayId || ids.value; |
| | | proxy.$modal.confirm('æ¯å¦ç¡®è®¤å é¤è忥ç¼å·ä¸º"' + holidayIds + '"çæ°æ®é¡¹?').then(function() { |
| | | return delHoliday(holidayIds); |
| | | }).then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | } |
| | | |
| | | /** å¯¼åºæé®æä½ */ |
| | | function handleExport() { |
| | | proxy.download("system/holiday/export", { |
| | | ...queryParams.value |
| | | }, `holiday_${new Date().getTime()}.xlsx`); |
| | | } |
| | | |
| | | getList(); |
| | | </script> |