SysAccountMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydtech.modules.admin.dao.SysAccountMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.SysAccount">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="name" jdbcType="VARCHAR" property="name"/>
  7. <result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
  8. <result column="order_num" jdbcType="INTEGER" property="orderNum"/>
  9. <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
  10. </resultMap>
  11. <sql id="Base_Column_List">
  12. id, name, dept_id, order_num, del_flag
  13. </sql>
  14. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  15. select
  16. <include refid="Base_Column_List"/>
  17. from sys_account
  18. where id = #{id,jdbcType=VARCHAR}
  19. </select>
  20. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  21. delete
  22. from sys_account
  23. where id = #{id,jdbcType=VARCHAR}
  24. </delete>
  25. <insert id="insert" parameterType="com.ydtech.modules.admin.model.SysAccount">
  26. insert into sys_account (id, name, dept_id,
  27. order_num, del_flag)
  28. values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{deptId,jdbcType=VARCHAR},
  29. #{orderNum,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER})
  30. </insert>
  31. <insert id="insertSelective" parameterType="com.ydtech.modules.admin.model.SysAccount">
  32. insert into sys_account
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="id != null">
  35. id,
  36. </if>
  37. <if test="name != null">
  38. name,
  39. </if>
  40. <if test="deptId != null">
  41. dept_id,
  42. </if>
  43. <if test="orderNum != null">
  44. order_num,
  45. </if>
  46. <if test="delFlag != null">
  47. del_flag,
  48. </if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="id != null">
  52. #{id,jdbcType=VARCHAR},
  53. </if>
  54. <if test="name != null">
  55. #{name,jdbcType=VARCHAR},
  56. </if>
  57. <if test="deptId != null">
  58. #{deptId,jdbcType=VARCHAR},
  59. </if>
  60. <if test="orderNum != null">
  61. #{orderNum,jdbcType=INTEGER},
  62. </if>
  63. <if test="delFlag != null">
  64. #{delFlag,jdbcType=INTEGER},
  65. </if>
  66. </trim>
  67. </insert>
  68. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.admin.model.SysAccount">
  69. update sys_account
  70. <set>
  71. <if test="name != null">
  72. name = #{name,jdbcType=VARCHAR},
  73. </if>
  74. <if test="deptId != null">
  75. dept_id = #{deptId,jdbcType=VARCHAR},
  76. </if>
  77. <if test="orderNum != null">
  78. order_num = #{orderNum,jdbcType=INTEGER},
  79. </if>
  80. <if test="delFlag != null">
  81. del_flag = #{delFlag,jdbcType=INTEGER},
  82. </if>
  83. </set>
  84. where id = #{id,jdbcType=VARCHAR}
  85. </update>
  86. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.admin.model.SysAccount">
  87. update sys_account
  88. set name = #{name,jdbcType=VARCHAR},
  89. dept_id = #{deptId,jdbcType=VARCHAR},
  90. order_num = #{orderNum,jdbcType=INTEGER},
  91. del_flag = #{delFlag,jdbcType=INTEGER}
  92. where id = #{id,jdbcType=VARCHAR}
  93. </update>
  94. <select id="findByDeptId" resultType="com.ydtech.modules.admin.model.SysAccount">
  95. select
  96. <include refid="Base_Column_List"/>
  97. from sys_account
  98. where dept_id = #{deptId,jdbcType=VARCHAR} and del_flag=0 order by order_num
  99. </select>
  100. </mapper>