change - 分时电价维护
parent
c72ea3c9e7
commit
1661a13ec2
@ -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<EmsBaseSharePrice> 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<EmsBaseSharePrice> list = emsBaseSharePriceService.selectEmsBaseSharePriceList(emsBaseSharePrice);
|
||||
ExcelUtil<EmsBaseSharePrice> util = new ExcelUtil<EmsBaseSharePrice>(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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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<EmsBaseSharePrice> 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);
|
||||
}
|
@ -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<EmsBaseSharePrice> 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);
|
||||
}
|
@ -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<EmsBaseSharePrice> 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
<?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.os.ems.base.mapper.EmsBaseSharePriceMapper">
|
||||
|
||||
<resultMap type="EmsBaseSharePrice" id="EmsBaseSharePriceResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="yearMonthDate" column="year_month_date"/>
|
||||
<result property="priceType" column="price_type"/>
|
||||
<result property="startHour" column="start_hour"/>
|
||||
<result property="endHour" column="end_hour"/>
|
||||
<result property="dnbPrice" column="dnb_price"/>
|
||||
<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="selectEmsBaseSharePriceVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsBaseSharePriceList" parameterType="EmsBaseSharePrice" resultMap="EmsBaseSharePriceResult">
|
||||
<include refid="selectEmsBaseSharePriceVo"/>
|
||||
<where>
|
||||
<if test="yearMonthDate != null and yearMonthDate != ''">and year_month_date = #{yearMonthDate}</if>
|
||||
<if test="priceType != null and priceType != ''">and price_type = #{priceType}</if>
|
||||
<if test="startHour != null ">and start_hour = #{startHour}</if>
|
||||
<if test="endHour != null ">and end_hour = #{endHour}</if>
|
||||
<if test="dnbPrice != null ">and dnb_price = #{dnbPrice}</if>
|
||||
</where>
|
||||
order by year_month_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectEmsBaseSharePriceByObjId" parameterType="Long" resultMap="EmsBaseSharePriceResult">
|
||||
<include refid="selectEmsBaseSharePriceVo"/>
|
||||
where obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsBaseSharePrice" parameterType="EmsBaseSharePrice" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into ems_base_share_price
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="yearMonthDate != null">year_month_date,</if>
|
||||
<if test="priceType != null">price_type,</if>
|
||||
<if test="startHour != null">start_hour,</if>
|
||||
<if test="endHour != null">end_hour,</if>
|
||||
<if test="dnbPrice != null">dnb_price,</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="yearMonthDate != null">#{yearMonthDate},</if>
|
||||
<if test="priceType != null">#{priceType},</if>
|
||||
<if test="startHour != null">#{startHour},</if>
|
||||
<if test="endHour != null">#{endHour},</if>
|
||||
<if test="dnbPrice != null">#{dnbPrice},</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="updateEmsBaseSharePrice" parameterType="EmsBaseSharePrice">
|
||||
update ems_base_share_price
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="yearMonthDate != null">year_month_date = #{yearMonthDate},</if>
|
||||
<if test="priceType != null">price_type = #{priceType},</if>
|
||||
<if test="startHour != null">start_hour = #{startHour},</if>
|
||||
<if test="endHour != null">end_hour = #{endHour},</if>
|
||||
<if test="dnbPrice != null">dnb_price = #{dnbPrice},</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 obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsBaseSharePriceByObjId" parameterType="Long">
|
||||
delete
|
||||
from ems_base_share_price
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsBaseSharePriceByObjIds" parameterType="String">
|
||||
delete from ems_base_share_price where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue