CompanyHonourMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.dgtly.companyext.mapper.CompanyHonourMapper">
  6. <resultMap type="CompanyHonour" id="CompanyHonourResult">
  7. <result property="honourId" column="honour_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="des" column="des" />
  10. <result property="img" column="img" />
  11. <result property="createBy" column="create_by" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateBy" column="update_by" />
  14. <result property="updateTime" column="update_time" />
  15. <result property="remark" column="remark" />
  16. </resultMap>
  17. <sql id="selectCompanyHonourVo">
  18. select honour_id, company_id, des, img, create_by, create_time, update_by, update_time, remark from company_honour
  19. </sql>
  20. <select id="selectCompanyHonourList" parameterType="CompanyHonour" resultMap="CompanyHonourResult">
  21. <include refid="selectCompanyHonourVo"/>
  22. <where>
  23. <if test="companyId != null "> and company_id = #{companyId}</if>
  24. <if test="des != null and des != ''"> and des = #{des}</if>
  25. <if test="img != null and img != ''"> and img = #{img}</if>
  26. </where>
  27. </select>
  28. <select id="selectCompanyHonourById" parameterType="Long" resultMap="CompanyHonourResult">
  29. <include refid="selectCompanyHonourVo"/>
  30. where honour_id = #{honourId}
  31. </select>
  32. <insert id="insertCompanyHonour" parameterType="CompanyHonour" useGeneratedKeys="true" keyProperty="honourId">
  33. insert into company_honour
  34. <trim prefix="(" suffix=")" suffixOverrides=",">
  35. <if test="companyId != null ">company_id,</if>
  36. <if test="des != null and des != ''">des,</if>
  37. <if test="img != null and img != ''">img,</if>
  38. <if test="createBy != null and createBy != ''">create_by,</if>
  39. <if test="createTime != null ">create_time,</if>
  40. <if test="updateBy != null and updateBy != ''">update_by,</if>
  41. <if test="updateTime != null ">update_time,</if>
  42. <if test="remark != null and remark != ''">remark,</if>
  43. </trim>
  44. <trim prefix="values (" suffix=")" suffixOverrides=",">
  45. <if test="companyId != null ">#{companyId},</if>
  46. <if test="des != null and des != ''">#{des},</if>
  47. <if test="img != null and img != ''">#{img},</if>
  48. <if test="createBy != null and createBy != ''">#{createBy},</if>
  49. <if test="createTime != null ">#{createTime},</if>
  50. <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
  51. <if test="updateTime != null ">#{updateTime},</if>
  52. <if test="remark != null and remark != ''">#{remark},</if>
  53. </trim>
  54. </insert>
  55. <update id="updateCompanyHonour" parameterType="CompanyHonour">
  56. update company_honour
  57. <trim prefix="SET" suffixOverrides=",">
  58. <if test="companyId != null ">company_id = #{companyId},</if>
  59. <if test="des != null and des != ''">des = #{des},</if>
  60. <if test="img != null and img != ''">img = #{img},</if>
  61. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  62. <if test="createTime != null ">create_time = #{createTime},</if>
  63. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  64. <if test="updateTime != null ">update_time = #{updateTime},</if>
  65. <if test="remark != null and remark != ''">remark = #{remark},</if>
  66. </trim>
  67. where honour_id = #{honourId}
  68. </update>
  69. <delete id="deleteCompanyHonourById" parameterType="Long">
  70. delete from company_honour where honour_id = #{honourId}
  71. </delete>
  72. <delete id="deleteCompanyHonourByIds" parameterType="String">
  73. delete from company_honour where honour_id in
  74. <foreach item="honourId" collection="array" open="(" separator="," close=")">
  75. #{honourId}
  76. </foreach>
  77. </delete>
  78. </mapper>