From 1661a13ec260774e763effa075673caac4d49686 Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 11 Jun 2024 15:49:03 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=88=86=E6=97=B6=E7=94=B5?= =?UTF-8?q?=E4=BB=B7=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmsBaseSharePriceController.java | 100 +++++++++++++++ .../os/ems/base/domain/EmsBaseSharePrice.java | 118 ++++++++++++++++++ .../base/mapper/EmsBaseSharePriceMapper.java | 61 +++++++++ .../service/IEmsBaseSharePriceService.java | 61 +++++++++ .../impl/EmsBaseSharePriceServiceImpl.java | 90 +++++++++++++ .../ems/base/EmsBaseSharePriceMapper.xml | 110 ++++++++++++++++ 6 files changed, 540 insertions(+) create mode 100644 os-ems/src/main/java/com/os/ems/base/controller/EmsBaseSharePriceController.java create mode 100644 os-ems/src/main/java/com/os/ems/base/domain/EmsBaseSharePrice.java create mode 100644 os-ems/src/main/java/com/os/ems/base/mapper/EmsBaseSharePriceMapper.java create mode 100644 os-ems/src/main/java/com/os/ems/base/service/IEmsBaseSharePriceService.java create mode 100644 os-ems/src/main/java/com/os/ems/base/service/impl/EmsBaseSharePriceServiceImpl.java create mode 100644 os-ems/src/main/resources/mapper/ems/base/EmsBaseSharePriceMapper.xml diff --git a/os-ems/src/main/java/com/os/ems/base/controller/EmsBaseSharePriceController.java b/os-ems/src/main/java/com/os/ems/base/controller/EmsBaseSharePriceController.java new file mode 100644 index 0000000..4d7e436 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/base/controller/EmsBaseSharePriceController.java @@ -0,0 +1,100 @@ +package com.os.ems.base.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +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.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +import com.os.common.enums.BusinessType; +import com.os.ems.base.domain.EmsBaseSharePrice; +import com.os.ems.base.service.IEmsBaseSharePriceService; +import com.os.common.utils.poi.ExcelUtil; +import com.os.common.core.page.TableDataInfo; + +/** + * 分时电价维护Controller + * + * @author Yinq + * @date 2024-06-11 + */ +@RestController +@RequestMapping("/ems/base/baseSharePrice") +public class EmsBaseSharePriceController extends BaseController { + @Autowired + private IEmsBaseSharePriceService emsBaseSharePriceService; + + /** + * 查询分时电价维护列表 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:list')") + @GetMapping("/list") + public TableDataInfo list(EmsBaseSharePrice emsBaseSharePrice) { + startPage(); + List list = emsBaseSharePriceService.selectEmsBaseSharePriceList(emsBaseSharePrice); + return getDataTable(list); + } + + /** + * 导出分时电价维护列表 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:export')") + @Log(title = "分时电价维护", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EmsBaseSharePrice emsBaseSharePrice) { + List list = emsBaseSharePriceService.selectEmsBaseSharePriceList(emsBaseSharePrice); + ExcelUtil util = new ExcelUtil(EmsBaseSharePrice.class); + util.exportExcel(response, list, "分时电价维护数据"); + } + + /** + * 获取分时电价维护详细信息 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { + return success(emsBaseSharePriceService.selectEmsBaseSharePriceByObjId(objId)); + } + + /** + * 新增分时电价维护 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:add')") + @Log(title = "分时电价维护", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EmsBaseSharePrice emsBaseSharePrice) { + emsBaseSharePrice.setCreateBy(getUsername()); + return toAjax(emsBaseSharePriceService.insertEmsBaseSharePrice(emsBaseSharePrice)); + } + + /** + * 修改分时电价维护 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:edit')") + @Log(title = "分时电价维护", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmsBaseSharePrice emsBaseSharePrice) { + emsBaseSharePrice.setUpdateBy(getUsername()); + return toAjax(emsBaseSharePriceService.updateEmsBaseSharePrice(emsBaseSharePrice)); + } + + /** + * 删除分时电价维护 + */ + @PreAuthorize("@ss.hasPermi('ems/base:baseSharePrice:remove')") + @Log(title = "分时电价维护", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(emsBaseSharePriceService.deleteEmsBaseSharePriceByObjIds(objIds)); + } +} diff --git a/os-ems/src/main/java/com/os/ems/base/domain/EmsBaseSharePrice.java b/os-ems/src/main/java/com/os/ems/base/domain/EmsBaseSharePrice.java new file mode 100644 index 0000000..b20f9de --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/base/domain/EmsBaseSharePrice.java @@ -0,0 +1,118 @@ +package com.os.ems.base.domain; + +import java.math.BigDecimal; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.os.common.annotation.Excel; +import com.os.common.core.domain.BaseEntity; + +/** + * 分时电价维护对象 ems_base_share_price + * + * @author Yinq + * @date 2024-06-11 + */ +public class EmsBaseSharePrice extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 自增标识 + */ + private Long objId; + + /** + * 记录月份 + */ + @Excel(name = "记录月份") + private String yearMonthDate; + + /** + * 分时电价类型 + */ + @Excel(name = "分时电价类型") + private String priceType; + + /** + * 用电起始小时数 + */ + @Excel(name = "用电起始小时数") + private Long startHour; + + /** + * 用电结束小时数 + */ + @Excel(name = "用电结束小时数") + private Long endHour; + + /** + * 电单价 + */ + @Excel(name = "电单价") + private BigDecimal dnbPrice; + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setYearMonthDate(String yearMonthDate) { + this.yearMonthDate = yearMonthDate; + } + + public String getYearMonthDate() { + return yearMonthDate; + } + + public void setPriceType(String priceType) { + this.priceType = priceType; + } + + public String getPriceType() { + return priceType; + } + + public void setStartHour(Long startHour) { + this.startHour = startHour; + } + + public Long getStartHour() { + return startHour; + } + + public void setEndHour(Long endHour) { + this.endHour = endHour; + } + + public Long getEndHour() { + return endHour; + } + + public void setDnbPrice(BigDecimal dnbPrice) { + this.dnbPrice = dnbPrice; + } + + public BigDecimal getDnbPrice() { + return dnbPrice; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("yearMonthDate", getYearMonthDate()) + .append("priceType", getPriceType()) + .append("startHour", getStartHour()) + .append("endHour", getEndHour()) + .append("dnbPrice", getDnbPrice()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/os-ems/src/main/java/com/os/ems/base/mapper/EmsBaseSharePriceMapper.java b/os-ems/src/main/java/com/os/ems/base/mapper/EmsBaseSharePriceMapper.java new file mode 100644 index 0000000..95ee650 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/base/mapper/EmsBaseSharePriceMapper.java @@ -0,0 +1,61 @@ +package com.os.ems.base.mapper; + +import java.util.List; + +import com.os.ems.base.domain.EmsBaseSharePrice; + +/** + * 分时电价维护Mapper接口 + * + * @author Yinq + * @date 2024-06-11 + */ +public interface EmsBaseSharePriceMapper { + /** + * 查询分时电价维护 + * + * @param objId 分时电价维护主键 + * @return 分时电价维护 + */ + public EmsBaseSharePrice selectEmsBaseSharePriceByObjId(Long objId); + + /** + * 查询分时电价维护列表 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 分时电价维护集合 + */ + public List selectEmsBaseSharePriceList(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 新增分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + public int insertEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 修改分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + public int updateEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 删除分时电价维护 + * + * @param objId 分时电价维护主键 + * @return 结果 + */ + public int deleteEmsBaseSharePriceByObjId(Long objId); + + /** + * 批量删除分时电价维护 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsBaseSharePriceByObjIds(Long[] objIds); +} diff --git a/os-ems/src/main/java/com/os/ems/base/service/IEmsBaseSharePriceService.java b/os-ems/src/main/java/com/os/ems/base/service/IEmsBaseSharePriceService.java new file mode 100644 index 0000000..23daf99 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/base/service/IEmsBaseSharePriceService.java @@ -0,0 +1,61 @@ +package com.os.ems.base.service; + +import java.util.List; + +import com.os.ems.base.domain.EmsBaseSharePrice; + +/** + * 分时电价维护Service接口 + * + * @author Yinq + * @date 2024-06-11 + */ +public interface IEmsBaseSharePriceService { + /** + * 查询分时电价维护 + * + * @param objId 分时电价维护主键 + * @return 分时电价维护 + */ + public EmsBaseSharePrice selectEmsBaseSharePriceByObjId(Long objId); + + /** + * 查询分时电价维护列表 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 分时电价维护集合 + */ + public List selectEmsBaseSharePriceList(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 新增分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + public int insertEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 修改分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + public int updateEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice); + + /** + * 批量删除分时电价维护 + * + * @param objIds 需要删除的分时电价维护主键集合 + * @return 结果 + */ + public int deleteEmsBaseSharePriceByObjIds(Long[] objIds); + + /** + * 删除分时电价维护信息 + * + * @param objId 分时电价维护主键 + * @return 结果 + */ + public int deleteEmsBaseSharePriceByObjId(Long objId); +} diff --git a/os-ems/src/main/java/com/os/ems/base/service/impl/EmsBaseSharePriceServiceImpl.java b/os-ems/src/main/java/com/os/ems/base/service/impl/EmsBaseSharePriceServiceImpl.java new file mode 100644 index 0000000..af65f93 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/base/service/impl/EmsBaseSharePriceServiceImpl.java @@ -0,0 +1,90 @@ +package com.os.ems.base.service.impl; + +import java.util.List; + +import com.os.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.os.ems.base.mapper.EmsBaseSharePriceMapper; +import com.os.ems.base.domain.EmsBaseSharePrice; +import com.os.ems.base.service.IEmsBaseSharePriceService; + +/** + * 分时电价维护Service业务层处理 + * + * @author Yinq + * @date 2024-06-11 + */ +@Service +public class EmsBaseSharePriceServiceImpl implements IEmsBaseSharePriceService { + @Autowired + private EmsBaseSharePriceMapper emsBaseSharePriceMapper; + + /** + * 查询分时电价维护 + * + * @param objId 分时电价维护主键 + * @return 分时电价维护 + */ + @Override + public EmsBaseSharePrice selectEmsBaseSharePriceByObjId(Long objId) { + return emsBaseSharePriceMapper.selectEmsBaseSharePriceByObjId(objId); + } + + /** + * 查询分时电价维护列表 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 分时电价维护 + */ + @Override + public List selectEmsBaseSharePriceList(EmsBaseSharePrice emsBaseSharePrice) { + return emsBaseSharePriceMapper.selectEmsBaseSharePriceList(emsBaseSharePrice); + } + + /** + * 新增分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + @Override + public int insertEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice) { + emsBaseSharePrice.setCreateTime(DateUtils.getNowDate()); + return emsBaseSharePriceMapper.insertEmsBaseSharePrice(emsBaseSharePrice); + } + + /** + * 修改分时电价维护 + * + * @param emsBaseSharePrice 分时电价维护 + * @return 结果 + */ + @Override + public int updateEmsBaseSharePrice(EmsBaseSharePrice emsBaseSharePrice) { + emsBaseSharePrice.setUpdateTime(DateUtils.getNowDate()); + return emsBaseSharePriceMapper.updateEmsBaseSharePrice(emsBaseSharePrice); + } + + /** + * 批量删除分时电价维护 + * + * @param objIds 需要删除的分时电价维护主键 + * @return 结果 + */ + @Override + public int deleteEmsBaseSharePriceByObjIds(Long[] objIds) { + return emsBaseSharePriceMapper.deleteEmsBaseSharePriceByObjIds(objIds); + } + + /** + * 删除分时电价维护信息 + * + * @param objId 分时电价维护主键 + * @return 结果 + */ + @Override + public int deleteEmsBaseSharePriceByObjId(Long objId) { + return emsBaseSharePriceMapper.deleteEmsBaseSharePriceByObjId(objId); + } +} diff --git a/os-ems/src/main/resources/mapper/ems/base/EmsBaseSharePriceMapper.xml b/os-ems/src/main/resources/mapper/ems/base/EmsBaseSharePriceMapper.xml new file mode 100644 index 0000000..b29214d --- /dev/null +++ b/os-ems/src/main/resources/mapper/ems/base/EmsBaseSharePriceMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + select obj_id, + year_month_date, + price_type, + start_hour, + end_hour, + dnb_price, + create_by, + create_time, + update_by, + update_time, + remark + from ems_base_share_price + + + + + + + + insert into ems_base_share_price + + year_month_date, + price_type, + start_hour, + end_hour, + dnb_price, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{yearMonthDate}, + #{priceType}, + #{startHour}, + #{endHour}, + #{dnbPrice}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update ems_base_share_price + + year_month_date = #{yearMonthDate}, + price_type = #{priceType}, + start_hour = #{startHour}, + end_hour = #{endHour}, + dnb_price = #{dnbPrice}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where obj_id = #{objId} + + + + delete + from ems_base_share_price + where obj_id = #{objId} + + + + delete from ems_base_share_price where obj_id in + + #{objId} + + + \ No newline at end of file