TDeptInfoMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.TDeptInfoMapper">
  6. <resultMap type="TDeptInfo" id="TDeptInfoResult">
  7. <result property="id" column="id" />
  8. <result property="deptInfo" column="dept_info" />
  9. <result property="deptId" column="dept_id" />
  10. <result property="year" column="year" />
  11. <result property="deptName" column="dept_name" />
  12. </resultMap>
  13. <sql id="selectTDeptInfoVo">
  14. select i.id, i.dept_info, i.dept_id, d.dept_name , i.year from t_dept_info i
  15. left join sys_dept d on i.dept_id = d.dept_id
  16. </sql>
  17. <select id="selectTDeptInfoList" parameterType="TDeptInfo" resultMap="TDeptInfoResult">
  18. <include refid="selectTDeptInfoVo"/>
  19. <where>
  20. <if test="year != null and year != ''"> and i.year = #{year}</if>
  21. <if test="deptInfo != null and deptInfo != ''"> and i.dept_info = #{deptInfo}</if>
  22. <if test="deptId != null "> and i.dept_id like concat(concat('%', #{deptId}), '%')</if>
  23. ${params.dataScope}
  24. </where>
  25. </select>
  26. <select id="selectTDeptInfoById" parameterType="Long" resultMap="TDeptInfoResult">
  27. <include refid="selectTDeptInfoVo"/>
  28. where i.id = #{id}
  29. </select>
  30. <insert id="insertTDeptInfo" parameterType="TDeptInfo" useGeneratedKeys="true" keyProperty="id">
  31. insert into t_dept_info
  32. <trim prefix="(" suffix=")" suffixOverrides=",">
  33. <if test="deptInfo != null">dept_info,</if>
  34. <if test="deptId != null">dept_id,</if>
  35. <if test="year != null">year,</if>
  36. </trim>
  37. <trim prefix="values (" suffix=")" suffixOverrides=",">
  38. <if test="deptInfo != null">#{deptInfo},</if>
  39. <if test="deptId != null">#{deptId},</if>
  40. <if test="year != null">#{year},</if>
  41. </trim>
  42. </insert>
  43. <update id="updateTDeptInfo" parameterType="TDeptInfo">
  44. update t_dept_info
  45. <trim prefix="SET" suffixOverrides=",">
  46. <if test="deptInfo != null">dept_info = #{deptInfo},</if>
  47. <if test="deptId != null">dept_id = #{deptId},</if>
  48. <if test="year != null">year = #{year},</if>
  49. </trim>
  50. where id = #{id}
  51. </update>
  52. <delete id="deleteTDeptInfoById" parameterType="Long">
  53. delete from t_dept_info where id = #{id}
  54. </delete>
  55. <delete id="deleteTDeptInfoByIds" parameterType="String">
  56. delete from t_dept_info where id in
  57. <foreach item="id" collection="array" open="(" separator="," close=")">
  58. #{id}
  59. </foreach>
  60. </delete>
  61. </mapper>