wl
2022-11-17 d77171ee108ed708800d53fed174726be359b058
ycl-platform/src/main/resources/dao/NewsDepartmentDao.xml
File was renamed from ycl-platform/src/main/resources/mapper/NewsDepartmentDao.xml
@@ -1,29 +1,29 @@
<?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.NewsDepartmentDao">
    <resultMap type="com.ycl.entity.NewsDepartment" id="NewsDepartmentMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 批量插入 -->
    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
        insert into news_website.news_department(deptname)
        values
        <foreach collection="entities" item="entity" separator=",">
        (#{entity.deptname})
        </foreach>
    </insert>
    <!-- 批量插入或按主键更新 -->
    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
        insert into news_website.news_department(deptname)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.deptname})
        </foreach>
        on duplicate key update
         deptname = values(deptname)     </insert>
</mapper>
<?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.mapper.NewsDepartmentDao">
    <resultMap type="com.ycl.entity.NewsDepartment" id="NewsDepartmentMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 批量插入 -->
    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
        insert into news_website.news_department(deptname)
        values
        <foreach collection="entities" item="entity" separator=",">
        (#{entity.deptname})
        </foreach>
    </insert>
    <!-- 批量插入或按主键更新 -->
    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
        insert into news_website.news_department(deptname)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.deptname})
        </foreach>
        on duplicate key update
         deptname = values(deptname)     </insert>
</mapper>