From a499e5a737991461554805af6b72fba65a680776 Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期五, 07 四月 2023 11:53:41 +0800 Subject: [PATCH] 更改环境 --- ycl-platform/src/main/resources/mapper/NewsInformationDao.xml | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml b/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml index a82123f..c51a481 100644 --- a/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml +++ b/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml @@ -1,6 +1,6 @@ <?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.ycl.dao.NewsInformationDao"> +<mapper namespace="com.ycl.mapper.NewsInformationDao"> <resultMap type="com.ycl.entity.NewsInformation" id="NewsInformationMap"> <result property="id" column="id" jdbcType="VARCHAR"/> @@ -11,26 +11,65 @@ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="sendTo" column="send_to" jdbcType="VARCHAR"/> <result property="imageUrl" column="image_url" jdbcType="VARCHAR"/> - <result property="newsDepartmentId" column="news_department_id" jdbcType="VARCHAR"/> </resultMap> <!-- 鎵归噺鎻掑叆 --> <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> - insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url, news_department_id) + insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url) values <foreach collection="entities" item="entity" separator=","> - (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}, #{entity.newsDepartmentId}) + (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}) </foreach> </insert> <!-- 鎵归噺鎻掑叆鎴栨寜涓婚敭鏇存柊 --> <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> - insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url, news_department_id) + insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url) values <foreach collection="entities" item="entity" separator=","> - (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}, #{entity.newsDepartmentId}) + (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}) </foreach> on duplicate key update - title = values(title) , content = values(content) , publish_time = values(publish_time) , is_sign = values(is_sign) , create_time = values(create_time) , send_to = values(send_to) , image_url = values(image_url) , news_department_id = values(news_department_id) </insert> + title = values(title) , content = values(content) , publish_time = values(publish_time) , is_sign = values(is_sign) , create_time = values(create_time) , send_to = values(send_to) , image_url = values(image_url) </insert> + <insert id="insertOneInformation" keyProperty="id" useGeneratedKeys="true"> + insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url) + values (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}) + </insert> + + <select id="selectInformationById" resultType="com.ycl.entity.NewsInformation" parameterType="int"> + select * from news_information where id=#{InformationId} + </select> + + <select id="selectAllInformation" resultType="com.ycl.entity.NewsInformation"> + select * from news_information + </select> + + <update id="updateInformationById" parameterType="com.ycl.entity.NewsInformation"> + update news_information + <trim prefix="set" suffixOverrides=","> + <if test="entity.title!=null and entity.title!=''"> + title=#{entity.title}, + </if> + <if test="entity.content!=null and entity.content!=''"> + content=#{entity.content}, + </if> + <if test="entity.publishTime!=null "> + publish_time=#{entity.publishTime}, + </if> + <if test="entity.isSign!=null and entity.isSign!=''"> + is_sign=#{entity.isSign}, + </if> + <if test="entity.createTime!=null "> + create_time=#{entity.createTime}, + </if> + <if test="entity.sendTo!=null and entity.sendTo!=''"> + send_to=#{entity.sendTo}, + </if> + <if test="entity.imageUrl!=null and entity.imageUrl!=''"> + image_url=#{entity.imageUrl}, + </if> + </trim> + where id=#{entity.id} + </update> </mapper> -- Gitblit v1.8.0