73 lines
2.4 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.xhpc.general.mapper.XhpcHelpMapper">
<resultMap id="BaseResultMap" type="com.xhpc.general.domain.HelpEntity">
<result property="helpId" column="help_id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="type" column="type"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<!-- 通用查询映射结果 -->
<update id="deleteHelpItem">
update xhpc_help set del_flag=1 where help_id=#{helpId};
</update>
<select id="countSameTypeTitle" resultType="java.lang.Integer">
select count(title) from xhpc_help where type=#{type} and title=#{title} and del_flag=0;
</select>
<insert id="insertHelpItem">
insert xhpc_help (title,content,type) values (#{title},#{content},#{type});
</insert>
<update id="updateHelpItem">
update xhpc_help set title=#{title},content=#{content},type=#{type} where help_id=#{helpId};
</update>
<select id="selectHelpItems" resultMap="BaseResultMap">
select * from xhpc_help
where del_flag=0
<if test="title!=null and title!=''">
and title like concat('%',#{title},'%')
</if>
<if test="createBy!=null and createBy!=''">
and create_by like concat('%',#{createBy},'%')
</if>
<if test="type!=null">
and type=#{type}
</if>
</select>
<select id="selectHelpItem" resultMap="BaseResultMap">
select * from xhpc_help
where help_id=#{helpId}
</select>
<select id="selectTitleId" resultType="map">
select help_id as helpId,title
from xhpc_help
where type=#{type} and status=0 and del_flag=0
</select>
<select id="selectDetails" resultType="map">
select title,cast(content as char) as content
from xhpc_help
where help_id=#{helpId}
</select>
</mapper>