场外管道管理
This commit is contained in:
@ -0,0 +1,117 @@
|
||||
package com.sipai.controller.pipeline;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sipai.entity.pipeline.PipelineData;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.service.pipeline.PipelineDataService;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/pipeline/pipelineData")
|
||||
public class PipelineDataController {
|
||||
@Resource
|
||||
private PipelineDataService pipelineDataService;
|
||||
|
||||
@RequestMapping("/showList.do")
|
||||
public String showList(HttpServletRequest request, Model model) {
|
||||
return "/pipeline/pipelineDataList";
|
||||
}
|
||||
|
||||
@RequestMapping("/getList.do")
|
||||
public ModelAndView getList(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (sort == null || sort.equals("id")) {
|
||||
sort = " id ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " desc ";
|
||||
}
|
||||
String orderstr = " order by " + sort + " " + order;
|
||||
String wherestr = " where 1=1 ";
|
||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
||||
wherestr += " and pipeline_name like '%" + request.getParameter("search_name") + "%'";
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<PipelineData> list = this.pipelineDataService.selectListByWhere(wherestr + orderstr);
|
||||
PageInfo<PipelineData> pInfo = new PageInfo<PipelineData>(list);
|
||||
JSONArray jsonArray = JSONArray.fromObject(list);
|
||||
String result = "{\"total\":" + pInfo.getTotal() + ",\"rows\":" + jsonArray + "}";
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/add.do")
|
||||
public String doadd(HttpServletRequest request, Model model) {
|
||||
return "/pipeline/pipelineDataAdd";
|
||||
}
|
||||
|
||||
@RequestMapping("/save.do")
|
||||
public String dosave(HttpServletRequest request, Model model,
|
||||
@ModelAttribute PipelineData pipelineData) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
// pipelineData.setId(CommUtil.getUUID());
|
||||
int result = this.pipelineDataService.save(pipelineData);
|
||||
String resultstr = "{\"res\":\"" + result + "\",\"id\":\"" + pipelineData.getId() + "\"}";
|
||||
model.addAttribute("result", resultstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/delete.do")
|
||||
public String dodelete(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "id") String id) {
|
||||
int result = this.pipelineDataService.deleteById(id);
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/deletes.do")
|
||||
public String dodeletes(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "ids") String ids) {
|
||||
ids = ids.replace(",", "','");
|
||||
int result = this.pipelineDataService.deleteByWhere("where id in ('" + ids + "')");
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit.do")
|
||||
public String doedit(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "id") String id) {
|
||||
PipelineData pipelineData = this.pipelineDataService.selectById(id);
|
||||
model.addAttribute("pipelineData", pipelineData);
|
||||
return "/pipeline/pipelineDataEdit";
|
||||
}
|
||||
|
||||
@RequestMapping("/update.do")
|
||||
public String doupdate(HttpServletRequest request, Model model,
|
||||
@ModelAttribute PipelineData pipelineData) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
int result = this.pipelineDataService.update(pipelineData);
|
||||
String resstr = "{\"res\":\"" + result + "\",\"id\":\"" + pipelineData.getId() + "\"}";
|
||||
model.addAttribute("result", resstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/view.do")
|
||||
public String doview(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "id") String id) {
|
||||
PipelineData pipelineData = this.pipelineDataService.selectById(id);
|
||||
model.addAttribute("pipelineData", pipelineData);
|
||||
return "/pipeline/pipelineDataView";
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/sipai/dao/pipeline/PipelineDataDao.java
Normal file
13
src/main/java/com/sipai/dao/pipeline/PipelineDataDao.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.pipeline;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.pipeline.PipelineData;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class PipelineDataDao extends CommDaoImpl<PipelineData> {
|
||||
public PipelineDataDao() {
|
||||
super();
|
||||
this.setMappernamespace("pipeline.PipelineDataMapper");
|
||||
}
|
||||
}
|
||||
165
src/main/java/com/sipai/entity/pipeline/PipelineData.java
Normal file
165
src/main/java/com/sipai/entity/pipeline/PipelineData.java
Normal file
@ -0,0 +1,165 @@
|
||||
package com.sipai.entity.pipeline;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 管道数据实体类
|
||||
*/
|
||||
public class PipelineData extends SQLAdapter implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 自增主键ID,唯一标识每条记录
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 管道的名称、编号或位置描述
|
||||
*/
|
||||
@Column(name = "pipeline_name", length = 100)
|
||||
private String pipelineName;
|
||||
|
||||
/**
|
||||
* 管道的直径,通常指公称直径或内径,单位:毫米(mm)
|
||||
*/
|
||||
@Column(name = "diameter_mm", precision = 10, scale = 5)
|
||||
private BigDecimal diameterMm;
|
||||
|
||||
/**
|
||||
* 管道的实际铺设总长度,单位:米(m)
|
||||
*/
|
||||
@Column(name = "length_m", precision = 10, scale = 5)
|
||||
private BigDecimal lengthM;
|
||||
|
||||
/**
|
||||
* 管道起点处的埋设深度,从地面到管道顶部的垂直距离,单位:米(m)
|
||||
*/
|
||||
@Column(name = "start_burial_depth_m", precision = 10, scale = 5)
|
||||
private BigDecimal startBurialDepthM;
|
||||
|
||||
/**
|
||||
* 管道终点处的埋设深度,从地面到管道顶部的垂直距离,单位:米(m)
|
||||
*/
|
||||
@Column(name = "end_burial_depth_m", precision = 10, scale = 5)
|
||||
private BigDecimal endBurialDepthM;
|
||||
|
||||
/**
|
||||
* 管道起点处的地面高程(海拔或相对标高),单位:米(m)
|
||||
*/
|
||||
@Column(name = "start_ground_elevation_m", precision = 10, scale = 5)
|
||||
private BigDecimal startGroundElevationM;
|
||||
|
||||
/**
|
||||
* 管道终点处的地面高程(海拔或相对标高),单位:米(m)
|
||||
*/
|
||||
@Column(name = "end_ground_elevation_m", precision = 10, scale = 5)
|
||||
private BigDecimal endGroundElevationM;
|
||||
|
||||
/**
|
||||
* 管道内部底部的标高,常用于水力坡降计算,单位:米(m)
|
||||
*/
|
||||
@Column(name = "pipeline_invert_elevation_m", precision = 10, scale = 5)
|
||||
private BigDecimal pipelineInvertElevationM;
|
||||
|
||||
// 构造方法
|
||||
public PipelineData() {
|
||||
}
|
||||
|
||||
// Getters 和 Setters
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPipelineName() {
|
||||
return pipelineName;
|
||||
}
|
||||
|
||||
public void setPipelineName(String pipelineName) {
|
||||
this.pipelineName = pipelineName;
|
||||
}
|
||||
|
||||
public BigDecimal getDiameterMm() {
|
||||
return diameterMm;
|
||||
}
|
||||
|
||||
public void setDiameterMm(BigDecimal diameterMm) {
|
||||
this.diameterMm = diameterMm;
|
||||
}
|
||||
|
||||
public BigDecimal getLengthM() {
|
||||
return lengthM;
|
||||
}
|
||||
|
||||
public void setLengthM(BigDecimal lengthM) {
|
||||
this.lengthM = lengthM;
|
||||
}
|
||||
|
||||
public BigDecimal getStartBurialDepthM() {
|
||||
return startBurialDepthM;
|
||||
}
|
||||
|
||||
public void setStartBurialDepthM(BigDecimal startBurialDepthM) {
|
||||
this.startBurialDepthM = startBurialDepthM;
|
||||
}
|
||||
|
||||
public BigDecimal getEndBurialDepthM() {
|
||||
return endBurialDepthM;
|
||||
}
|
||||
|
||||
public void setEndBurialDepthM(BigDecimal endBurialDepthM) {
|
||||
this.endBurialDepthM = endBurialDepthM;
|
||||
}
|
||||
|
||||
public BigDecimal getStartGroundElevationM() {
|
||||
return startGroundElevationM;
|
||||
}
|
||||
|
||||
public void setStartGroundElevationM(BigDecimal startGroundElevationM) {
|
||||
this.startGroundElevationM = startGroundElevationM;
|
||||
}
|
||||
|
||||
public BigDecimal getEndGroundElevationM() {
|
||||
return endGroundElevationM;
|
||||
}
|
||||
|
||||
public void setEndGroundElevationM(BigDecimal endGroundElevationM) {
|
||||
this.endGroundElevationM = endGroundElevationM;
|
||||
}
|
||||
|
||||
public BigDecimal getPipelineInvertElevationM() {
|
||||
return pipelineInvertElevationM;
|
||||
}
|
||||
|
||||
public void setPipelineInvertElevationM(BigDecimal pipelineInvertElevationM) {
|
||||
this.pipelineInvertElevationM = pipelineInvertElevationM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PipelineData{" +
|
||||
"id=" + id +
|
||||
", pipelineName='" + pipelineName + '\'' +
|
||||
", diameterMm=" + diameterMm +
|
||||
", lengthM=" + lengthM +
|
||||
", startBurialDepthM=" + startBurialDepthM +
|
||||
", endBurialDepthM=" + endBurialDepthM +
|
||||
", startGroundElevationM=" + startGroundElevationM +
|
||||
", endGroundElevationM=" + endGroundElevationM +
|
||||
", pipelineInvertElevationM=" + pipelineInvertElevationM +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
153
src/main/java/com/sipai/mapper/pipeline/PipelineDataMapper.xml
Normal file
153
src/main/java/com/sipai/mapper/pipeline/PipelineDataMapper.xml
Normal file
@ -0,0 +1,153 @@
|
||||
<?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="pipeline.PipelineDataMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.pipeline.PipelineData" >
|
||||
<id column="id" property="id" jdbcType="BIGINT" />
|
||||
<result column="pipeline_name" property="pipelineName" jdbcType="VARCHAR" />
|
||||
<result column="diameter_mm" property="diameterMm" jdbcType="DECIMAL" />
|
||||
<result column="length_m" property="lengthM" jdbcType="DECIMAL" />
|
||||
<result column="start_burial_depth_m" property="startBurialDepthM" jdbcType="DECIMAL" />
|
||||
<result column="end_burial_depth_m" property="endBurialDepthM" jdbcType="DECIMAL" />
|
||||
<result column="start_ground_elevation_m" property="startGroundElevationM" jdbcType="DECIMAL" />
|
||||
<result column="end_ground_elevation_m" property="endGroundElevationM" jdbcType="DECIMAL" />
|
||||
<result column="pipeline_invert_elevation_m" property="pipelineInvertElevationM" jdbcType="DECIMAL" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List" >
|
||||
id, pipeline_name, diameter_mm, length_m, start_burial_depth_m, end_burial_depth_m,
|
||||
start_ground_elevation_m, end_ground_elevation_m, pipeline_invert_elevation_m
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from pipeline_data
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
||||
delete from pipeline_data
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sipai.entity.pipeline.PipelineData" >
|
||||
insert into pipeline_data (id, pipeline_name, diameter_mm,
|
||||
length_m, start_burial_depth_m, end_burial_depth_m,
|
||||
start_ground_elevation_m, end_ground_elevation_m,
|
||||
pipeline_invert_elevation_m)
|
||||
values (#{id,jdbcType=VARCHAR}, #{pipelineName,jdbcType=VARCHAR}, #{diameterMm,jdbcType=DECIMAL},
|
||||
#{lengthM,jdbcType=DECIMAL}, #{startBurialDepthM,jdbcType=DECIMAL}, #{endBurialDepthM,jdbcType=DECIMAL},
|
||||
#{startGroundElevationM,jdbcType=DECIMAL}, #{endGroundElevationM,jdbcType=DECIMAL},
|
||||
#{pipelineInvertElevationM,jdbcType=DECIMAL})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.pipeline.PipelineData" >
|
||||
insert into pipeline_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
id,
|
||||
</if>
|
||||
<if test="pipelineName != null" >
|
||||
pipeline_name,
|
||||
</if>
|
||||
<if test="diameterMm != null" >
|
||||
diameter_mm,
|
||||
</if>
|
||||
<if test="lengthM != null" >
|
||||
length_m,
|
||||
</if>
|
||||
<if test="startBurialDepthM != null" >
|
||||
start_burial_depth_m,
|
||||
</if>
|
||||
<if test="endBurialDepthM != null" >
|
||||
end_burial_depth_m,
|
||||
</if>
|
||||
<if test="startGroundElevationM != null" >
|
||||
start_ground_elevation_m,
|
||||
</if>
|
||||
<if test="endGroundElevationM != null" >
|
||||
end_ground_elevation_m,
|
||||
</if>
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
pipeline_invert_elevation_m,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pipelineName != null" >
|
||||
#{pipelineName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="diameterMm != null" >
|
||||
#{diameterMm,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lengthM != null" >
|
||||
#{lengthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="startBurialDepthM != null" >
|
||||
#{startBurialDepthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="endBurialDepthM != null" >
|
||||
#{endBurialDepthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="startGroundElevationM != null" >
|
||||
#{startGroundElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="endGroundElevationM != null" >
|
||||
#{endGroundElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
#{pipelineInvertElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.pipeline.PipelineData" >
|
||||
update pipeline_data
|
||||
<set >
|
||||
<if test="pipelineName != null" >
|
||||
pipeline_name = #{pipelineName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="diameterMm != null" >
|
||||
diameter_mm = #{diameterMm,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lengthM != null" >
|
||||
length_m = #{lengthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="startBurialDepthM != null" >
|
||||
start_burial_depth_m = #{startBurialDepthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="endBurialDepthM != null" >
|
||||
end_burial_depth_m = #{endBurialDepthM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="startGroundElevationM != null" >
|
||||
start_ground_elevation_m = #{startGroundElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="endGroundElevationM != null" >
|
||||
end_ground_elevation_m = #{endGroundElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.sipai.entity.pipeline.PipelineData" >
|
||||
update pipeline_data
|
||||
set pipeline_name = #{pipelineName,jdbcType=VARCHAR},
|
||||
diameter_mm = #{diameterMm,jdbcType=DECIMAL},
|
||||
length_m = #{lengthM,jdbcType=DECIMAL},
|
||||
start_burial_depth_m = #{startBurialDepthM,jdbcType=DECIMAL},
|
||||
end_burial_depth_m = #{endBurialDepthM,jdbcType=DECIMAL},
|
||||
start_ground_elevation_m = #{startGroundElevationM,jdbcType=DECIMAL},
|
||||
end_ground_elevation_m = #{endGroundElevationM,jdbcType=DECIMAL},
|
||||
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from pipeline_data
|
||||
${where}
|
||||
</select>
|
||||
<delete id="deleteByWhere" parameterType="java.lang.String">
|
||||
delete from
|
||||
pipeline_data
|
||||
${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,51 @@
|
||||
package com.sipai.service.pipeline;
|
||||
|
||||
import com.sipai.dao.pipeline.PipelineDataDao;
|
||||
import com.sipai.entity.pipeline.PipelineData;
|
||||
import com.sipai.tools.CommService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PipelineDataService implements CommService<PipelineData> {
|
||||
@Resource
|
||||
private PipelineDataDao pipelineDataDao;
|
||||
|
||||
@Override
|
||||
public PipelineData selectById(String id) {
|
||||
PipelineData pipelineData = pipelineDataDao.selectByPrimaryKey(id);
|
||||
return pipelineData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
return pipelineDataDao.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(PipelineData pipelineData) {
|
||||
return pipelineDataDao.insert(pipelineData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(PipelineData pipelineData) {
|
||||
return pipelineDataDao.updateByPrimaryKeySelective(pipelineData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineData> selectListByWhere(String wherestr) {
|
||||
PipelineData pipelineData = new PipelineData();
|
||||
pipelineData.setWhere(wherestr);
|
||||
List<PipelineData> list = pipelineDataDao.selectListByWhere(pipelineData);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByWhere(String wherestr) {
|
||||
PipelineData pipelineData = new PipelineData();
|
||||
pipelineData.setWhere(wherestr);
|
||||
return pipelineDataDao.deleteByWhere(pipelineData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user