IMProductEntryMapper.xml 2.6 KB
<?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="com.sibu.orderHelper.integral.web.dao.IMWebProductEntryDao">
    
    <select id="pagerProductEntry" resultMap="listIMProductEntry">
    	SELECT
			ipe.entry_id, 
			ipe.entry_username, 
			ipe.entry_phone, 
			ipe.entry_wechat, 
			ipe.entry_product_stock, 
			ipe.create_dt, 
			imp.im_product_id,
			imp.name
		FROM im_product_entry ipe
		INNER JOIN im_product imp ON ipe.entry_product_id=imp.im_product_id
		where imp.`im_product_id` IN(
		 select product_id from im_product_supplier  where supplier_id=#{supplierId}
		)
		<if test="keyword != null and keyword !=''">
			and imp.name like concat('%',#{keyword},'%')
		</if>
		<if test="isShow != null and isShow !=''">
			and imp.is_show = ${isShow} 
		</if>
		ORDER BY ipe.create_dt desc
		LIMIT ${pageNow}, ${pageSize}
    </select>
    
    <select id="countProductEntry" resultType="int">
    	select count(*) FROM im_product_entry ipe
		INNER JOIN im_product imp ON ipe.entry_product_id=imp.im_product_id
		where imp.`im_product_id` IN(
		select product_id from im_product_supplier  where supplier_id=#{supplierId}
		)
		<if test="keyword != null and keyword !=''">
			and imp.name like concat('%',#{keyword},'%')
		</if>
		<if test="isShow != null and isShow !=''">
			and imp.is_show = ${isShow} 
		</if>
    </select>
    
    <insert id="addProductEntry" parameterType="IMProductEntryBean">
    	insert into im_product_entry (
    		entry_id,
    		entry_username,
    		entry_phone,
    		entry_wechat,
    		entry_product_id,
    		entry_product_stock,
    		create_dt 
    	) value(#{entryId}, #{entryUsername}, #{entryPhone}, #{entryWechat}, #{entryProductId}, #{entryProductStock}, now())
    </insert>
    
	<resultMap type="IMProductEntryBean" id="listIMProductEntry">
        <result column="entry_id" property="entryId" />
        <result column="entry_username" property="entryUsername" />
        <result column="entry_phone" property="entryPhone" />
        <result column="entry_wechat" property="entryWechat" />
        <result column="entry_product_stock" property="entryProductStock" />
        <result column="create_dt" property="createDt" />
		<result column="supplierId" property="supplierId"/>
		<result column="supplierName" property="supplierName"/>
        <association property="product" column="entry_product_id" javaType="IMProductBean">
			<result column="im_product_id" property="imProductId" />
        	<result column="name" property="name" />       		
        </association>
    </resultMap>
</mapper>