|
@@ -0,0 +1,63 @@
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+
|
|
|
+<mapper namespace="com.bosshand.virgo.api.workark.dao.ProductDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.api.workark.model.Product" id="result">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="state" property="state"/>
|
|
|
+ <result column="type" property="type"/>
|
|
|
+ <result column="productLevelId" property="productLevelId"/>
|
|
|
+ <result column="createTime" property="createTime"/>
|
|
|
+ <result column="updateTime" property="updateTime"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="price" property="price"/>
|
|
|
+ <result column="intro" property="intro"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="get" resultMap="result">
|
|
|
+ select * from workark_product where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" resultMap="result">
|
|
|
+ select * from workark_product
|
|
|
+ <where>
|
|
|
+ <if test="name != null">
|
|
|
+ and name = #{name}
|
|
|
+ </if>
|
|
|
+ <if test="state != null">
|
|
|
+ and state = #{state}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="productLevelId != 0">
|
|
|
+ and productLevelId = #{productLevelId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO workark_product (type, productLevelId, createTime, name, price, intro) VALUES (#{type}, #{productLevelId}, now(), #{name}, #{price}, #{intro})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.api.workark.model.Product">
|
|
|
+ UPDATE workark_product
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="type!=null">type=#{type},</if>
|
|
|
+ <if test="productLevelId!=0">productLevelId=#{productLevelId},</if>
|
|
|
+ <if test="name!=null">name=#{name},</if>
|
|
|
+ <if test="price!=0">price=#{price},</if>
|
|
|
+ <if test="intro!=null">intro=#{intro},</if>
|
|
|
+ <if test="updateTime==null">updateTime=now(),</if>
|
|
|
+ <if test="state!=null">state=#{state},</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE FROM workark_product WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|