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

129 lines
7.9 KiB
XML

<?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.ruoyi.portal.mapper.HwProductCaseInfoMapper">
<resultMap type="HwProductCaseInfo" id="HwProductCaseInfoResult">
<result property="caseInfoId" column="case_info_id" />
<result property="caseInfoTitle" column="case_info_title" />
<result property="configTypeId" column="config_type_id" />
<result property="typicalFlag" column="typical_flag" />
<result property="caseInfoDesc" column="case_info_desc" />
<result property="caseInfoPic" column="case_info_pic" />
<result property="caseInfoHtml" column="case_info_html" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectHwProductCaseInfoWithHtmlVo">
select case_info_id, case_info_title, config_type_id, typical_flag, case_info_desc, case_info_pic, case_info_html, create_time, create_by, update_time, update_by from hw_product_case_info hpci
</sql>
<sql id="selectHwProductCaseInfoVo">
select case_info_id, case_info_title, config_type_id, typical_flag, case_info_desc, case_info_pic, create_time, create_by, update_time, update_by from hw_product_case_info hpci
</sql>
<select id="selectHwProductCaseInfoList" parameterType="HwProductCaseInfo" resultMap="HwProductCaseInfoResult">
<include refid="selectHwProductCaseInfoVo"/>
<where>
<if test="caseInfoTitle != null and caseInfoTitle != ''"> and case_info_title = #{caseInfoTitle}</if>
<if test="typicalFlag != null and typicalFlag != ''"> and typical_flag = #{typicalFlag}</if>
<if test="caseInfoDesc != null and caseInfoDesc != ''"> and case_info_desc = #{caseInfoDesc}</if>
<if test="caseInfoPic != null and caseInfoPic != ''"> and case_info_pic = #{caseInfoPic}</if>
<if test="caseInfoHtml != null and caseInfoHtml != ''"> and case_info_html = #{caseInfoHtml}</if>
<if test="homeTypicalFlag != null and homeTypicalFlag != '' and configTypeId!=null"> and exists (select 1 from hw_portal_config_type hpct where hpct.parent_id=#{configTypeId} and hpct.config_type_id =hpci.config_type_id)</if>
<if test='(homeTypicalFlag == null or homeTypicalFlag == "") and configTypeId != null '> and config_type_id = #{configTypeId}</if>
</where>
</select>
<select id="selectHwProductCaseInfoByCaseInfoId" parameterType="Long" resultMap="HwProductCaseInfoResult">
<include refid="selectHwProductCaseInfoWithHtmlVo"/>
where case_info_id = #{caseInfoId}
</select>
<insert id="insertHwProductCaseInfo" parameterType="HwProductCaseInfo" useGeneratedKeys="true" keyProperty="caseInfoId">
insert into hw_product_case_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseInfoTitle != null and caseInfoTitle != ''">case_info_title,</if>
<if test="configTypeId != null">config_type_id,</if>
<if test="typicalFlag != null and typicalFlag != ''">typical_flag,</if>
<if test="caseInfoDesc != null and caseInfoDesc != ''">case_info_desc,</if>
<if test="caseInfoPic != null and caseInfoPic != ''">case_info_pic,</if>
<if test="caseInfoHtml != null and caseInfoHtml != ''">case_info_html,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseInfoTitle != null and caseInfoTitle != ''">#{caseInfoTitle},</if>
<if test="configTypeId != null">#{configTypeId},</if>
<if test="typicalFlag != null and typicalFlag != ''">#{typicalFlag},</if>
<if test="caseInfoDesc != null and caseInfoDesc != ''">#{caseInfoDesc},</if>
<if test="caseInfoPic != null and caseInfoPic != ''">#{caseInfoPic},</if>
<if test="caseInfoHtml != null and caseInfoHtml != ''">#{caseInfoHtml},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateHwProductCaseInfo" parameterType="HwProductCaseInfo">
update hw_product_case_info
<trim prefix="SET" suffixOverrides=",">
<if test="caseInfoTitle != null and caseInfoTitle != ''">case_info_title = #{caseInfoTitle},</if>
<if test="configTypeId != null">config_type_id = #{configTypeId},</if>
<if test="typicalFlag != null and typicalFlag != ''">typical_flag = #{typicalFlag},</if>
<if test="caseInfoDesc != null and caseInfoDesc != ''">case_info_desc = #{caseInfoDesc},</if>
<if test="caseInfoPic != null and caseInfoPic != ''">case_info_pic = #{caseInfoPic},</if>
<if test="caseInfoHtml != null and caseInfoHtml != ''">case_info_html = #{caseInfoHtml},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where case_info_id = #{caseInfoId}
</update>
<delete id="deleteHwProductCaseInfoByCaseInfoId" parameterType="Long">
delete from hw_product_case_info where case_info_id = #{caseInfoId}
</delete>
<delete id="deleteHwProductCaseInfoByCaseInfoIds" parameterType="String">
delete from hw_product_case_info where case_info_id in
<foreach item="caseInfoId" collection="array" open="(" separator="," close=")">
#{caseInfoId}
</foreach>
</delete>
<sql id="selectHwProductCaseInfoJoinVo">
select hpci.case_info_id, hpci.case_info_title, hpci.config_type_id, hpci.typical_flag, hpci.case_info_desc, hpci.case_info_pic, hpci.create_time,
hpci.create_by, hpci.update_time, hpci.update_by,hpct.config_type_name from hw_product_case_info hpci left join hw_portal_config_type hpct on hpci.config_type_id=hpct.config_type_id
</sql>
<select id="selectHwProductCaseInfoJoinList" parameterType="HwProductCaseInfo" resultMap="HwProductCaseInfoResult">
<include refid="selectHwProductCaseInfoJoinVo"/>
<where>
<if test="caseInfoTitle != null and caseInfoTitle != ''"> and hpci.case_info_title like concat('%', #{caseInfoTitle}, '%')</if>
<if test="configTypeId != null and configTypeId != ''"> and hpci.config_type_id = #{configTypeId}</if>
<if test="typicalFlag != null and typicalFlag != ''"> and hpci.typical_flag = #{typicalFlag}</if>
<if test="caseInfoDesc != null and caseInfoDesc != ''"> and case_info_desc = #{caseInfoDesc}</if>
<if test="caseInfoPic != null and caseInfoPic != ''"> and case_info_pic = #{caseInfoPic}</if>
<if test="caseInfoHtml != null and caseInfoHtml != ''"> and case_info_html = #{caseInfoHtml}</if>
<if test="homeTypicalFlag != null and homeTypicalFlag != '' and configTypeId!=null"> and exists (select 1 from hw_portal_config_type hpct where hpct.parent_id=#{configTypeId} and hpct.config_type_id =hpci.config_type_id)</if>
<if test='(homeTypicalFlag == null or homeTypicalFlag == "") and configTypeId != null '> and config_type_id = #{configTypeId}</if>
</where>
</select>
</mapper>