SyVocationalPostMapper.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.SyVocationalPostMapper">
  6. <resultMap type="SyVocationalPost" id="SyVocationalPostResult">
  7. <result property="id" column="id" />
  8. <result property="code" column="code" />
  9. <result property="name" column="name" />
  10. <result property="salaryMax" column="salary_max" />
  11. <result property="salaryMin" column="salary_min" />
  12. <result property="salaryUnit" column="salary_unit" />
  13. <result property="createTime" column="create_time" />
  14. </resultMap>
  15. <sql id="selectSyVocationalPostVo">
  16. select id, code, name, salary_max, salary_min, salary_unit, create_time from sy_vocational_post
  17. </sql>
  18. <select id="selectSyVocationalPostList" parameterType="SyVocationalPost" resultMap="SyVocationalPostResult">
  19. <include refid="selectSyVocationalPostVo"/>
  20. <where>
  21. <if test="code != null and code != ''"> and code = #{, '%')}</if>
  22. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  23. <if test="salaryMax != null and salaryMax != ''"> and salary_max = #{salaryMax}</if>
  24. <if test="salaryMin != null and salaryMin != ''"> and salary_min = #{salaryMin}</if>
  25. <if test="salaryUnit != null and salaryUnit != ''"> and salary_unit = #{salaryUnit}</if>
  26. </where>
  27. </select>
  28. <select id="selectSyVocationalPostById" parameterType="Long" resultMap="SyVocationalPostResult">
  29. <include refid="selectSyVocationalPostVo"/>
  30. where id = #{id}
  31. </select>
  32. <select id="selectSyVocationalPostByVocationalCode" parameterType="String" resultMap="SyVocationalPostResult">
  33. <include refid="selectSyVocationalPostVo"/>
  34. where code = #{code}
  35. </select>
  36. <insert id="insertSyVocationalPost" parameterType="SyVocationalPost" useGeneratedKeys="true" keyProperty="id">
  37. insert into sy_vocational_post
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="name != null">name,</if>
  40. <if test="salaryMax != null">salary_max,</if>
  41. <if test="salaryMin != null">salary_min,</if>
  42. <if test="salaryUnit != null">salary_unit,</if>
  43. <if test="createTime != null">create_time,</if>
  44. </trim>
  45. <trim prefix="values (" suffix=")" suffixOverrides=",">
  46. <if test="name != null">#{name},</if>
  47. <if test="salaryMax != null">#{salaryMax},</if>
  48. <if test="salaryMin != null">#{salaryMin},</if>
  49. <if test="salaryUnit != null">#{salaryUnit},</if>
  50. <if test="createTime != null">#{createTime},</if>
  51. </trim>
  52. </insert>
  53. <update id="updateSyVocationalPost" parameterType="SyVocationalPost">
  54. update sy_vocational_post
  55. <trim prefix="SET" suffixOverrides=",">
  56. <if test="name != null">name = #{name},</if>
  57. <if test="salaryMax != null">salary_max = #{salaryMax},</if>
  58. <if test="salaryMin != null">salary_min = #{salaryMin},</if>
  59. <if test="salaryUnit != null">salary_unit = #{salaryUnit},</if>
  60. <if test="createTime != null">create_time = #{createTime},</if>
  61. </trim>
  62. where id = #{id}
  63. </update>
  64. <delete id="deleteSyVocationalPostById" parameterType="Long">
  65. delete from sy_vocational_post where id = #{id}
  66. </delete>
  67. <delete id="deleteSyVocationalPostByIds" parameterType="String">
  68. delete from sy_vocational_post where id in
  69. <foreach item="id" collection="array" open="(" separator="," close=")">
  70. #{id}
  71. </foreach>
  72. </delete>
  73. </mapper>