TChapMapper.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.rc.mapper.TChapMapper">
  6. <resultMap type="TChap" id="TChapResult">
  7. <result property="id" column="id" />
  8. <result property="auditId" column="audit_id" />
  9. <result property="name" column="name" />
  10. <result property="deptId" column="dept_id" />
  11. </resultMap>
  12. <sql id="selectTChapVo">
  13. select id, audit_id, name, dept_id from t_chap
  14. </sql>
  15. <select id="selectTChapList" parameterType="TChap" resultMap="TChapResult">
  16. <include refid="selectTChapVo"/>
  17. <where>
  18. <if test="auditId != null "> and audit_id = #{auditId}</if>
  19. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  20. <if test="deptId != null "> and dept_id like concat(concat('%', #{deptId}), '%')</if>
  21. </where>
  22. </select>
  23. <select id="selectTChapById" parameterType="Long" resultMap="TChapResult">
  24. <include refid="selectTChapVo"/>
  25. where id = #{id}
  26. </select>
  27. <insert id="insertTChap" parameterType="TChap" useGeneratedKeys="true" keyProperty="id">
  28. insert into t_chap
  29. <trim prefix="(" suffix=")" suffixOverrides=",">
  30. <if test="auditId != null">audit_id,</if>
  31. <if test="name != null">name,</if>
  32. <if test="deptId != null">dept_id,</if>
  33. </trim>
  34. <trim prefix="values (" suffix=")" suffixOverrides=",">
  35. <if test="auditId != null">#{auditId},</if>
  36. <if test="name != null">#{name},</if>
  37. <if test="deptId != null">#{deptId},</if>
  38. </trim>
  39. </insert>
  40. <update id="updateTChap" parameterType="TChap">
  41. update t_chap
  42. <trim prefix="SET" suffixOverrides=",">
  43. <if test="auditId != null">audit_id = #{auditId},</if>
  44. <if test="name != null">name = #{name},</if>
  45. <if test="deptId != null">dept_id = #{deptId},</if>
  46. </trim>
  47. where id = #{id}
  48. </update>
  49. <delete id="deleteTChapById" parameterType="Long">
  50. delete from t_chap where id = #{id}
  51. </delete>
  52. <delete id="deleteTChapByIds" parameterType="String">
  53. delete from t_chap where id in
  54. <foreach item="id" collection="array" open="(" separator="," close=")">
  55. #{id}
  56. </foreach>
  57. </delete>
  58. </mapper>