Authored by kun

新增文件

... ... @@ -6,17 +6,20 @@
<id property="id" column="id"/>
<result property="sortName" column="sort_name"/>
<result property="status" column="status"/>
<result property="orderBy" column="order_by"/>
<result property="level" column="level"/>
<result property="parentId" column="parent_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="queryColumns">
id, sort_name, status
id, sort_name, status, level, parent_id, order_by
</sql>
<insert id="insertProductSort" parameterType="com.yoho.ufo.model.commoditybasicrole.category.ProductSort">
insert into product_sort(id, sort_name, status, create_time, update_time)
values (#{id}, #{sortName}, #{status}, #{createTime}, #{updateTime})
insert into product_sort(id, sort_name, status, create_time, update_time, level, parent_id, order_by)
values (#{id}, #{sortName}, #{status}, #{createTime}, #{updateTime}, #{level}, #{parentId}, #{orderBy})
</insert>
... ... @@ -28,14 +31,20 @@
<if test="productSort.sortName != null and productSort.sortName !=''">
sort_name = #{productSort.sortName},
</if>
<if test="productSort.status != null and productSort.status != ''">
<if test="productSort.parentId != null">
parent_id =#{productSort.parentId},
</if>
<if test="productSort.status != null">
status = #{productSort.status},
</if>
<if test="productSort.orderBy != null">
order_by = #{productSort.orderBy},
</if>
<if test="productSort.createTime != null">
create_time = #{productSort.createTime},
</if>
<if test="productSort.updateTime != null">
update_time = #{productSort.updateTime},
update_time = #{productSort.updateTime}
</if>
</set>
... ...
<?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.yoho.ufo.dal.UfoProductDetailsMapper">
<resultMap id="productDetails" type="com.yoho.ufo.model.goodsmanage.ProductDetails">
</resultMap>
<sql id="queryColumns">
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name, product.del_status
</sql>
<select id="queryProductIdsByProductIds" parameterType="java.util.Set" resultType="integer">
select id from product
where del_status = 0 and id in
<foreach collection="set" index="index" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<sql id="queryParam">
WHERE product.del_status=0 and pool_detail.pool_id = #{productDetails.poolId}
<if test="productDetails.productCode != null and productDetails.productCode != ''">
and product.product_code like concat('%',#{productDetails.productCode}, '%')
</if>
<if test="productDetails.productName != null and productDetails.productName != ''">
and pool.pool_name like concat('%', #{productDetails.productName}, '%')
</if>
<if test="productDetails.brandName != null and productDetails.brandName != ''">
and brand.brand_name like concat('%', #{productDetails.brandName}, '%')
</if>
<if test="productDetails.sortName != null and productDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productDetails.sortName}, '%')
</if>
</sql>
<sql id="queryTable">
FROM product_pool pool
LEFT JOIN product_pool_detail pool_detail
ON pool.id = pool_detail.pool_id
LEFT JOIN product
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
</sql>
<select id="selectProductDetailsCount" resultType="integer">
SELECT COUNT(*)
<include refid="queryTable"/>
<include refid="queryParam"/>
</select>
<select id="getProductDetailsPageList" resultMap="productDetails">
select <include refid="queryColumns"/>
<include refid="queryTable"/>
<include refid="queryParam"/>
limit #{page.startIndex}, #{page.pageSize}
</select>
<update id="deleteProductById">
update product set del_status = 1, update_time = UNIX_TIMESTAMP(NOW()) where id = #{id}
</update>
</mapper>
\ No newline at end of file
... ...
<?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.yoho.ufo.dal.UfoProductPoolDetailMapper">
<resultMap id="productPoolDetails" type="com.yoho.ufo.model.goodsmanage.ProductPoolDetails">
</resultMap>
<sql id="queryColumns">
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name
</sql>
<sql id="queryParam">
WHERE product.del_status=0
<if test="productPoolDetails.productCode != null and productPoolDetails.productCode != ''">
and product.product_code like concat('%',#{productPoolDetails.productCode}, '%')
</if>
<if test="productPoolDetails.productName != null and productPoolDetails.productName != ''">
and pool.pool_name like concat('%', #{productPoolDetails.productName}, '%')
</if>
<if test="productPoolDetails.brandName != null and productPoolDetails.brandName != ''">
and brand.brand_name like concat('%', #{productPoolDetails.brandName}, '%')
</if>
<if test="productPoolDetails.sortName != null and productPoolDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productPoolDetails.sortName}, '%')
</if>
</sql>
<sql id="queryTable">
FROM product_pool pool
LEFT JOIN product_pool_detail pool_detail
ON pool.id = pool_detail.pool_id
LEFT JOIN product
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
</sql>
<select id="selectProductPoolDetailsCount" resultType="integer">
SELECT COUNT(*)
<include refid="queryTable"/>
<include refid="queryParam"/>
</select>
<select id="getProductPoolDetailsPageList" resultMap="productPoolDetails">
select <include refid="queryColumns"/>
<include refid="queryTable"/>
<include refid="queryParam"/>
limit #{page.startIndex}, #{page.pageSize}
</select>
<insert id="batchInsertProductPoolDetails" parameterType="list">
insert into product_pool_detail(pool_id, product_id, create_time) values
<foreach collection="list" item="item" separator="," index="index">
(#{item.poolId}, #{item.productId}, #{item.createTime})
</foreach>
</insert>
<delete id="deleteProductPoolDetailsByPoolId">
delete from product_pool_detail where pool_id = #{poolId}
</delete>
<delete id="deleteProductPoolDetail">
DELETE FROM product_pool_detail WHERE pool_id = #{productPoolId} AND product_id = #{productId}
</delete>
</mapper>
\ No newline at end of file
... ...
<?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.yoho.ufo.dal.UfoProductPoolMapper">
<resultMap id="productPool" type="com.yoho.ufo.model.goodsmanage.ProductPool">
</resultMap>
<sql id="queryColumns">
pool.id, pool.pool_name, pool.create_time, COUNT(pool_detail.product_id) AS productNum
</sql>
<insert id="insertProductPool" parameterType="com.yoho.ufo.model.goodsmanage.ProductPool" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into product_pool(id, pool_name, create_time, pool_type)
values (#{id}, #{poolName}, #{createTime}, #{poolType})
</insert>
<update id="updateProductPool" parameterType="com.yoho.ufo.model.goodsmanage.ProductPool">
update product_pool set pool_name = #{productPool.poolName}
where id = #{productPool.id}
</update>
<select id="selectOneById" resultMap="productPool">
select id, pool_name
from product_pool where id = #{id}
</select>
<sql id="queryParam">
<where>
<if test="productPool.id != null">
pool.id = #{productPool.id}
</if>
<if test="productPool.poolName != null and productPool.poolName != ''">
and pool.pool_name like concat('%', #{productPool.poolName}, '%')
</if>
</where>
</sql>
<sql id="queryTable">
FROM product_pool pool
LEFT JOIN product_pool_detail pool_detail
ON pool.id = pool_detail.pool_id
</sql>
<select id="selectProductPoolCount" resultType="integer">
SELECT COUNT(*)
<include refid="queryTable"/>
<include refid="queryParam"/>
</select>
<select id="getProductPoolPageList" resultMap="productPool">
select <include refid="queryColumns"/>
<include refid="queryTable"/>
<include refid="queryParam"/>
GROUP BY pool_detail.pool_id
ORDER BY pool.create_time DESC
limit #{page.startIndex}, #{page.pageSize}
</select>
</mapper>
\ No newline at end of file
... ...