|
@@ -2,17 +2,16 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.pj.project.tb_business_item.TbBusinessItemMapper">
|
|
|
|
|
|
- <!-- 增 [G] -->
|
|
|
- <insert id="add">
|
|
|
+ <!-- 增 [G] -->
|
|
|
+ <insert id="add">
|
|
|
insert into
|
|
|
tb_business_item (id, business_id, item_code, item_price, item_name, status, operate_time, operaror)
|
|
|
values (#{id}, #{businessId}, #{itemCode}, #{itemPrice}, #{itemName}, #{status}, #{operateTime}, #{operaror})
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
-
|
|
|
- <!-- 改 [G] -->
|
|
|
- <update id="update">
|
|
|
+ <!-- 改 [G] -->
|
|
|
+ <update id="update">
|
|
|
update tb_business_item set
|
|
|
id = #{id},
|
|
|
business_id = #{businessId},
|
|
@@ -26,78 +25,79 @@
|
|
|
</update>
|
|
|
|
|
|
|
|
|
- <!-- ================================== 查询相关 ================================== -->
|
|
|
+ <!-- ================================== 查询相关 ================================== -->
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- <!-- 通用映射:手动模式 -->
|
|
|
- <resultMap id="model" type="com.pj.project.tb_business_item.TbBusinessItem">
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="businessId" column="business_id" />
|
|
|
- <result property="itemCode" column="item_code" />
|
|
|
- <result property="itemPrice" column="item_price" />
|
|
|
- <result property="itemName" column="item_name" />
|
|
|
- <result property="status" column="status" />
|
|
|
- <result property="operateTime" column="operate_time" />
|
|
|
- <result property="operaror" column="operaror" />
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <!-- 公共查询sql片段 -->
|
|
|
- <sql id="select_sql">
|
|
|
+ <!-- 通用映射:手动模式 -->
|
|
|
+ <resultMap id="model" type="com.pj.project.tb_business_item.TbBusinessItem">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="businessId" column="business_id"/>
|
|
|
+ <result property="itemCode" column="item_code"/>
|
|
|
+ <result property="itemPrice" column="item_price"/>
|
|
|
+ <result property="itemName" column="item_name"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="operateTime" column="operate_time"/>
|
|
|
+ <result property="operaror" column="operaror"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 公共查询sql片段 -->
|
|
|
+ <sql id="select_sql">
|
|
|
select a.*,b.goods_name,b.card_no,b.china_car_no
|
|
|
from tb_business_item a,tb_business b where a.business_id=b.id
|
|
|
</sql>
|
|
|
-
|
|
|
- <!-- 查 - 根据id -->
|
|
|
- <select id="getById" resultMap="model">
|
|
|
+
|
|
|
+ <!-- 查 - 根据id -->
|
|
|
+ <select id="getById" resultMap="model">
|
|
|
select * from tb_busness
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
|
|
|
- <select id="getList" resultType="com.pj.project.tb_business_item.TbBusinessItem">
|
|
|
- select a.*,b.goods_name,b.card_no,b.china_car_no,b.business_type
|
|
|
- from tb_business_item a,tb_business b where a.business_id=b.id
|
|
|
- <if test=' this.has("id") '> and a.id = #{id} </if>
|
|
|
- <if test=' this.has("businessId") '> and a.business_id = #{businessId} </if>
|
|
|
- <if test=' this.has("pickCustomerId") '> and a.pick_customer_id = #{pickCustomerId} </if>
|
|
|
- <if test=' this.has("itemCode") '> and a.item_code = #{itemCode} </if>
|
|
|
- <if test=' this.has("itemPrice") '> and a.item_price = #{itemPrice} </if>
|
|
|
- <if test=' this.has("itemName") '> and a.item_name like concat('%',#{itemName},'%') </if>
|
|
|
- <if test=' this.has("status") '> and a.status = #{status} </if>
|
|
|
- <if test=' this.has("operateTime") '> and a.operate_time = #{operateTime} </if>
|
|
|
- <if test=' this.has("operaror") '> and a.operaror = #{operaror} </if>
|
|
|
- <if test=' this.has("typeFlag") '> and a.business_type !='0' </if>
|
|
|
- <if test=' this.has("beginTime") and this.has("endTime") '>
|
|
|
- and date_format(a.create_time,'%Y-%m-%d') >= #{beginTime}
|
|
|
- and date_format(a.create_time,'%Y-%m-%d') <= #{endTime}
|
|
|
- </if>
|
|
|
- <if test=' this.has("cardNo") '> and b.card_no like concat('%',#{cardNo},'%') </if>
|
|
|
- <if test=' this.has("chinaCarNo") '> and b.china_car_no like concat('%',#{chinaCarNo},'%') </if>
|
|
|
- <if test=' this.has("businessType") '> and b.business_type = #{businessType} </if>
|
|
|
- <if test=' this.has("goodsName") '> and b.goods_name like concat('%',#{goodsName},'%') </if>
|
|
|
- order by
|
|
|
- <choose>
|
|
|
- <when test='sortType == 1'> a.id desc </when>
|
|
|
- <when test='sortType == 2'> a.business_id desc </when>
|
|
|
- <when test='sortType == 3'> a.item_code desc </when>
|
|
|
- <when test='sortType == 4'> a.item_price desc </when>
|
|
|
- <when test='sortType == 5'> a.item_name desc </when>
|
|
|
- <when test='sortType == 6'> a.status desc </when>
|
|
|
- <when test='sortType == 7'> a.operate_time desc </when>
|
|
|
- <when test='sortType == 8'> a.operaror desc </when>
|
|
|
- <when test='sortType == 9'> a.pick_time desc </when>
|
|
|
- <when test='sortType == 10'> a.create_time desc </when>
|
|
|
- <otherwise> a.id desc </otherwise>
|
|
|
- </choose>
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
|
|
|
+ <select id="getList" resultType="com.pj.project.tb_business_item.TbBusinessItem">
|
|
|
+ select a.*,b.goods_name,b.card_no,b.china_car_no,b.business_type
|
|
|
+ from tb_business_item a,tb_business b where a.business_id=b.id
|
|
|
+ <if test=' this.has("id") '>and a.id = #{id}</if>
|
|
|
+ <if test=' this.has("businessId") '>and a.business_id = #{businessId}</if>
|
|
|
+ <if test=' this.has("pickCustomerId") '>and a.pick_customer_id = #{pickCustomerId}</if>
|
|
|
+ <if test=' this.has("itemCode") '>and a.item_code = #{itemCode}</if>
|
|
|
+ <if test=' this.has("itemPrice") '>and a.item_price = #{itemPrice}</if>
|
|
|
+ <if test=' this.has("itemName") '>and a.item_name like concat('%',#{itemName},'%')</if>
|
|
|
+ <if test=' this.has("status") '>and a.status = #{status}</if>
|
|
|
+ <if test=' this.has("operateTime") '>and a.operate_time = #{operateTime}</if>
|
|
|
+ <if test=' this.has("operaror") '>and a.operaror = #{operaror}</if>
|
|
|
+ <if test=' this.has("typeFlag") '>and a.business_type !='0'</if>
|
|
|
+ <if test=' this.has("beginTime") and this.has("endTime") '>
|
|
|
+ and date_format(a.create_time,'%Y-%m-%d') >= #{beginTime}
|
|
|
+ and date_format(a.create_time,'%Y-%m-%d') <= #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test=' this.has("cardNo") '>and b.card_no like concat('%',#{cardNo},'%')</if>
|
|
|
+ <if test=' this.has("chinaCarNo") '>and b.china_car_no like concat('%',#{chinaCarNo},'%')</if>
|
|
|
+ <if test=' this.has("businessType") '>and b.business_type = #{businessType}</if>
|
|
|
+ <if test=' this.has("goodsName") '>and b.goods_name like concat('%',#{goodsName},'%')</if>
|
|
|
+ <if test="typeList !=null and typeList.size>0">
|
|
|
+ and a.pick=0
|
|
|
+ and a.business_type in
|
|
|
+ <foreach collection="typeList" item="type" open="(" close=")" separator=",">
|
|
|
+ #{type}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='sortType == 1'>a.id desc</when>
|
|
|
+ <when test='sortType == 2'>a.business_id desc</when>
|
|
|
+ <when test='sortType == 3'>a.item_code desc</when>
|
|
|
+ <when test='sortType == 4'>a.item_price desc</when>
|
|
|
+ <when test='sortType == 5'>a.item_name desc</when>
|
|
|
+ <when test='sortType == 6'>a.status desc</when>
|
|
|
+ <when test='sortType == 7'>a.operate_time desc</when>
|
|
|
+ <when test='sortType == 8'>a.operaror desc</when>
|
|
|
+ <when test='sortType == 9'>a.pick_time desc</when>
|
|
|
+ <when test='sortType == 10'>a.create_time desc</when>
|
|
|
+ <when test='sortType == 11'>a.pick asc</when>
|
|
|
+ <when test='sortType == 12'>a.pick_time desc</when>
|
|
|
+ <otherwise>a.id desc</otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
</mapper>
|