TXlhtAddRecordMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.xlht.xlhtproject.mapper.TXlhtAddRecordMapper">
  6. <resultMap type="TXlhtAddRecord" id="TXlhtAddRecordResult">
  7. <result property="id" column="id" />
  8. <result property="oneSystemAdd" column="one_system_add" />
  9. <result property="twoSystemAdd" column="two_system_add" />
  10. <result property="oneAmount" column="one_amount" />
  11. <result property="twoAmount" column="two_amount" />
  12. <result property="realOneAmount" column="real_one_amount" />
  13. <result property="realTwoAmount" column="real_two_amount" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="revision" column="revision" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="remark" column="remark" />
  21. </resultMap>
  22. <sql id="selectTXlhtAddRecordVo">
  23. select id, one_system_add, two_system_add, one_amount, two_amount, real_one_amount, real_two_amount, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_xlht_add_record
  24. </sql>
  25. <select id="selectTXlhtAddRecordById" parameterType="Long" resultMap="TXlhtAddRecordResult">
  26. <include refid="selectTXlhtAddRecordVo"/>
  27. where id = #{id} and del_flag = 0
  28. </select>
  29. <insert id="insertTXlhtAddRecord" parameterType="TXlhtAddRecord" useGeneratedKeys="true" keyProperty="id">
  30. insert into t_xlht_add_record
  31. <trim prefix="(" suffix=")" suffixOverrides=",">
  32. <if test="oneSystemAdd != null">one_system_add,</if>
  33. <if test="twoSystemAdd != null">two_system_add,</if>
  34. <if test="oneAmount != null">one_amount,</if>
  35. <if test="twoAmount != null">two_amount,</if>
  36. <if test="realOneAmount != null">real_one_amount,</if>
  37. <if test="realTwoAmount != null">real_two_amount,</if>
  38. <if test="delFlag != null">del_flag,</if>
  39. <if test="revision != null">revision,</if>
  40. <if test="createBy != null">create_by,</if>
  41. <if test="createTime != null">create_time,</if>
  42. <if test="updateBy != null">update_by,</if>
  43. <if test="updateTime != null">update_time,</if>
  44. <if test="remark != null">remark,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="oneSystemAdd != null">#{oneSystemAdd},</if>
  48. <if test="twoSystemAdd != null">#{twoSystemAdd},</if>
  49. <if test="oneAmount != null">#{oneAmount},</if>
  50. <if test="twoAmount != null">#{twoAmount},</if>
  51. <if test="realOneAmount != null">#{realOneAmount},</if>
  52. <if test="realTwoAmount != null">#{realTwoAmount},</if>
  53. <if test="delFlag != null">#{delFlag},</if>
  54. <if test="revision != null">#{revision},</if>
  55. <if test="createBy != null">#{createBy},</if>
  56. <if test="createTime != null">#{createTime},</if>
  57. <if test="updateBy != null">#{updateBy},</if>
  58. <if test="updateTime != null">#{updateTime},</if>
  59. <if test="remark != null">#{remark},</if>
  60. </trim>
  61. </insert>
  62. <update id="updateTXlhtAddRecord" parameterType="TXlhtAddRecord">
  63. update t_xlht_add_record
  64. <trim prefix="SET" suffixOverrides=",">
  65. <if test="oneSystemAdd != null">one_system_add = #{oneSystemAdd},</if>
  66. <if test="twoSystemAdd != null">two_system_add = #{twoSystemAdd},</if>
  67. <if test="oneAmount != null">one_amount = #{oneAmount},</if>
  68. <if test="twoAmount != null">two_amount = #{twoAmount},</if>
  69. <if test="realOneAmount != null">real_one_amount = #{realOneAmount},</if>
  70. <if test="realTwoAmount != null">real_two_amount = #{realTwoAmount},</if>
  71. <if test="delFlag != null">del_flag = #{delFlag},</if>
  72. <if test="revision != null">revision = #{revision},</if>
  73. <if test="createBy != null">create_by = #{createBy},</if>
  74. <if test="createTime != null">create_time = #{createTime},</if>
  75. <if test="updateBy != null">update_by = #{updateBy},</if>
  76. <if test="updateTime != null">update_time = #{updateTime},</if>
  77. <if test="remark != null">remark = #{remark},</if>
  78. </trim>
  79. ,revision = revision + 1
  80. where id = #{id}
  81. </update>
  82. <delete id="deleteTXlhtAddRecordById" parameterType="Long">
  83. update t_xlht_add_record set del_flag = 2,revision = revision + 1 where del_flag = 0 and id = #{id}
  84. </delete>
  85. <delete id="deleteTXlhtAddRecordByIds" parameterType="String">
  86. update t_xlht_add_record set del_flag = 2,revision = revision + 1 where del_flag = 0 and id in
  87. <foreach item="id" collection="array" open="(" separator="," close=")">
  88. #{id}
  89. </foreach>
  90. </delete>
  91. <!-- 下面是新增的,不允许覆盖 -->
  92. <select id="selectTXlhtAddRecordList" parameterType="TXlhtAddRecord" resultMap="TXlhtAddRecordResult">
  93. <include refid="selectTXlhtAddRecordVo"/>
  94. <where>
  95. 1 = 1
  96. <if test="oneSystemAdd != null "> and one_system_add = #{oneSystemAdd}</if>
  97. <if test="twoSystemAdd != null "> and two_system_add = #{twoSystemAdd}</if>
  98. <if test="oneAmount != null "> and one_amount = #{oneAmount}</if>
  99. <if test="twoAmount != null "> and two_amount = #{twoAmount}</if>
  100. <if test="realOneAmount != null "> and real_one_amount = #{realOneAmount}</if>
  101. <if test="realTwoAmount != null "> and real_two_amount = #{realTwoAmount}</if>
  102. <if test="revision != null "> and revision = #{revision}</if>
  103. <!-- 下面是新增的SQL检索条件 SqlServer写法-->
  104. <if test="timeBegin != null and timeBegin != ''"> and remark &gt;= #{timeBegin}</if>
  105. <if test="timeEnd != null and timeEnd != ''"> and remark &lt;= #{timeEnd}</if>
  106. </where>
  107. and del_flag = 0 order by id desc
  108. </select>
  109. </mapper>