模糊查询:
<if test="topicContent!=null and topicContent!=‘‘ ">
and sta.topicContent LIKE
CONCAT(‘%‘,#{topicContent},‘%‘ )
</if>
不被解析器解析:
<![CDATA[ sql 语句 ]]>
> > <![CDATA[>=]]>
< < <![CDATA[<=]]>
选择:
<choose>
<when test="activityState==‘DISABLE‘">
activityOnTop=‘N‘,
</when>
<when test="activityState==‘USERDELETE‘">
activityOnTop=‘N‘,
</when>
<when test="activityState==‘MANAGEDELETE‘">
activityOnTop=‘N‘,
</when>
</choose>
<!-- 插入一条记录 -->
<insert id="insertAdvertSite" parameterType="advertSiteImage">
INSERT INTO advert_site
(
siteId,resourcesId,siteName,sortId,siteDetail,advertTypeId,advertType,flashTypeParentId,
flashMark,leastFee,isEnable,isOpen,addTime,updateTime,isDelete
)
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{siteId},#{resourcesId},#{siteName},#{sortId},#{siteDetail},#{advertTypeId},#{advertType},
#{flashTypeParentId},#{flashMark},#{leastFee},#{isEnable},#{isOpen},SYSDATE(),SYSDATE(),‘N‘
</trim>
</insert>
<!—增加数量 多条-->
<!-- 插入产品、类目关联关系信息 -->
<insert id="insertProductCategoryList" parameterType="productCategoryDO">
INSERT INTO CSC_PRODUCT_CATEGORY_MAP
(
<include refid="Category_Column_List"/>
)
VALUES
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.productid,jdbcType=VARCHAR},
#{item.categoryId,jdbcType=VARCHAR}
)
</foreach>
</insert>
<!—增加数量 -->
<insert id="insertActivityConf" parameterType="java.util.Map">
INSERT INTO sns_activity_conf(confId,activityId,activityState,activityJoinLevel,
<if test="activityMemberLimit>0">
activityMemberLimit,
</if>
privateCircle,activityCreateTime,activityUpdateTime,has_sensitive)
VALUES(#{confId},#{activityId},#{activityState},#{activityJoinLevel},
<if test="activityMemberLimit>0">
#{activityMemberLimit},
</if>
#{privateCircle},SYSDATE(),SYSDATE(),#{hasSensitive})
</insert>
<!—删除数量 -->
<delete id="deleteActivity">
DELETE from sns_activity WHERE activityId=#{activityId}
</delete>
<!—修改数据 -->
<update id="deleteActivityTopic" parameterType="java.util.List" >
update sns_topic_conf c set c.topicState=‘DELETE‘ where c.topicId in
<foreach item="item" index="index" collection="list" open="("
separator="," close=")">
#{item}
</foreach>
</update>
<!—查询所有数据 -->
<select id="findActivityDetails" parameterType="java.lang.String" resultMap="ActivityDetailsDTO">
select * from sns_activity a
left join sns_activity_conf c on a.activityId = c.activityId
where a.activityId=#{activityId}
</select>
<!—查询单条数据 -->
<select id="findActivityCreator" parameterType="java.lang.String" resultType="java.lang.String">
select s.name from sns_social s where id=#{creatorId}
</select>
<!—查询数量 -->
<select id="countActivityTopic" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from -----------
<if test="topicContent!=null and topicContent!=‘‘ ">
and sta.topicContent LIKE
CONCAT(‘%‘,#{topicContent},‘%‘ )
</if>
</select>
parameterType:
java.lang.String
java.util.Map
java.lang.Integer
java.util.List
resultType="java.lang.Integer"
current_timestamp
SYSDATE()
UUID id = UUID.randomUUID();
Mysql:
CREATE TABLE `shop_area` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`area_id` varchar(36) NOT NULL COMMENT ‘区域ID‘,
`floor_id` varchar(36) NOT NULL COMMENT ‘楼层ID‘,
`name` varchar(20) NOT NULL COMMENT ‘区域名称‘,
`sort` mediumint(9) NOT NULL COMMENT ‘排序‘,
`update_time` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00‘ ON UPDATE CURRENT_TIMESTAMP COMMENT ‘修改时间‘,
PRIMARY KEY (`id`),
UNIQUE KEY `area_id_UNIQUE` (`area_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT=‘楼层区域表‘