SyVocationalMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.ruoyi.sy.mapper.SyVocationalMapper">
  6. <resultMap type="SyVocational" id="SyVocationalResult">
  7. <result property="id" column="id" />
  8. <result property="code" column="code" />
  9. <result property="parentCode" column="parent_code" />
  10. <result property="name" column="name" />
  11. <result property="level" column="level" />
  12. <result property="createTime" column="create_time" />
  13. <result property="ancestors" column="ancestors" />
  14. <result property="childCount" column="child_count" />
  15. <result property="grandchildCount" column="grandchild_count" />
  16. </resultMap>
  17. <sql id="selectSyVocationalVo">
  18. select id, code, parent_code, name, level, create_time, ancestors,child_count ,grandchild_count from sy_vocational
  19. </sql>
  20. <select id="selectSyVocationalList" parameterType="SyVocational" resultMap="SyVocationalResult">
  21. <include refid="selectSyVocationalVo"/>
  22. <where>
  23. <if test="code != null and code != ''"> and code = #{code}</if>
  24. <if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
  25. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  26. <if test="level != null "> and level = #{level}</if>
  27. <if test="childCount != null "> and child_count = #{childCount}</if>
  28. <if test="grandchildCount != null "> and grandchild_count = #{grandchildCount}</if>
  29. <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
  30. </where>
  31. </select>
  32. <select id="selectSyVocationalById" parameterType="Long" resultMap="SyVocationalResult">
  33. <include refid="selectSyVocationalVo"/>
  34. where id = #{id}
  35. </select>
  36. <insert id="insertSyVocational" parameterType="SyVocational" useGeneratedKeys="true" keyProperty="id">
  37. insert into sy_vocational
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="code != null">code,</if>
  40. <if test="parentCode != null">parent_code,</if>
  41. <if test="name != null">name,</if>
  42. <if test="level != null">level,</if>
  43. <if test="createTime != null">create_time,</if>
  44. <if test="ancestors != null">ancestors,</if>
  45. <if test="childCount != null">child_count,</if>
  46. <if test="grandchildCount != null">grandchild_count,</if>
  47. </trim>
  48. <trim prefix="values (" suffix=")" suffixOverrides=",">
  49. <if test="code != null">#{code},</if>
  50. <if test="parentCode != null">#{parentCode},</if>
  51. <if test="name != null">#{name},</if>
  52. <if test="level != null">#{level},</if>
  53. <if test="createTime != null">#{createTime},</if>
  54. <if test="ancestors != null">#{ancestors},</if>
  55. <if test="childCount != null">#{childCount},</if>
  56. <if test="grandchildCount != null">#{grandchildCount},</if>
  57. </trim>
  58. </insert>
  59. <update id="updateSyVocational" parameterType="SyVocational">
  60. update sy_vocational
  61. <trim prefix="SET" suffixOverrides=",">
  62. <if test="code != null">code = #{code},</if>
  63. <if test="parentCode != null">parent_code = #{parentCode},</if>
  64. <if test="name != null">name = #{name},</if>
  65. <if test="level != null">level = #{level},</if>
  66. <if test="createTime != null">create_time = #{createTime},</if>
  67. <if test="ancestors != null">ancestors = #{ancestors},</if>
  68. <if test="childCount != null">child_count = #{childCount},</if>
  69. <if test="grandchildCount != null">grandchild_count = #{grandchildCount},</if>
  70. </trim>
  71. where id = #{id}
  72. </update>
  73. <delete id="deleteSyVocationalById" parameterType="Long">
  74. delete from sy_vocational where id = #{id}
  75. </delete>
  76. <delete id="deleteSyVocationalByIds" parameterType="String">
  77. delete from sy_vocational where id in
  78. <foreach item="id" collection="array" open="(" separator="," close=")">
  79. #{id}
  80. </foreach>
  81. </delete>
  82. </mapper>