You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

104 lines
5.0 KiB

<?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.conflux.web.controller.nft.mapper.NftCollectionMapper">
<resultMap type="NftCollection" id="NftCollectionResult">
<result property="id" column="id" />
<result property="unitName" column="unit_name" />
<result property="informationTableId" column="information_table_id" />
<result property="onChainStatus" column="on_chain_status" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectNftCollectionVo">
select id, unit_name, information_table_id, on_chain_status, created_by, created_time, updated_by, updated_time from nft_collection
</sql>
<select id="selectNftCollectionList" parameterType="NftCollection" resultMap="NftCollectionResult">
<include refid="selectNftCollectionVo"/>
<where>
<if test="unitName != null and unitName != ''"> and unit_name = #{unitName}</if>
<if test="informationTableId != null and informationTableId != ''"> and information_table_id = #{informationTableId}</if>
<if test="onChainStatus != null "> and on_chain_status = #{onChainStatus}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectNftCollectionById" parameterType="Long" resultMap="NftCollectionResult">
<include refid="selectNftCollectionVo"/>
where id = #{id}
</select>
<select id="selectNftCollectionByIdSting" resultMap="NftCollectionResult">
<include refid="selectNftCollectionVo"/>
where information_table_id = #{hexTokenId}
</select>
<insert id="insertNftCollection" parameterType="NftCollection" useGeneratedKeys="true" keyProperty="id">
insert into nft_collection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="unitName != null">unit_name,</if>
<if test="informationTableId != null">information_table_id,</if>
<if test="onChainStatus != null">on_chain_status,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="unitName != null">#{unitName},</if>
<if test="informationTableId != null">#{informationTableId},</if>
<if test="onChainStatus != null">#{onChainStatus},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<insert id="insertListNftCollection">
insert into nft_collection
(unit_name, information_table_id,on_chain_status)
VALUES
<foreach collection ="stringList" item="item" separator =",">
(#{unitName}, #{item},1)
</foreach >
</insert>
<update id="updateNftCollection" parameterType="NftCollection">
update nft_collection
<trim prefix="SET" suffixOverrides=",">
<if test="unitName != null">unit_name = #{unitName},</if>
<if test="informationTableId != null">information_table_id = #{informationTableId},</if>
<if test="onChainStatus != null">on_chain_status = #{onChainStatus},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateByTokenId">
UPDATE nft_collection
SET on_chain_status = 2
where information_table_id = #{hexTokenId}
AND on_chain_status = 1
</update>
<delete id="deleteNftCollectionById" parameterType="Long">
delete from nft_collection where id = #{id}
</delete>
<delete id="deleteNftCollectionByIds" parameterType="String">
delete from nft_collection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>