|
|
|
|
<?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.zdxt.knowledge.mapper.SceneMedalMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.zdxt.knowledge.domain.SceneMedal" id="SceneMedalResult">
|
|
|
|
|
<result property="guid" column="guid"/>
|
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
|
<result property="iconPath" column="icon_path"/>
|
|
|
|
|
<result property="achieveIconPath" column="achieve_icon_path"/>
|
|
|
|
|
<result property="sceneId" column="scene_id"/>
|
|
|
|
|
<result property="type" column="type"/>
|
|
|
|
|
<result property="hide" column="hide"/>
|
|
|
|
|
<result property="level" column="level"/>
|
|
|
|
|
<result property="sort" column="sort"/>
|
|
|
|
|
<result property="creator" column="creator"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectSceneMedalVo">
|
|
|
|
|
select guid,
|
|
|
|
|
name,
|
|
|
|
|
sort,
|
|
|
|
|
icon_path,
|
|
|
|
|
achieve_icon_path,
|
|
|
|
|
scene_id,
|
|
|
|
|
type,
|
|
|
|
|
hide,
|
|
|
|
|
level,
|
|
|
|
|
creator,
|
|
|
|
|
create_time,
|
|
|
|
|
update_by,
|
|
|
|
|
update_time
|
|
|
|
|
from scene_medal
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectSceneMedalList" parameterType="SceneMedal" resultMap="SceneMedalResult">
|
|
|
|
|
<include refid="selectSceneMedalVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
<if test="sceneId != null and sceneId != ''">and scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="type != null and type != ''">and type = #{type}</if>
|
|
|
|
|
<if test="hide != null and hide != ''">and hide = #{hide}</if>
|
|
|
|
|
<if test="creator != null and creator != ''">and creator = #{creator}</if>
|
|
|
|
|
<if test="sceneId != null and sceneId != ''">and scene_id = #{sceneId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by sort ASC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectSceneMedalById" parameterType="String" resultMap="SceneMedalResult">
|
|
|
|
|
<include refid="selectSceneMedalVo"/>
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertSceneMedal" parameterType="SceneMedal">
|
|
|
|
|
insert into scene_medal
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="guid != null ">guid,</if>
|
|
|
|
|
<if test="name != null and name != ''">`name`,</if>
|
|
|
|
|
<if test="iconPath != null and iconPath != ''">icon_path,</if>
|
|
|
|
|
<if test="achieveIconPath != null and achieveIconPath != ''">achieve_icon_path,</if>
|
|
|
|
|
<if test="sceneId != null and sceneId != ''">scene_id,</if>
|
|
|
|
|
<if test="type != null and type != ''">type,</if>
|
|
|
|
|
<if test="hide != null">hide,</if>
|
|
|
|
|
<if test="level != null">level,</if>
|
|
|
|
|
<if test="sort != null">sort,</if>
|
|
|
|
|
<if test="creator != null and creator != ''">creator,</if>
|
|
|
|
|
<if test="createTime != null ">create_time,</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
|
|
<if test="updateTime != null ">create_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="guid != null ">#{guid},</if>
|
|
|
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
|
|
|
<if test="iconPath != null and iconPath != ''">#{iconPath},</if>
|
|
|
|
|
<if test="achieveIconPath != null and achieveIconPath != ''">#{achieveIconPath},</if>
|
|
|
|
|
<if test="sceneId != null and sceneId != ''">#{sceneId},</if>
|
|
|
|
|
<if test="type != null and type != ''">#{type},</if>
|
|
|
|
|
<if test="hide != null">#{hide},</if>
|
|
|
|
|
<if test="level != null">#{level},</if>
|
|
|
|
|
<if test="sort != null">#{sort},</if>
|
|
|
|
|
<if test="creator != null and creator != ''">#{creator},</if>
|
|
|
|
|
<if test="createTime != null ">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null ">#{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateSceneMedal" parameterType="SceneMedal">
|
|
|
|
|
update scene_medal
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="name != null and name != ''">name = #{name},</if>
|
|
|
|
|
<if test="iconPath != null and iconPath != ''">icon_path = #{iconPath},</if>
|
|
|
|
|
<if test="achieveIconPath != null and achieveIconPath != ''">achieve_icon_path = #{achieveIconPath},</if>
|
|
|
|
|
<if test="sceneId != null and sceneId != ''">scene_id = #{sceneId},</if>
|
|
|
|
|
<if test="type != null and type != ''">type = #{type},</if>
|
|
|
|
|
<if test="hide != null ">hide = #{hide},</if>
|
|
|
|
|
<if test="level != null">level = #{level},</if>
|
|
|
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSceneMedalById" parameterType="String">
|
|
|
|
|
delete
|
|
|
|
|
from scene_medal
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSceneMedalByIds" parameterType="String">
|
|
|
|
|
delete from scene_medal where guid in
|
|
|
|
|
<foreach item="guid" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{guid}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectSceneMedalByIds" parameterType="String" resultMap="SceneMedalResult">
|
|
|
|
|
<include refid="selectSceneMedalVo"/> where guid in
|
|
|
|
|
<foreach item="guid" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{guid}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMinSort" resultType="INTEGER">
|
|
|
|
|
select MAX(sort) as sort from scene_medal where type = #{type}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectLastSort" resultMap="SceneMedalResult">
|
|
|
|
|
SELECT guid, sort FROM scene_medal WHERE sort = (SELECT MAX(sort) FROM scene_medal where sort < #{sort} and type = #{type});
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- <select id="selectSceneMedalListAll" parameterType="SceneMedal" resultMap="SceneMedalResult">-->
|
|
|
|
|
<!-- select cu.guid, cu.name, zd.upload_path-->
|
|
|
|
|
<!-- from scene_medal as cu-->
|
|
|
|
|
<!-- inner join zdxt_file as zd-->
|
|
|
|
|
<!-- on cu.guid = zd.business_id-->
|
|
|
|
|
<!-- where cu.hide = 1-->
|
|
|
|
|
<!-- order by cu.sort ASC-->
|
|
|
|
|
<!-- </select>-->
|
|
|
|
|
|
|
|
|
|
</mapper>
|