|
@@ -5,8 +5,8 @@
|
|
<!-- 增 [G] -->
|
|
<!-- 增 [G] -->
|
|
<insert id="add">
|
|
<insert id="add">
|
|
insert into
|
|
insert into
|
|
- tb_item (id, type_id, type_name, item_code, item_name, price, unit)
|
|
|
|
- values (#{id}, #{typeId}, #{typeName}, #{itemCode}, #{itemName}, #{price}, #{unit})
|
|
|
|
|
|
+ tb_item (id, type_id, type_name, item_code, item_name, price, unit, car_length, max_weight, status)
|
|
|
|
+ values (#{id}, #{typeId}, #{typeName}, #{itemCode}, #{itemName}, #{price}, #{unit}, #{carLength}, #{maxWeight}, #{status})
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<!-- 删 -->
|
|
<!-- 删 -->
|
|
@@ -24,7 +24,10 @@
|
|
item_code = #{itemCode},
|
|
item_code = #{itemCode},
|
|
item_name = #{itemName},
|
|
item_name = #{itemName},
|
|
price = #{price},
|
|
price = #{price},
|
|
- unit = #{unit}
|
|
|
|
|
|
+ unit = #{unit},
|
|
|
|
+ car_length = #{carLength},
|
|
|
|
+ max_weight = #{maxWeight},
|
|
|
|
+ status = #{status}
|
|
where id = #{id}
|
|
where id = #{id}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
@@ -41,6 +44,9 @@
|
|
<result property="itemName" column="item_name" />
|
|
<result property="itemName" column="item_name" />
|
|
<result property="price" column="price" />
|
|
<result property="price" column="price" />
|
|
<result property="unit" column="unit" />
|
|
<result property="unit" column="unit" />
|
|
|
|
+ <result property="carLength" column="car_length" />
|
|
|
|
+ <result property="maxWeight" column="max_weight" />
|
|
|
|
+ <result property="status" column="status" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<!-- 公共查询sql片段 -->
|
|
<!-- 公共查询sql片段 -->
|
|
@@ -48,42 +54,46 @@
|
|
select *
|
|
select *
|
|
from tb_item
|
|
from tb_item
|
|
</sql>
|
|
</sql>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 查 - 根据id -->
|
|
<!-- 查 - 根据id -->
|
|
<select id="getById" resultMap="model">
|
|
<select id="getById" resultMap="model">
|
|
<include refid="select_sql"></include>
|
|
<include refid="select_sql"></include>
|
|
where id = #{id}
|
|
where id = #{id}
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
|
|
<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
|
|
<select id="getList" resultMap="model">
|
|
<select id="getList" resultMap="model">
|
|
<include refid="select_sql"></include>
|
|
<include refid="select_sql"></include>
|
|
<where>
|
|
<where>
|
|
<if test=' this.has("id") '> and id = #{id} </if>
|
|
<if test=' this.has("id") '> and id = #{id} </if>
|
|
- <if test=' this.has("itemCode") '> and item_code = #{itemCode} </if>
|
|
|
|
- <if test=' this.has("itemName") '> and item_name = #{itemName} </if>
|
|
|
|
|
|
+ <if test=' this.has("typeId") '> and type_id = #{typeId} </if>
|
|
|
|
+ <if test=' this.has("typeName") '> and type_name = #{typeName} </if>
|
|
|
|
+ <if test=' this.has("itemCode") '> and item_code = #{itemCode} </if>
|
|
|
|
+ <if test=' this.has("itemName") '> and item_name like concat('%', #{itemName} ,'%') </if>
|
|
<if test=' this.has("price") '> and price = #{price} </if>
|
|
<if test=' this.has("price") '> and price = #{price} </if>
|
|
<if test=' this.has("status") '> and status = #{status} </if>
|
|
<if test=' this.has("status") '> and status = #{status} </if>
|
|
</where>
|
|
</where>
|
|
order by
|
|
order by
|
|
<choose>
|
|
<choose>
|
|
- <when test='sortType == 1'> id desc </when>
|
|
|
|
- <when test='sortType == 2'> item_code desc </when>
|
|
|
|
- <when test='sortType == 3'> item_name desc </when>
|
|
|
|
- <when test='sortType == 4'> price desc </when>
|
|
|
|
- <when test='sortType == 5'> need desc </when>
|
|
|
|
|
|
+ <when test='sortType == 1'> id desc </when>
|
|
|
|
+ <when test='sortType == 2'> type_id desc </when>
|
|
|
|
+ <when test='sortType == 3'> type_name desc </when>
|
|
|
|
+ <when test='sortType == 4'> item_code desc </when>
|
|
|
|
+ <when test='sortType == 5'> item_name desc </when>
|
|
|
|
+ <when test='sortType == 6'> price desc </when>
|
|
|
|
+ <when test='sortType == 7'> unit desc </when>
|
|
<otherwise> id desc </otherwise>
|
|
<otherwise> id desc </otherwise>
|
|
</choose>
|
|
</choose>
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
<!-- 查 - 根据id -->
|
|
<!-- 查 - 根据id -->
|
|
<select id="getById" resultMap="model">
|
|
<select id="getById" resultMap="model">
|