151 lines
7.1 KiB
XML
151 lines
7.1 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.yanzhu.jh.base.mapper.BaseMagDetailMapper">
|
|
|
|
<resultMap type="BaseMagDetail" id="BaseMagDetailResult">
|
|
<result property="id" column="id" />
|
|
<result property="magid" column="magid" />
|
|
<result property="topic" column="topic" />
|
|
<result property="title" column="title" />
|
|
<result property="deptid" column="deptid" />
|
|
<result property="authorName" column="authorName" />
|
|
<result property="authorPhone" column="authorPhone" />
|
|
<result property="ord" column="ord" />
|
|
<result property="images" column="images" />
|
|
<result property="content" column="content" />
|
|
<result property="remark" column="remark" />
|
|
<result property="isDel" column="is_del" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="name" column="name"/>
|
|
<result property="deptName" column="deptName"/>
|
|
<result property="topicName" column="topicName"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectBaseMagDetailVo">
|
|
select * from (select a.id,
|
|
a.magid,
|
|
a.topic,
|
|
a.title,
|
|
a.deptid,
|
|
a.authorName,
|
|
a.authorPhone,
|
|
a.ord,
|
|
a.images,
|
|
a.content,
|
|
a.remark,
|
|
a.is_del,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
b.name,
|
|
c.dept_name deptName,
|
|
d.dict_label topicName
|
|
FROM base_mag_detail a,
|
|
base_mag b,
|
|
sys_dept c,
|
|
sys_dict_data d
|
|
WHERE a.magid = b.id
|
|
AND a.deptid = c.dept_id
|
|
AND a.topic = d.dict_value
|
|
AND d.dict_type = 'base_mag_topic') base_mag_detail
|
|
</sql>
|
|
|
|
<select id="selectBaseMagDetailList" parameterType="BaseMagDetail" resultMap="BaseMagDetailResult">
|
|
<include refid="selectBaseMagDetailVo"/>
|
|
<where>
|
|
<if test="magid != null "> and magid = #{magid}</if>
|
|
<if test="topic != null "> and topic = #{topic}</if>
|
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
|
<if test="deptid != null "> and deptid = #{deptid}</if>
|
|
<if test="authorName != null and authorName != ''"> and authorName like concat('%', #{authorName}, '%')</if>
|
|
<if test="authorPhone != null and authorPhone != ''"> and authorPhone = #{authorPhone}</if>
|
|
<if test="ord != null "> and ord = #{ord}</if>
|
|
<if test="images != null and images != ''"> and images = #{images}</if>
|
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
|
<if test="isDel != null "> and is_del = #{isDel}</if>
|
|
</where>
|
|
order by ord desc,create_time desc
|
|
</select>
|
|
|
|
<select id="selectBaseMagDetailById" parameterType="Long" resultMap="BaseMagDetailResult">
|
|
<include refid="selectBaseMagDetailVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertBaseMagDetail" parameterType="BaseMagDetail" useGeneratedKeys="true" keyProperty="id">
|
|
insert into base_mag_detail
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="magid != null">magid,</if>
|
|
<if test="topic != null">topic,</if>
|
|
<if test="title != null">title,</if>
|
|
<if test="deptid != null">deptid,</if>
|
|
<if test="authorName != null">authorName,</if>
|
|
<if test="authorPhone != null">authorPhone,</if>
|
|
<if test="ord != null">ord,</if>
|
|
<if test="images != null">images,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="isDel != null">is_del,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="magid != null">#{magid},</if>
|
|
<if test="topic != null">#{topic},</if>
|
|
<if test="title != null">#{title},</if>
|
|
<if test="deptid != null">#{deptid},</if>
|
|
<if test="authorName != null">#{authorName},</if>
|
|
<if test="authorPhone != null">#{authorPhone},</if>
|
|
<if test="ord != null">#{ord},</if>
|
|
<if test="images != null">#{images},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateBaseMagDetail" parameterType="BaseMagDetail">
|
|
update base_mag_detail
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="magid != null">magid = #{magid},</if>
|
|
<if test="topic != null">topic = #{topic},</if>
|
|
<if test="title != null">title = #{title},</if>
|
|
<if test="deptid != null">deptid = #{deptid},</if>
|
|
<if test="authorName != null">authorName = #{authorName},</if>
|
|
<if test="authorPhone != null">authorPhone = #{authorPhone},</if>
|
|
<if test="ord != null">ord = #{ord},</if>
|
|
<if test="images != null">images = #{images},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteBaseMagDetailById" parameterType="Long">
|
|
delete from base_mag_detail where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteBaseMagDetailByIds" parameterType="String">
|
|
delete from base_mag_detail where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |