较多改动,暂存
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodsCategoryDao">
|
||||
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodCategoryDao">
|
||||
<select id="list" resultType="com.cxyxiaomo.epp.common.pojo.GoodCategory">
|
||||
SELECT * FROM goods_category
|
||||
WHERE 1 = 1
|
@@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodDao">
|
||||
<resultMap id="GoodsResultMap" type="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
<id column="id" property="id" />
|
||||
<result column="goods_name" property="goodsName" />
|
||||
<result column="category_id" property="categoryId" />
|
||||
<result column="brand" property="brand" />
|
||||
<result column="gallery" property="gallery" />
|
||||
<result column="brief" property="brief" />
|
||||
<result column="is_on_sale" property="isOnSale" />
|
||||
<result column="sort_order" property="sortOrder" />
|
||||
<result column="pic_url" property="picUrl" />
|
||||
<result column="type" property="type" />
|
||||
<result column="unit" property="unit" />
|
||||
<result column="counter_price" property="counterPrice" />
|
||||
<result column="retail_price" property="retailPrice" />
|
||||
<result column="detail" property="detail" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!--<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
||||
<!-- INSERT INTO report (`user_id`, `name`, `address`, `time`, `temperature`)-->
|
||||
<!-- VALUES (#{userId}, #{name}, #{address}, #{time}, #{temperature})-->
|
||||
<!--</insert>-->
|
||||
<select id="list" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE 1 = 1
|
||||
<if test="cateId != null">
|
||||
AND category_id = #{cateId}
|
||||
</if>
|
||||
<if test="searchText != null">
|
||||
AND goods_name LIKE concat('%',#{searchText,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
order by `sort_order` asc
|
||||
</select>
|
||||
<select id="getById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE id = #{id}
|
||||
order by `sort_order` asc
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="GoodsResultMap">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByIds" parameterType="java.util.List" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
<where>
|
||||
<if test="list != null and list.size > 0">
|
||||
AND id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--<select id="selectByCategoryId" resultMap="GoodsResultMap">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM goods-->
|
||||
<!-- WHERE category_id = #{categoryId}-->
|
||||
<!--</select>-->
|
||||
|
||||
<!--<select id="selectAll" resultMap="GoodsResultMap">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM goods-->
|
||||
<!--</select>-->
|
||||
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO goods (goods_name, category_id, brand, gallery, brief, is_on_sale, sort_order, pic_url, type, unit, counter_price, retail_price, detail, deleted)
|
||||
VALUES (#{goodsName}, #{categoryId}, #{brand}, #{gallery}, #{brief}, #{isOnSale}, #{sortOrder}, #{picUrl}, #{type}, #{unit}, #{counterPrice}, #{retailPrice}, #{detail}, #{deleted})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
UPDATE goods
|
||||
SET goods_name = #{goodsName},
|
||||
category_id = #{categoryId},
|
||||
brand = #{brand},
|
||||
gallery = #{gallery},
|
||||
brief = #{brief},
|
||||
is_on_sale = #{isOnSale},
|
||||
sort_order = #{sortOrder},
|
||||
pic_url = #{picUrl},
|
||||
type = #{type},
|
||||
unit = #{unit},
|
||||
counter_price = #{counterPrice},
|
||||
retail_price = #{retailPrice},
|
||||
detail = #{detail},
|
||||
deleted = #{deleted}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
DELETE FROM goods
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<insert id="addGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
||||
<!-- INSERT INTO user (username, `password`, realname, id_number, phone_number, role_id, building_id, doorplate,-->
|
||||
<!-- permission, permission_time)-->
|
||||
<!-- VALUES (#{username}, #{password}, #{realname}, #{idNumber}, #{phoneNumber}, #{roleId}, #{buildingId},-->
|
||||
<!-- #{doorplate}, #{permission}, #{permissionTime})-->
|
||||
<!--</insert>-->
|
||||
<!--<update id="updateGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
||||
<!-- UPDATE user-->
|
||||
<!-- <set>-->
|
||||
<!-- <if test="username != null and username != ''">-->
|
||||
<!-- username = #{username},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="password != null and password != ''">-->
|
||||
<!-- `password` = #{password},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="realname != null and realname != ''">-->
|
||||
<!-- realname = #{realname},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="idNumber != null and idNumber != ''">-->
|
||||
<!-- id_number = #{idNumber},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="phoneNumber != null and phoneNumber != ''">-->
|
||||
<!-- phone_number = #{phoneNumber},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="roleId != null">-->
|
||||
<!-- role_id = #{roleId},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="buildingId != null and buildingId != ''">-->
|
||||
<!-- building_id = #{buildingId},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="doorplate != null and doorplate != ''">-->
|
||||
<!-- doorplate = #{doorplate},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="permission != null">-->
|
||||
<!-- permission = #{permission},-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="permissionTime != null">-->
|
||||
<!-- permission_time = #{permissionTime},-->
|
||||
<!-- </if>-->
|
||||
<!-- </set>-->
|
||||
<!-- WHERE id = #{id}-->
|
||||
<!--</update>-->
|
||||
<!--<select id="getGoodById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM user-->
|
||||
<!-- WHERE id = #{id}-->
|
||||
<!--</select>-->
|
||||
<select id="getGoodList" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
select *
|
||||
from goods
|
||||
where 1 = 1
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="goodsName != null && goodsName != ''">
|
||||
AND goods_name LIKE concat('%',#{goodsName,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="categoryId != null">
|
||||
AND category_id = #{categoryId}
|
||||
</if>
|
||||
<if test="brand != null && brand != ''">
|
||||
AND brand LIKE concat('%',#{brand,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="gallery != null && gallery != ''">
|
||||
AND gallery LIKE concat('%',#{gallery,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="brief != null && brief != ''">
|
||||
AND brief LIKE concat('%',#{brief,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="isOnSale != null">
|
||||
AND is_on_sale = #{isOnSale}
|
||||
</if>
|
||||
<if test="sortOrder != null">
|
||||
AND sort_order = #{sortOrder}
|
||||
</if>
|
||||
<if test="picUrl != null && picUrl != ''">
|
||||
AND pic_url LIKE concat('%',#{picUrl,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="unit != null && unit != ''">
|
||||
AND unit LIKE concat('%',#{unit,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="counterPrice != null">
|
||||
AND counter_price = #{counterPrice}
|
||||
</if>
|
||||
<if test="retailPrice != null">
|
||||
AND retail_price = #{retailPrice}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--<delete id="deleteGoodById">-->
|
||||
<!-- DELETE-->
|
||||
<!-- FROM user-->
|
||||
<!-- WHERE id = #{userId}-->
|
||||
<!--</delete>-->
|
||||
</mapper>
|
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodsDao">
|
||||
<resultMap id="GoodsResultMap" type="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
<id column="id" property="id" />
|
||||
<result column="goods_name" property="goodsName" />
|
||||
<result column="category_id" property="categoryId" />
|
||||
<result column="brand" property="brand" />
|
||||
<result column="gallery" property="gallery" />
|
||||
<result column="brief" property="brief" />
|
||||
<result column="is_on_sale" property="isOnSale" />
|
||||
<result column="sort_order" property="sortOrder" />
|
||||
<result column="pic_url" property="picUrl" />
|
||||
<result column="type" property="type" />
|
||||
<result column="unit" property="unit" />
|
||||
<result column="counter_price" property="counterPrice" />
|
||||
<result column="retail_price" property="retailPrice" />
|
||||
<result column="detail" property="detail" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!--<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
||||
<!-- INSERT INTO report (`user_id`, `name`, `address`, `time`, `temperature`)-->
|
||||
<!-- VALUES (#{userId}, #{name}, #{address}, #{time}, #{temperature})-->
|
||||
<!--</insert>-->
|
||||
<select id="list" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE 1 = 1
|
||||
<if test="cateId != null">
|
||||
AND category_id = #{cateId}
|
||||
</if>
|
||||
<if test="searchText != null">
|
||||
AND goods_name LIKE concat('%',#{searchText,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
order by `sort_order` asc
|
||||
</select>
|
||||
<select id="getById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE id = #{id}
|
||||
order by `sort_order` asc
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="GoodsResultMap">
|
||||
SELECT *
|
||||
FROM goods
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByIds" parameterType="java.util.List" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
SELECT *
|
||||
FROM goods
|
||||
<where>
|
||||
<if test="list != null and list.size > 0">
|
||||
AND id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--<select id="selectByCategoryId" resultMap="GoodsResultMap">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM goods-->
|
||||
<!-- WHERE category_id = #{categoryId}-->
|
||||
<!--</select>-->
|
||||
|
||||
<!--<select id="selectAll" resultMap="GoodsResultMap">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM goods-->
|
||||
<!--</select>-->
|
||||
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO goods (goods_name, category_id, brand, gallery, brief, is_on_sale, sort_order, pic_url, type, unit, counter_price, retail_price, detail, deleted)
|
||||
VALUES (#{goodsName}, #{categoryId}, #{brand}, #{gallery}, #{brief}, #{isOnSale}, #{sortOrder}, #{picUrl}, #{type}, #{unit}, #{counterPrice}, #{retailPrice}, #{detail}, #{deleted})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.cxyxiaomo.epp.common.pojo.Good">
|
||||
UPDATE goods
|
||||
SET goods_name = #{goodsName},
|
||||
category_id = #{categoryId},
|
||||
brand = #{brand},
|
||||
gallery = #{gallery},
|
||||
brief = #{brief},
|
||||
is_on_sale = #{isOnSale},
|
||||
sort_order = #{sortOrder},
|
||||
pic_url = #{picUrl},
|
||||
type = #{type},
|
||||
unit = #{unit},
|
||||
counter_price = #{counterPrice},
|
||||
retail_price = #{retailPrice},
|
||||
detail = #{detail},
|
||||
deleted = #{deleted}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
DELETE FROM goods
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user