1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?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.zglc.kg.dao.ArticleDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.zglc.kg.entity.ArticleEntity" id="article">
- <result property="id" column="id"/>
- <result property="title" column="title"/>
- <result property="author" column="author"/>
- <result property="input_time" column="input_time"/>
- <result property="keywords" column="keywords"/>
- <result property="aircraft" column="aircraft"/>
- <result property="aircraft_system" column="aircraft_system"/>
- <result property="article_number" column="article_number"/>
- <result property="major_name" column="major_name"/>
- <result property="article_type" column="article_type"/>
- <result property="file_path" column="file_path"/>
- <result property="hmc" column="hmc"/>
- <result property="mfl" column="mfl"/>
- <result property="pfl" column="pfl"/>
- <result property="gmp" column="gmp"/>
- </resultMap>
- <select id="find" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
- select * from t_article where 1=1
- <if test="userName != null">
- and author like (CONCAT(CONCAT('%',#{userName}),'%'))
- </if>
- <if test="keyword != null">
- and keywords like (CONCAT(CONCAT('%',#{keyword}),'%'))
- </if>
- <!-- <if test="startTime != null">-->
- <!-- and input_time <![CDATA[>=]]> #{startTime}-->
- <!-- </if>-->
- <!-- <if test="endTime != null">-->
- <!-- and input_time <![CDATA[<=]]> {endTime}-->
- <!-- </if>-->
- </select>
- <select id="find1" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
- select * from t_article where 1=1
- <if test="userName != null">
- and author like (CONCAT(CONCAT('%',#{userName}),'%'))
- </if>
- <if test="keyword != null">
- and title like (CONCAT(CONCAT('%',#{keyword}),'%'))
- </if>
- </select>
- <select id="findByName" parameterType="String" resultMap="article">
- select * from t_article where title like #{name}
- </select>
- <select id="refindByName" parameterType="String" resultMap="article">
- select * from (select * from t_article where title like #{name1} ) as a where title like #{name2}
- </select>
- <select id="multFind" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
- select * from (select * from t_article where )
- <if test="userName != null">
- and author like (CONCAT(CONCAT('%',#{userName}),'%'))
- </if>
- <if test="keyword != null">
- and keywords like (CONCAT(CONCAT('%',#{keyword}),'%'))
- </if>
- </select>
- <insert id="add" parameterType="com.zglc.kg.entity.ArticleEntity">
- insert into t_article (title,author,input_time,keywords,aircraft,aircraft_system,article_number,major_name,article_type,file_path,hmc,mfl,pfl,gmp) values
- (#{title},#{author},#{input_time},#{keywords},#{aircraft},#{aircraft_system},#{article_number},#{major_name},#{article_type},#{file_path},#{item.hmc},#{item.mfl},#{item.pfl},#{item.gmp})
- </insert>
- <insert id="addBatch" parameterType="java.util.ArrayList">
- insert into t_article(title,author,input_time,keywords,aircraft,aircraft_system,article_number,major_name,article_type,file_path,hmc,mfl,pfl,gmp) values
- <foreach collection="list" item="item" separator=",">
- (#{item.title},#{item.author},#{item.input_time},#{item.keywords},#{item.aircraft},#{item.aircraft_system},#{item.article_number},#{item.major_name},#{item.article_type},#{item.file_path},#{item.hmc},#{item.mfl},#{item.pfl},#{item.gmp})
- </foreach>
- </insert>
- </mapper>
|