xiao547607 пре 4 година
родитељ
комит
ed5627bae4

+ 19 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/StationSubInfoDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.bus.modules.bus.dao;
+
+import java.util.List;
+
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import org.springframework.stereotype.Repository;
+import java.util.Map;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+@Repository
+public interface StationSubInfoDAO {
+	int insert(StationSubInfo entity);
+	int update(StationSubInfo entity);
+	int exist(String id);
+	StationSubInfo get(String id);
+	int delete(String id);
+	List<StationSubInfo> list();
+	List<StationSubInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

+ 45 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/StationSubInfo.java

@@ -0,0 +1,45 @@
+package com.jpsoft.bus.modules.bus.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:bus_station_sub_info的实体类
+ */
+@Data
+@ApiModel(value = "bus_station_sub_info的实体类")
+public class StationSubInfo {
+        @ApiModelProperty(value = "")
+    private String id;
+        @ApiModelProperty(value = "对应站点id")
+    private String stationId;
+        @ApiModelProperty(value = "开始站点id")
+    private String startStationId;
+        @ApiModelProperty(value = "终点站点id")
+    private String endStationId;
+        @ApiModelProperty(value = "经度")
+    private BigDecimal longitude;
+        @ApiModelProperty(value = "纬度")
+    private BigDecimal latitude;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+        @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/StationSubInfoService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.bus.modules.bus.service;
+
+import java.util.List;
+import java.util.Map;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+public interface StationSubInfoService {
+	StationSubInfo get(String id);
+	boolean exist(String id);
+	int insert(StationSubInfo model);
+	int update(StationSubInfo model);
+	int delete(String id);
+	List<StationSubInfo> list();
+	Page<StationSubInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+}

+ 71 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/StationSubInfoServiceImpl.java

@@ -0,0 +1,71 @@
+package com.jpsoft.bus.modules.bus.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+
+import com.jpsoft.bus.modules.bus.dao.StationSubInfoDAO;
+import com.jpsoft.bus.modules.bus.entity.StationSubInfo;
+import com.jpsoft.bus.modules.bus.service.StationSubInfoService;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="stationSubInfoService")
+public class StationSubInfoServiceImpl implements StationSubInfoService {
+	@Resource(name="stationSubInfoDAO")
+	private StationSubInfoDAO stationSubInfoDAO;
+
+	@Override
+	public StationSubInfo get(String id) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(StationSubInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return stationSubInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(StationSubInfo model) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = stationSubInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<StationSubInfo> list() {
+		// TODO Auto-generated method stub
+		return stationSubInfoDAO.list();
+	}
+		
+	@Override
+	public Page<StationSubInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<StationSubInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            stationSubInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 106 - 0
common/src/main/resources/mapper/bus/StationSubInfo.xml

@@ -0,0 +1,106 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.bus.modules.bus.dao.StationSubInfoDAO">
+	<resultMap id="StationSubInfoMap" type="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+		<id property="id" column="id_" />
+			<result property="stationId" column="station_id" />
+			<result property="startStationId" column="start_station_id" />
+			<result property="endStationId" column="end_station_id" />
+			<result property="longitude" column="longitude_" />
+			<result property="latitude" column="latitude_" />
+			<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="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into bus_station_sub_info
+	    (id_,station_id,start_station_id,end_station_id,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{stationId,jdbcType=VARCHAR}
+,#{startStationId,jdbcType=VARCHAR}
+,#{endStationId,jdbcType=VARCHAR}
+,#{longitude,jdbcType= NUMERIC }
+,#{latitude,jdbcType= NUMERIC }
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from bus_station_sub_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.StationSubInfo">
+		update bus_station_sub_info
+		<set>
+				<if test="stationId!=null">
+		station_id=#{stationId,jdbcType=VARCHAR},
+		</if>
+				<if test="startStationId!=null">
+		start_station_id=#{startStationId,jdbcType=VARCHAR},
+		</if>
+				<if test="endStationId!=null">
+		end_station_id=#{endStationId,jdbcType=VARCHAR},
+		</if>
+				<if test="longitude!=null">
+		longitude_=#{longitude,jdbcType= NUMERIC },
+		</if>
+				<if test="latitude!=null">
+		latitude_=#{latitude,jdbcType= NUMERIC },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="StationSubInfoMap">
+		select 
+id_,station_id,start_station_id,end_station_id,longitude_,latitude_,create_by,create_time,update_by,update_time,del_flag		from bus_station_sub_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from bus_station_sub_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="StationSubInfoMap">
+		select * from bus_station_sub_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="StationSubInfoMap">
+		<![CDATA[
+			select * from bus_station_sub_info
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>