JlRegionMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.ygj.yuemum.dao.admin.JlRegionDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.admin.JlRegion" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="pid" property="pid" jdbcType="INTEGER" />
  7. <result column="name" property="name" jdbcType="VARCHAR" />
  8. <result column="sort" property="sort" jdbcType="INTEGER" />
  9. <result column="code" property="code" jdbcType="VARCHAR" />
  10. <result column="type" property="type" jdbcType="INTEGER" />
  11. <result column="is_service" property="is_service" jdbcType="INTEGER" />
  12. <result column="updated_at" property="updated_at" jdbcType="DATE" />
  13. </resultMap>
  14. <sql id="Base_Column_List" >
  15. id, pid, name,sort,code,type,is_service,updated_at
  16. </sql>
  17. <!-- 得到所有的城市信息 -->
  18. <select id="getAll" resultMap="BaseResultMap" >
  19. select
  20. <include refid="Base_Column_List" />
  21. from jl_region
  22. </select>
  23. <!-- 根据id查找某个城市信息 -->
  24. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  25. select
  26. <include refid="Base_Column_List" />
  27. from jl_region
  28. where pid = #{pid,jdbcType=INTEGER}
  29. </select>
  30. <!-- 根据id删除某个城市信息 -->
  31. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  32. delete from jl_region
  33. where id = #{id,jdbcType=INTEGER}
  34. </delete>
  35. <!-- 插入一条城市信息 -->
  36. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.admin.JlRegion" >
  37. insert into jl_region
  38. <trim prefix="(" suffix=")" suffixOverrides="," >
  39. <if test="pid != null" >
  40. pid,
  41. </if>
  42. <if test="name != null" >
  43. name,
  44. </if>
  45. <if test="sort != null" >
  46. sort,
  47. </if>
  48. <if test="code != null" >
  49. code,
  50. </if>
  51. <if test="type != null" >
  52. type,
  53. </if>
  54. <if test="is_service != null" >
  55. is_service,
  56. </if>
  57. <if test="updated_at != null" >
  58. updated_at,
  59. </if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides="," >
  62. <if test="pid != null" >
  63. #{pid,jdbcType=INTEGER},
  64. </if>
  65. <if test="name != null" >
  66. #{name,jdbcType=VARCHAR},
  67. </if>
  68. <if test="sort != null" >
  69. #{sort,jdbcType=INTEGER},
  70. </if>
  71. <if test="code != null" >
  72. #{code,jdbcType=VARCHAR},
  73. </if>
  74. <if test="type != null" >
  75. #{type,jdbcType=INTEGER},
  76. </if>
  77. <if test="is_service != null" >
  78. #{is_service,jdbcType=INTEGER},
  79. </if>
  80. <if test="updated_at != null" >
  81. #{updated_at,jdbcType=DATE},
  82. </if>
  83. </trim>
  84. </insert>
  85. <!-- 根据id更新一条城市信息 -->
  86. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.admin.JlRegion" >
  87. update jl_region
  88. <set >
  89. <if test="pid != null" >
  90. pid = #{pid,jdbcType=INTEGER},
  91. </if>
  92. <if test="name != null" >
  93. name = #{name,jdbcType=VARCHAR},
  94. </if>
  95. <if test="sort != null" >
  96. sort = #{sort,jdbcType=INTEGER},
  97. </if>
  98. <if test="code != null" >
  99. code = #{code,jdbcType=VARCHAR},
  100. </if>
  101. <if test="type != null" >
  102. type = #{type,jdbcType=INTEGER},
  103. </if>
  104. <if test="is_service != null" >
  105. is_service = #{is_service,jdbcType=INTEGER},
  106. </if>
  107. <if test="updated_at != null" >
  108. updated_at = #{updated_at,jdbcType=DATE},
  109. </if>
  110. </set>
  111. where id = #{id,jdbcType=INTEGER}
  112. </update>
  113. </mapper>