lanan-system/dl-module-inspection/src/main/resources/mapper/inspection/InspectionNewsAssociationMapper.xml
2024-08-31 00:08:49 +08:00

83 lines
4.0 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="cn.iocoder.yudao.module.inspection.mapper.InspectionNewsAssociationMapper">
<resultMap type="cn.iocoder.yudao.module.inspection.entity.InspectionNewsAssociation" id="InspectionNewsAssociationResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="newsId" column="news_id" />
<result property="type" column="type" />
<result property="createTime" column="create_time" />
<result property="creator" column="creator" />
<result property="updateTime" column="update_time" />
<result property="updater" column="updater" />
</resultMap>
<sql id="selectInspectionNewsAssociationVo">
select id, user_id, news_id, type, create_time, creator, update_time, updater from inspection_news_association
</sql>
<select id="selectInspectionNewsAssociationList" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionNewsAssociation" resultMap="InspectionNewsAssociationResult">
<include refid="selectInspectionNewsAssociationVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="newsId != null "> and news_id = #{newsId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
</select>
<select id="selectInspectionNewsAssociationById" parameterType="Long" resultMap="InspectionNewsAssociationResult">
<include refid="selectInspectionNewsAssociationVo"/>
where id = #{id}
</select>
<insert id="insertInspectionNewsAssociation" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionNewsAssociation" useGeneratedKeys="true" keyProperty="id">
insert into inspection_news_association
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="newsId != null">news_id,</if>
<if test="type != null">type,</if>
<if test="createTime != null">create_time,</if>
<if test="creator != null">creator,</if>
<if test="updateTime != null">update_time,</if>
<if test="updater != null">updater,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="newsId != null">#{newsId},</if>
<if test="type != null">#{type},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creator != null">#{creator},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updater != null">#{updater},</if>
</trim>
</insert>
<update id="updateInspectionNewsAssociation" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionNewsAssociation">
update inspection_news_association
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="newsId != null">news_id = #{newsId},</if>
<if test="type != null">type = #{type},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updater != null">updater = #{updater},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInspectionNewsAssociationById" parameterType="Long">
delete from inspection_news_association where id = #{id}
</delete>
<delete id="deleteInspectionNewsAssociationByIds" parameterType="String">
delete from inspection_news_association where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>