ReplacementInstrumentMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.ReplacementInstrumentDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.ReplacementInstrument" id="ReplacementInstrument">
  9. <result column="id_" property="id" />
  10. <result column="subject_id_" property="subjectId" />
  11. <result column="brand_" property="brand" />
  12. <result column="specification_" property="specification" />
  13. <result column="param_" property="param" />
  14. <result column="market_price_" property="marketPrice" />
  15. <result column="discount_price_" property="discountPrice" />
  16. <result column="depreciation_price_" property="depreciationPrice" />
  17. <result column="sale_price_" property="salePrice" />
  18. <result column="create_time_" property="createTime" />
  19. <result column="update_time_" property="updateTime" />
  20. </resultMap>
  21. <!-- 根据主键查询一条记录 -->
  22. <select id="get" resultMap="ReplacementInstrument" >
  23. SELECT * FROM replacement_instrument WHERE id_ = #{id}
  24. </select>
  25. <!-- 全查询 -->
  26. <select id="findAll" resultMap="ReplacementInstrument">
  27. SELECT * FROM replacement_instrument
  28. </select>
  29. <!-- 向数据库增加一条记录 -->
  30. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrument" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  31. INSERT INTO replacement_instrument (subject_id_,brand_,specification_,param_,market_price_,discount_price_,depreciation_price_,sale_price_,create_time_,update_time_)
  32. VALUES(#{subjectId},#{brand},#{specification},#{param},#{marketPrice},#{discountPrice},#{depreciationPrice},#{salePrice},NOW(),NOW())
  33. </insert>
  34. <update id="update" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrument">
  35. UPDATE replacement_instrument <set>
  36. <if test="subjectId != null">
  37. subject_id_ = #{subjectId},
  38. </if>
  39. <if test="brand != null">
  40. brand_ = #{brand},
  41. </if>
  42. <if test="specification != null">
  43. specification_ = #{specification},
  44. </if>
  45. <if test="param != null">
  46. param_ = #{param},
  47. </if>
  48. <if test="marketPrice != null">
  49. market_price_ = #{marketPrice},
  50. </if>
  51. <if test="discountPrice != null">
  52. discount_price_ = #{discountPrice},
  53. </if>
  54. <if test="depreciationPrice != null">
  55. depreciation_price_ = #{depreciationPrice},
  56. </if>
  57. <if test="salePrice != null">
  58. sale_price_ = #{salePrice},
  59. </if>
  60. <if test="updateTime != null">
  61. update_time_ = #{updateTime},
  62. </if>
  63. </set> WHERE id_ = #{id}
  64. </update>
  65. <!-- 根据主键删除一条记录 -->
  66. <delete id="delete" >
  67. DELETE FROM replacement_instrument_activity WHERE id_ = #{id}
  68. </delete>
  69. <!-- 分页查询 -->
  70. <select id="queryPage" resultMap="ReplacementInstrument" parameterType="map">
  71. SELECT * FROM replacement_instrument <include refid="global.limit"/>
  72. </select>
  73. <!-- 查询当前表的总记录数 -->
  74. <select id="queryCount" resultType="int">
  75. SELECT COUNT(*) FROM replacement_instrument
  76. </select>
  77. </mapper>