change - add能源类型信息

main
yinq 7 months ago
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…
Cancel
Save