作者 王勇

数据库要添加字段,再做备份

@@ -2,11 +2,9 @@ package com.sunyo.wlpt.station.manage.domain; @@ -2,11 +2,9 @@ package com.sunyo.wlpt.station.manage.domain;
2 2
3 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 -  
6 import java.io.Serializable; 5 import java.io.Serializable;
7 import java.math.BigDecimal; 6 import java.math.BigDecimal;
8 import java.util.Date; 7 import java.util.Date;
9 -  
10 import lombok.AllArgsConstructor; 8 import lombok.AllArgsConstructor;
11 import lombok.Builder; 9 import lombok.Builder;
12 import lombok.Data; 10 import lombok.Data;
@@ -14,8 +12,8 @@ import lombok.NoArgsConstructor; @@ -14,8 +12,8 @@ import lombok.NoArgsConstructor;
14 12
15 /** 13 /**
16 * @author 子诚 14 * @author 子诚
17 - * Description:仓库静态资源表  
18 - * 时间:2020/10/12 12:00 15 + * Description:
  16 + * 时间:2020/10/13 10:39
19 */ 17 */
20 @ApiModel(value = "仓库静态资源表") 18 @ApiModel(value = "仓库静态资源表")
21 @Data 19 @Data
@@ -24,8 +22,7 @@ import lombok.NoArgsConstructor; @@ -24,8 +22,7 @@ import lombok.NoArgsConstructor;
24 @NoArgsConstructor 22 @NoArgsConstructor
25 public class Warehouse implements Serializable { 23 public class Warehouse implements Serializable {
26 24
27 - private static final long serialVersionUID = 7237627901812899555L;  
28 - 25 + private static final long serialVersionUID = 1224656100260220596L;
29 /** 26 /**
30 * ID 27 * ID
31 */ 28 */
@@ -51,22 +48,28 @@ public class Warehouse implements Serializable { @@ -51,22 +48,28 @@ public class Warehouse implements Serializable {
51 private String name; 48 private String name;
52 49
53 /** 50 /**
  51 + * 仓库类型:001:进港仓库;002:出港仓库;003:监管仓库;004:危险品仓库
  52 + */
  53 + @ApiModelProperty(value = "仓库类型:001:进港仓库;002:出港仓库;003:查验仓库;004:危险品仓库")
  54 + private String warehouseType;
  55 +
  56 + /**
54 * 仓库长度 57 * 仓库长度
55 */ 58 */
56 @ApiModelProperty(value = "仓库长度") 59 @ApiModelProperty(value = "仓库长度")
57 - private BigDecimal length; 60 + private BigDecimal warehouseLength;
58 61
59 /** 62 /**
60 * 仓库宽度 63 * 仓库宽度
61 */ 64 */
62 @ApiModelProperty(value = "仓库宽度") 65 @ApiModelProperty(value = "仓库宽度")
63 - private BigDecimal width; 66 + private BigDecimal warehouseWidth;
64 67
65 /** 68 /**
66 * 仓库面积 69 * 仓库面积
67 */ 70 */
68 @ApiModelProperty(value = "仓库面积") 71 @ApiModelProperty(value = "仓库面积")
69 - private BigDecimal area; 72 + private BigDecimal warehouseArea;
70 73
71 /** 74 /**
72 * 创建者 75 * 创建者
1 package com.sunyo.wlpt.station.manage.mapper; 1 package com.sunyo.wlpt.station.manage.mapper;
2 2
3 import com.sunyo.wlpt.station.manage.domain.Warehouse; 3 import com.sunyo.wlpt.station.manage.domain.Warehouse;
4 -import org.apache.ibatis.annotations.Mapper;  
5 -  
6 -import java.util.List; 4 +import org.apache.ibatis.annotations.Mapper;import java.util.List;
7 5
8 /** 6 /**
9 * @author 子诚 7 * @author 子诚
10 * Description: 8 * Description:
11 - * 时间:2020/10/12 12:00 9 + * 时间:2020/10/13 10:39
12 */ 10 */
13 @Mapper 11 @Mapper
14 public interface WarehouseMapper { 12 public interface WarehouseMapper {
@@ -68,3 +68,4 @@ public interface WarehouseService { @@ -68,3 +68,4 @@ public interface WarehouseService {
68 */ 68 */
69 ResultJson selectListByPage(Warehouse warehouse, Integer pageNum, Integer pageSize); 69 ResultJson selectListByPage(Warehouse warehouse, Integer pageNum, Integer pageSize);
70 } 70 }
  71 +
@@ -58,8 +58,8 @@ public class BayonetServiceImpl implements BayonetService { @@ -58,8 +58,8 @@ public class BayonetServiceImpl implements BayonetService {
58 @Override 58 @Override
59 public ResultJson insertSelective(Bayonet bayonet) 59 public ResultJson insertSelective(Bayonet bayonet)
60 { 60 {
61 - Yard yard = yardMapper.selectByYardName(bayonet.getStationName());  
62 - bayonet.setYardId(yard.getId()); 61 +// Yard yard = yardMapper.selectByYardName(bayonet.getStationName());
  62 +// bayonet.setYardId(yard.getId());
63 bayonet.setId(IdUtils.generateId()); 63 bayonet.setId(IdUtils.generateId());
64 return bayonetMapper.insertSelective(bayonet) > 0 64 return bayonetMapper.insertSelective(bayonet) > 0
65 ? ResultJson.success("200", "新增卡口信息,成功") 65 ? ResultJson.success("200", "新增卡口信息,成功")
@@ -81,8 +81,8 @@ public class BayonetServiceImpl implements BayonetService { @@ -81,8 +81,8 @@ public class BayonetServiceImpl implements BayonetService {
81 @Override 81 @Override
82 public ResultJson updateByPrimaryKeySelective(Bayonet bayonet) 82 public ResultJson updateByPrimaryKeySelective(Bayonet bayonet)
83 { 83 {
84 - Yard yard = yardMapper.selectByYardName(bayonet.getStationName());  
85 - bayonet.setYardId(yard.getId()); 84 +// Yard yard = yardMapper.selectByYardName(bayonet.getStationName());
  85 +// bayonet.setYardId(yard.getId());
86 return bayonetMapper.updateByPrimaryKeySelective(bayonet) > 0 86 return bayonetMapper.updateByPrimaryKeySelective(bayonet) > 0
87 ? ResultJson.success("200", "编辑卡口信息,成功") 87 ? ResultJson.success("200", "编辑卡口信息,成功")
88 : ResultJson.error("500", "编辑卡口信息,失败"); 88 : ResultJson.error("500", "编辑卡口信息,失败");
@@ -108,9 +108,9 @@ public class BayonetServiceImpl implements BayonetService { @@ -108,9 +108,9 @@ public class BayonetServiceImpl implements BayonetService {
108 PageHelper.startPage(pageNum, pageSize); 108 PageHelper.startPage(pageNum, pageSize);
109 List<Bayonet> bayonetList = bayonetMapper.selectListByPage(bayonet); 109 List<Bayonet> bayonetList = bayonetMapper.selectListByPage(bayonet);
110 110
111 - bayonetList.stream().parallel().forEach(item -> {  
112 - item.setStationName(yardMapper.selectByPrimaryKey(item.getYardId()).getName());  
113 - }); 111 +// bayonetList.stream().parallel().forEach(item -> {
  112 +// item.setStationName(yardMapper.selectByPrimaryKey(item.getYardId()).getName());
  113 +// });
114 114
115 PageInfo<Bayonet> pageInfo = new PageInfo<>(bayonetList); 115 PageInfo<Bayonet> pageInfo = new PageInfo<>(bayonetList);
116 return pageInfo.getTotal() >= 0 116 return pageInfo.getTotal() >= 0
@@ -2,8 +2,10 @@ package com.sunyo.wlpt.station.manage.service.impl; @@ -2,8 +2,10 @@ package com.sunyo.wlpt.station.manage.service.impl;
2 2
3 import com.github.pagehelper.PageHelper; 3 import com.github.pagehelper.PageHelper;
4 import com.github.pagehelper.PageInfo; 4 import com.github.pagehelper.PageInfo;
  5 +import com.github.pagehelper.util.StringUtil;
5 import com.sunyo.wlpt.station.manage.domain.Bayonet; 6 import com.sunyo.wlpt.station.manage.domain.Bayonet;
6 import com.sunyo.wlpt.station.manage.response.ResultJson; 7 import com.sunyo.wlpt.station.manage.response.ResultJson;
  8 +import com.sunyo.wlpt.station.manage.utils.BigDecimalUtil;
7 import com.sunyo.wlpt.station.manage.utils.IdUtils; 9 import com.sunyo.wlpt.station.manage.utils.IdUtils;
8 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
9 11
@@ -12,7 +14,9 @@ import javax.annotation.Resource; @@ -12,7 +14,9 @@ import javax.annotation.Resource;
12 import com.sunyo.wlpt.station.manage.domain.Warehouse; 14 import com.sunyo.wlpt.station.manage.domain.Warehouse;
13 import com.sunyo.wlpt.station.manage.mapper.WarehouseMapper; 15 import com.sunyo.wlpt.station.manage.mapper.WarehouseMapper;
14 import com.sunyo.wlpt.station.manage.service.WarehouseService; 16 import com.sunyo.wlpt.station.manage.service.WarehouseService;
  17 +import org.springframework.util.StringUtils;
15 18
  19 +import java.math.BigDecimal;
16 import java.util.List; 20 import java.util.List;
17 21
18 /** 22 /**
@@ -56,6 +60,13 @@ public class WarehouseServiceImpl implements WarehouseService { @@ -56,6 +60,13 @@ public class WarehouseServiceImpl implements WarehouseService {
56 public ResultJson insertSelective(Warehouse warehouse) 60 public ResultJson insertSelective(Warehouse warehouse)
57 { 61 {
58 warehouse.setId(IdUtils.generateId()); 62 warehouse.setId(IdUtils.generateId());
  63 + BigDecimal warehouseLength = warehouse.getWarehouseLength();
  64 + BigDecimal warehouseWidth = warehouse.getWarehouseWidth();
  65 + if (StringUtils.isEmpty(warehouseLength) || StringUtils.isEmpty(warehouseWidth)) {
  66 + return ResultJson.error("400", "仓库长度与仓库宽度,不能为空!");
  67 + }
  68 +
  69 + warehouse.setWarehouseArea(BigDecimalUtil.mul(warehouseLength, warehouseWidth));
59 return warehouseMapper.insertSelective(warehouse) > 0 70 return warehouseMapper.insertSelective(warehouse) > 0
60 ? ResultJson.success("200", "增加仓库信息,成功") 71 ? ResultJson.success("200", "增加仓库信息,成功")
61 : ResultJson.error("500", "增加仓库信息,失败"); 72 : ResultJson.error("500", "增加仓库信息,失败");
@@ -106,3 +117,4 @@ public class WarehouseServiceImpl implements WarehouseService { @@ -106,3 +117,4 @@ public class WarehouseServiceImpl implements WarehouseService {
106 : ResultJson.error("500", "查询仓库信息列表,失败!"); 117 : ResultJson.error("500", "查询仓库信息列表,失败!");
107 } 118 }
108 } 119 }
  120 +
  1 +package com.sunyo.wlpt.station.manage.utils;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +/**
  6 + * @author 子诚
  7 + * Description:BigDecimal的简单加减乘除工具类
  8 + * <p>
  9 + * 可将double类型转成BigDecimal类型;
  10 + * BigDecimal b1 = new BigDecimal(Double.toString(v1));
  11 + * <p>
  12 + * 时间:2020/10/13 10:59
  13 + */
  14 +public class BigDecimalUtil {
  15 +
  16 + /**
  17 + * 私有构造方法
  18 + */
  19 + private BigDecimalUtil()
  20 + {
  21 +
  22 + }
  23 +
  24 + /**
  25 + * 加法
  26 + *
  27 + * @param v1 参数一
  28 + * @param v2 参数二
  29 + * @return
  30 + */
  31 + public static BigDecimal add(BigDecimal v1, BigDecimal v2)
  32 + {
  33 + return v1.add(v1);
  34 + }
  35 +
  36 + /**
  37 + * 减法
  38 + *
  39 + * @param v1 参数一
  40 + * @param v2 参数二
  41 + * @return
  42 + */
  43 + public static BigDecimal sub(BigDecimal v1, BigDecimal v2)
  44 + {
  45 + return v1.subtract(v2);
  46 + }
  47 +
  48 + /**
  49 + * 乘法
  50 + *
  51 + * @param v1 参数一
  52 + * @param v2 参数二
  53 + * @return
  54 + */
  55 + public static BigDecimal mul(BigDecimal v1, BigDecimal v2)
  56 + {
  57 + return v1.multiply(v2);
  58 + }
  59 +
  60 + /**
  61 + * 乘法
  62 + *
  63 + * @param v1 参数一
  64 + * @param v2 参数二
  65 + * @return
  66 + */
  67 + public static BigDecimal div(BigDecimal v1, BigDecimal v2)
  68 + {
  69 + //四舍五入,保留2位小数
  70 + return v1.divide(v2, 2, BigDecimal.ROUND_HALF_UP);
  71 + //除不尽的情况
  72 + }
  73 +
  74 +
  75 + public static BigDecimal add(double v1,double v2){
  76 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  77 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  78 + return b1.add(b2);
  79 + }
  80 +
  81 + public static BigDecimal sub(double v1,double v2){
  82 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  83 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  84 + return b1.subtract(b2);
  85 + }
  86 +
  87 +
  88 + public static BigDecimal mul(double v1,double v2){
  89 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  90 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  91 + return b1.multiply(b2);
  92 + }
  93 +
  94 + public static BigDecimal div(double v1,double v2){
  95 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  96 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  97 + return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP);//四舍五入,保留2位小数
  98 +
  99 + //除不尽的情况
  100 + }
  101 +
  102 +}
@@ -8,9 +8,10 @@ @@ -8,9 +8,10 @@
8 <result column="yard_id" jdbcType="VARCHAR" property="yardId"/> 8 <result column="yard_id" jdbcType="VARCHAR" property="yardId"/>
9 <result column="cop_code" jdbcType="VARCHAR" property="copCode"/> 9 <result column="cop_code" jdbcType="VARCHAR" property="copCode"/>
10 <result column="name" jdbcType="VARCHAR" property="name"/> 10 <result column="name" jdbcType="VARCHAR" property="name"/>
11 - <result column="length" jdbcType="DECIMAL" property="length"/>  
12 - <result column="width" jdbcType="DECIMAL" property="width"/>  
13 - <result column="area" jdbcType="DECIMAL" property="area"/> 11 + <result column="warehouse_type" jdbcType="VARCHAR" property="warehouseType"/>
  12 + <result column="warehouse_length" jdbcType="DECIMAL" property="warehouseLength"/>
  13 + <result column="warehouse_width" jdbcType="DECIMAL" property="warehouseWidth"/>
  14 + <result column="warehouse_area" jdbcType="DECIMAL" property="warehouseArea"/>
14 <result column="create_by" jdbcType="VARCHAR" property="createBy"/> 15 <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
15 <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> 16 <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
16 <result column="update_by" jdbcType="VARCHAR" property="updateBy"/> 17 <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
@@ -18,19 +19,10 @@ @@ -18,19 +19,10 @@
18 <result column="remarks" jdbcType="VARCHAR" property="remarks"/> 19 <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
19 <result column="del_flag" jdbcType="CHAR" property="delFlag"/> 20 <result column="del_flag" jdbcType="CHAR" property="delFlag"/>
20 </resultMap> 21 </resultMap>
21 -  
22 - <!-- 该Mapper映射关系的作用,是仓库与场站的1:1的关系映射 -->  
23 - <resultMap id="WarehouseAndYardMap" extends="BaseResultMap"  
24 - type="com.sunyo.wlpt.station.manage.domain.Warehouse">  
25 - <association property="yard" javaType="com.sunyo.wlpt.station.manage.domain.Yard">  
26 - <id column="id" property="id"/>  
27 - <result column="yard_name" property="name"/>  
28 - </association>  
29 - </resultMap>  
30 <sql id="Base_Column_List"> 22 <sql id="Base_Column_List">
31 <!--@mbg.generated--> 23 <!--@mbg.generated-->
32 - id, yard_id, cop_code, `name`, `length`, width, area, create_by, create_date, update_by,  
33 - update_date, remarks, del_flag 24 + id, yard_id, cop_code, `name`, warehouse_type, warehouse_length, warehouse_width, warehouse_area,
  25 + create_by, create_date, update_by, update_date, remarks, del_flag
34 </sql> 26 </sql>
35 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> 27 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
36 <!--@mbg.generated--> 28 <!--@mbg.generated-->
@@ -39,38 +31,6 @@ @@ -39,38 +31,6 @@
39 from warehouse 31 from warehouse
40 where id = #{id,jdbcType=VARCHAR} 32 where id = #{id,jdbcType=VARCHAR}
41 </select> 33 </select>
42 -  
43 - <!-- 分页查询 -->  
44 - <select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse" resultMap="WarehouseAndYardMap">  
45 - select w.id,  
46 - w.yard_id,  
47 - w.cop_code,  
48 - w.name,  
49 - w.length,  
50 - w.width,  
51 - w.area,  
52 - w.create_by,  
53 - w.create_date,  
54 - w.update_by,  
55 - w.update_date,  
56 - w.remarks,  
57 - w.del_flag,  
58 - y.name as yard_name  
59 - from warehouse w,  
60 - yard y  
61 - <where>  
62 - <!-- name,仓库名称 -->  
63 - <if test="name != null and name != ''">  
64 - and w.name = #{name,jdbcType=VARCHAR}  
65 - </if>  
66 - <!-- stationName,货站名称 -->  
67 - <if test="stationName != null and stationName != ''">  
68 - and y.name = #{stationName,jdbcType=VARCHAR}  
69 - </if>  
70 - and w.yard_id = y.id  
71 - </where>  
72 - </select>  
73 -  
74 <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> 34 <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
75 <!--@mbg.generated--> 35 <!--@mbg.generated-->
76 delete 36 delete
@@ -80,15 +40,15 @@ @@ -80,15 +40,15 @@
80 <insert id="insert" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> 40 <insert id="insert" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse">
81 <!--@mbg.generated--> 41 <!--@mbg.generated-->
82 insert into warehouse (id, yard_id, cop_code, 42 insert into warehouse (id, yard_id, cop_code,
83 - `name`, `length`, width,  
84 - area, create_by, create_date,  
85 - update_by, update_date, remarks,  
86 - del_flag) 43 + `name`, warehouse_type, warehouse_length,
  44 + warehouse_width, warehouse_area, create_by,
  45 + create_date, update_by, update_date,
  46 + remarks, del_flag)
87 values (#{id,jdbcType=VARCHAR}, #{yardId,jdbcType=VARCHAR}, #{copCode,jdbcType=VARCHAR}, 47 values (#{id,jdbcType=VARCHAR}, #{yardId,jdbcType=VARCHAR}, #{copCode,jdbcType=VARCHAR},
88 - #{name,jdbcType=VARCHAR}, #{length,jdbcType=DECIMAL}, #{width,jdbcType=DECIMAL},  
89 - #{area,jdbcType=DECIMAL}, #{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP},  
90 - #{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},  
91 - #{delFlag,jdbcType=CHAR}) 48 + #{name,jdbcType=VARCHAR}, #{warehouseType,jdbcType=VARCHAR}, #{warehouseLength,jdbcType=DECIMAL},
  49 + #{warehouseWidth,jdbcType=DECIMAL}, #{warehouseArea,jdbcType=DECIMAL}, #{createBy,jdbcType=VARCHAR},
  50 + #{createDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP},
  51 + #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR})
92 </insert> 52 </insert>
93 <insert id="insertSelective" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> 53 <insert id="insertSelective" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse">
94 <!--@mbg.generated--> 54 <!--@mbg.generated-->
@@ -106,14 +66,17 @@ @@ -106,14 +66,17 @@
106 <if test="name != null"> 66 <if test="name != null">
107 `name`, 67 `name`,
108 </if> 68 </if>
109 - <if test="length != null">  
110 - `length`, 69 + <if test="warehouseType != null">
  70 + warehouse_type,
111 </if> 71 </if>
112 - <if test="width != null">  
113 - width, 72 + <if test="warehouseLength != null">
  73 + warehouse_length,
114 </if> 74 </if>
115 - <if test="area != null">  
116 - area, 75 + <if test="warehouseWidth != null">
  76 + warehouse_width,
  77 + </if>
  78 + <if test="warehouseArea != null">
  79 + warehouse_area,
117 </if> 80 </if>
118 <if test="createBy != null"> 81 <if test="createBy != null">
119 create_by, 82 create_by,
@@ -147,14 +110,17 @@ @@ -147,14 +110,17 @@
147 <if test="name != null"> 110 <if test="name != null">
148 #{name,jdbcType=VARCHAR}, 111 #{name,jdbcType=VARCHAR},
149 </if> 112 </if>
150 - <if test="length != null">  
151 - #{length,jdbcType=DECIMAL}, 113 + <if test="warehouseType != null">
  114 + #{warehouseType,jdbcType=VARCHAR},
  115 + </if>
  116 + <if test="warehouseLength != null">
  117 + #{warehouseLength,jdbcType=DECIMAL},
152 </if> 118 </if>
153 - <if test="width != null">  
154 - #{width,jdbcType=DECIMAL}, 119 + <if test="warehouseWidth != null">
  120 + #{warehouseWidth,jdbcType=DECIMAL},
155 </if> 121 </if>
156 - <if test="area != null">  
157 - #{area,jdbcType=DECIMAL}, 122 + <if test="warehouseArea != null">
  123 + #{warehouseArea,jdbcType=DECIMAL},
158 </if> 124 </if>
159 <if test="createBy != null"> 125 <if test="createBy != null">
160 #{createBy,jdbcType=VARCHAR}, 126 #{createBy,jdbcType=VARCHAR},
@@ -189,14 +155,17 @@ @@ -189,14 +155,17 @@
189 <if test="name != null"> 155 <if test="name != null">
190 `name` = #{name,jdbcType=VARCHAR}, 156 `name` = #{name,jdbcType=VARCHAR},
191 </if> 157 </if>
192 - <if test="length != null">  
193 - `length` = #{length,jdbcType=DECIMAL}, 158 + <if test="warehouseType != null">
  159 + warehouse_type = #{warehouseType,jdbcType=VARCHAR},
194 </if> 160 </if>
195 - <if test="width != null">  
196 - width = #{width,jdbcType=DECIMAL}, 161 + <if test="warehouseLength != null">
  162 + warehouse_length = #{warehouseLength,jdbcType=DECIMAL},
197 </if> 163 </if>
198 - <if test="area != null">  
199 - area = #{area,jdbcType=DECIMAL}, 164 + <if test="warehouseWidth != null">
  165 + warehouse_width = #{warehouseWidth,jdbcType=DECIMAL},
  166 + </if>
  167 + <if test="warehouseArea != null">
  168 + warehouse_area = #{warehouseArea,jdbcType=DECIMAL},
200 </if> 169 </if>
201 <if test="createBy != null"> 170 <if test="createBy != null">
202 create_by = #{createBy,jdbcType=VARCHAR}, 171 create_by = #{createBy,jdbcType=VARCHAR},
@@ -222,18 +191,59 @@ @@ -222,18 +191,59 @@
222 <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse"> 191 <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse">
223 <!--@mbg.generated--> 192 <!--@mbg.generated-->
224 update warehouse 193 update warehouse
225 - set yard_id = #{yardId,jdbcType=VARCHAR},  
226 - cop_code = #{copCode,jdbcType=VARCHAR},  
227 - `name` = #{name,jdbcType=VARCHAR},  
228 - `length` = #{length,jdbcType=DECIMAL},  
229 - width = #{width,jdbcType=DECIMAL},  
230 - area = #{area,jdbcType=DECIMAL},  
231 - create_by = #{createBy,jdbcType=VARCHAR},  
232 - create_date = #{createDate,jdbcType=TIMESTAMP},  
233 - update_by = #{updateBy,jdbcType=VARCHAR},  
234 - update_date = #{updateDate,jdbcType=TIMESTAMP},  
235 - remarks = #{remarks,jdbcType=VARCHAR},  
236 - del_flag = #{delFlag,jdbcType=CHAR} 194 + set yard_id = #{yardId,jdbcType=VARCHAR},
  195 + cop_code = #{copCode,jdbcType=VARCHAR},
  196 + `name` = #{name,jdbcType=VARCHAR},
  197 + warehouse_type = #{warehouseType,jdbcType=VARCHAR},
  198 + warehouse_length = #{warehouseLength,jdbcType=DECIMAL},
  199 + warehouse_width = #{warehouseWidth,jdbcType=DECIMAL},
  200 + warehouse_area = #{warehouseArea,jdbcType=DECIMAL},
  201 + create_by = #{createBy,jdbcType=VARCHAR},
  202 + create_date = #{createDate,jdbcType=TIMESTAMP},
  203 + update_by = #{updateBy,jdbcType=VARCHAR},
  204 + update_date = #{updateDate,jdbcType=TIMESTAMP},
  205 + remarks = #{remarks,jdbcType=VARCHAR},
  206 + del_flag = #{delFlag,jdbcType=CHAR}
237 where id = #{id,jdbcType=VARCHAR} 207 where id = #{id,jdbcType=VARCHAR}
238 </update> 208 </update>
  209 +
  210 + <!-- 该Mapper映射关系的作用,是仓库与场站的1:1的关系映射 -->
  211 + <resultMap extends="BaseResultMap" id="WarehouseAndYardMap" type="com.sunyo.wlpt.station.manage.domain.Warehouse">
  212 + <association javaType="com.sunyo.wlpt.station.manage.domain.Yard" property="yard">
  213 + <id column="id" property="id"/>
  214 + <result column="yard_name" property="name"/>
  215 + </association>
  216 + </resultMap>
  217 +
  218 + <!-- 分页查询 -->
  219 + <select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Warehouse" resultMap="WarehouseAndYardMap">
  220 + select w.id,
  221 + w.yard_id,
  222 + w.cop_code,
  223 + w.name,
  224 + w.warehouse_type,
  225 + w.warehouse_length,
  226 + w.warehouse_width,
  227 + w.warehouse_area,
  228 + w.create_by,
  229 + w.create_date,
  230 + w.update_by,
  231 + w.update_date,
  232 + w.remarks,
  233 + w.del_flag,
  234 + y.name as yard_name
  235 + from warehouse w,
  236 + yard y
  237 + <where>
  238 + <!-- name,仓库名称 -->
  239 + <if test="name != null and name != ''">
  240 + and w.name = #{name,jdbcType=VARCHAR}
  241 + </if>
  242 + <!-- stationName,货站名称 -->
  243 + <if test="stationName != null and stationName != ''">
  244 + and y.name = #{stationName,jdbcType=VARCHAR}
  245 + </if>
  246 + and w.yard_id = y.id
  247 + </where>
  248 + </select>
239 </mapper> 249 </mapper>