change - add能源类型信息
parent
6a53dc3f7b
commit
adf9f82845
@ -0,0 +1,114 @@
|
||||
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.EmsBaseEnergyType;
|
||||
import com.os.ems.base.service.IEmsBaseEnergyTypeService;
|
||||
import com.os.common.utils.poi.ExcelUtil;
|
||||
import com.os.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 能源类型信息Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ems/base/baseEnergyType")
|
||||
public class EmsBaseEnergyTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
|
||||
|
||||
/**
|
||||
* 查询能源类型信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
startPage();
|
||||
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源类型信息下拉框列表
|
||||
*/
|
||||
@GetMapping("/baseEnergyTypeList")
|
||||
public AjaxResult baseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出能源类型信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:export')")
|
||||
@Log(title = "能源类型信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
|
||||
ExcelUtil<EmsBaseEnergyType> util = new ExcelUtil<EmsBaseEnergyType>(EmsBaseEnergyType.class);
|
||||
util.exportExcel(response, list, "能源类型信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取能源类型信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:query')")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId)
|
||||
{
|
||||
return success(emsBaseEnergyTypeService.selectEmsBaseEnergyTypeByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源类型信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:add')")
|
||||
@Log(title = "能源类型信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
return toAjax(emsBaseEnergyTypeService.insertEmsBaseEnergyType(emsBaseEnergyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源类型信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:edit')")
|
||||
@Log(title = "能源类型信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
return toAjax(emsBaseEnergyTypeService.updateEmsBaseEnergyType(emsBaseEnergyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能源类型信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems.base:baseEnergyType:remove')")
|
||||
@Log(title = "能源类型信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds)
|
||||
{
|
||||
return toAjax(emsBaseEnergyTypeService.deleteEmsBaseEnergyTypeByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
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_energy_type
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
public class EmsBaseEnergyType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 自增标识 */
|
||||
private Long objId;
|
||||
|
||||
/** 能源类型编号 */
|
||||
@Excel(name = "能源类型编号")
|
||||
private Long energyTypeId;
|
||||
|
||||
/** 能源类型名称 */
|
||||
@Excel(name = "能源类型名称")
|
||||
private String energyName;
|
||||
|
||||
/** 单位 */
|
||||
@Excel(name = "单位")
|
||||
private String measureUnit;
|
||||
|
||||
/** 单价 */
|
||||
@Excel(name = "单价")
|
||||
private BigDecimal price;
|
||||
|
||||
public void setObjId(Long objId)
|
||||
{
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return objId;
|
||||
}
|
||||
public void setEnergyTypeId(Long energyTypeId)
|
||||
{
|
||||
this.energyTypeId = energyTypeId;
|
||||
}
|
||||
|
||||
public Long getEnergyTypeId()
|
||||
{
|
||||
return energyTypeId;
|
||||
}
|
||||
public void setEnergyName(String energyName)
|
||||
{
|
||||
this.energyName = energyName;
|
||||
}
|
||||
|
||||
public String getEnergyName()
|
||||
{
|
||||
return energyName;
|
||||
}
|
||||
public void setMeasureUnit(String measureUnit)
|
||||
{
|
||||
this.measureUnit = measureUnit;
|
||||
}
|
||||
|
||||
public String getMeasureUnit()
|
||||
{
|
||||
return measureUnit;
|
||||
}
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("objId", getObjId())
|
||||
.append("energyTypeId", getEnergyTypeId())
|
||||
.append("energyName", getEnergyName())
|
||||
.append("measureUnit", getMeasureUnit())
|
||||
.append("price", getPrice())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.ems.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.ems.base.domain.EmsBaseEnergyType;
|
||||
|
||||
/**
|
||||
* 能源类型信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
public interface EmsBaseEnergyTypeMapper
|
||||
{
|
||||
/**
|
||||
* 查询能源类型信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 能源类型信息
|
||||
*/
|
||||
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询能源类型信息列表
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 能源类型信息集合
|
||||
*/
|
||||
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 新增能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 修改能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 删除能源类型信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseEnergyTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除能源类型信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.ems.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.ems.base.domain.EmsBaseEnergyType;
|
||||
|
||||
/**
|
||||
* 能源类型信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
public interface IEmsBaseEnergyTypeService
|
||||
{
|
||||
/**
|
||||
* 查询能源类型信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 能源类型信息
|
||||
*/
|
||||
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询能源类型信息列表
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 能源类型信息集合
|
||||
*/
|
||||
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 新增能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 修改能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
|
||||
|
||||
/**
|
||||
* 批量删除能源类型信息
|
||||
*
|
||||
* @param objIds 需要删除的能源类型信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除能源类型信息信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseEnergyTypeByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
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.EmsBaseEnergyTypeMapper;
|
||||
import com.os.ems.base.domain.EmsBaseEnergyType;
|
||||
import com.os.ems.base.service.IEmsBaseEnergyTypeService;
|
||||
|
||||
/**
|
||||
* 能源类型信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Service
|
||||
public class EmsBaseEnergyTypeServiceImpl implements IEmsBaseEnergyTypeService
|
||||
{
|
||||
@Autowired
|
||||
private EmsBaseEnergyTypeMapper emsBaseEnergyTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询能源类型信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 能源类型信息
|
||||
*/
|
||||
@Override
|
||||
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId)
|
||||
{
|
||||
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源类型信息列表
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 能源类型信息
|
||||
*/
|
||||
@Override
|
||||
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
emsBaseEnergyType.setCreateTime(DateUtils.getNowDate());
|
||||
return emsBaseEnergyTypeMapper.insertEmsBaseEnergyType(emsBaseEnergyType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源类型信息
|
||||
*
|
||||
* @param emsBaseEnergyType 能源类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
|
||||
{
|
||||
emsBaseEnergyType.setUpdateTime(DateUtils.getNowDate());
|
||||
return emsBaseEnergyTypeMapper.updateEmsBaseEnergyType(emsBaseEnergyType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除能源类型信息
|
||||
*
|
||||
* @param objIds 需要删除的能源类型信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds)
|
||||
{
|
||||
return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能源类型信息信息
|
||||
*
|
||||
* @param objId 能源类型信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsBaseEnergyTypeByObjId(Long objId)
|
||||
{
|
||||
return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
<?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.EmsBaseEnergyTypeMapper">
|
||||
|
||||
<resultMap type="EmsBaseEnergyType" id="EmsBaseEnergyTypeResult">
|
||||
<result property="objId" column="obj_id" />
|
||||
<result property="energyTypeId" column="energy_type_id" />
|
||||
<result property="energyName" column="energy_name" />
|
||||
<result property="measureUnit" column="measure_unit" />
|
||||
<result property="price" column="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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsBaseEnergyTypeVo">
|
||||
select obj_id, energy_type_id, energy_name, measure_unit, price, create_by, create_time, update_by, update_time from ems_base_energy_type
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsBaseEnergyTypeList" parameterType="EmsBaseEnergyType" resultMap="EmsBaseEnergyTypeResult">
|
||||
<include refid="selectEmsBaseEnergyTypeVo"/>
|
||||
<where>
|
||||
<if test="energyTypeId != null "> and energy_type_id = #{energyTypeId}</if>
|
||||
<if test="energyName != null and energyName != ''"> and energy_name like concat('%', #{energyName}, '%')</if>
|
||||
<if test="measureUnit != null and measureUnit != ''"> and measure_unit = #{measureUnit}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsBaseEnergyTypeByObjId" parameterType="Long" resultMap="EmsBaseEnergyTypeResult">
|
||||
<include refid="selectEmsBaseEnergyTypeVo"/>
|
||||
where obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsBaseEnergyType" parameterType="EmsBaseEnergyType" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into ems_base_energy_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="energyTypeId != null">energy_type_id,</if>
|
||||
<if test="energyName != null">energy_name,</if>
|
||||
<if test="measureUnit != null">measure_unit,</if>
|
||||
<if test="price != null">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>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="energyTypeId != null">#{energyTypeId},</if>
|
||||
<if test="energyName != null">#{energyName},</if>
|
||||
<if test="measureUnit != null">#{measureUnit},</if>
|
||||
<if test="price != null">#{price},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsBaseEnergyType" parameterType="EmsBaseEnergyType">
|
||||
update ems_base_energy_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="energyTypeId != null">energy_type_id = #{energyTypeId},</if>
|
||||
<if test="energyName != null">energy_name = #{energyName},</if>
|
||||
<if test="measureUnit != null">measure_unit = #{measureUnit},</if>
|
||||
<if test="price != null">price = #{price},</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>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsBaseEnergyTypeByObjId" parameterType="Long">
|
||||
delete from ems_base_energy_type where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsBaseEnergyTypeByObjIds" parameterType="String">
|
||||
delete from ems_base_energy_type where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue