ArticleDao.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.zglc.kg.dao.ArticleDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.zglc.kg.entity.ArticleEntity" id="article">
  6. <result property="id" column="id"/>
  7. <result property="title" column="title"/>
  8. <result property="author" column="author"/>
  9. <result property="input_time" column="input_time"/>
  10. <result property="keywords" column="keywords"/>
  11. <result property="aircraft" column="aircraft"/>
  12. <result property="aircraft_system" column="aircraft_system"/>
  13. <result property="article_number" column="article_number"/>
  14. <result property="major_name" column="major_name"/>
  15. <result property="article_type" column="article_type"/>
  16. <result property="file_path" column="file_path"/>
  17. <result property="hmc" column="hmc"/>
  18. <result property="mfl" column="mfl"/>
  19. <result property="pfl" column="pfl"/>
  20. <result property="gmp" column="gmp"/>
  21. </resultMap>
  22. <select id="find" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
  23. select * from t_article where 1=1
  24. <if test="userName != null">
  25. and author like (CONCAT(CONCAT('%',#{userName}),'%'))
  26. </if>
  27. <if test="keyword != null">
  28. and keywords like (CONCAT(CONCAT('%',#{keyword}),'%'))
  29. </if>
  30. <!-- <if test="startTime != null">-->
  31. <!-- and input_time <![CDATA[>=]]> #{startTime}-->
  32. <!-- </if>-->
  33. <!-- <if test="endTime != null">-->
  34. <!-- and input_time <![CDATA[<=]]> {endTime}-->
  35. <!-- </if>-->
  36. </select>
  37. <select id="find1" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
  38. select * from t_article where 1=1
  39. <if test="userName != null">
  40. and author like (CONCAT(CONCAT('%',#{userName}),'%'))
  41. </if>
  42. <if test="keyword != null">
  43. and title like (CONCAT(CONCAT('%',#{keyword}),'%'))
  44. </if>
  45. </select>
  46. <select id="findByName" parameterType="String" resultMap="article">
  47. select * from t_article where title like #{name}
  48. </select>
  49. <select id="refindByName" parameterType="String" resultMap="article">
  50. select * from (select * from t_article where title like #{name1} ) as a where title like #{name2}
  51. </select>
  52. <select id="multFind" parameterType="com.zglc.kg.entity.ArticleFind" resultMap="article">
  53. select * from (select * from t_article where )
  54. <if test="userName != null">
  55. and author like (CONCAT(CONCAT('%',#{userName}),'%'))
  56. </if>
  57. <if test="keyword != null">
  58. and keywords like (CONCAT(CONCAT('%',#{keyword}),'%'))
  59. </if>
  60. </select>
  61. <insert id="add" parameterType="com.zglc.kg.entity.ArticleEntity">
  62. 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
  63. (#{title},#{author},#{input_time},#{keywords},#{aircraft},#{aircraft_system},#{article_number},#{major_name},#{article_type},#{file_path},#{item.hmc},#{item.mfl},#{item.pfl},#{item.gmp})
  64. </insert>
  65. <insert id="addBatch" parameterType="java.util.ArrayList">
  66. 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
  67. <foreach collection="list" item="item" separator=",">
  68. (#{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})
  69. </foreach>
  70. </insert>
  71. </mapper>