SysUserCashAccountLogMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.SysUserCashAccountLogDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.SysUserCashAccountLog" id="SysUserCashAccountLog">
  9. <result column="id_" property="id"/>
  10. <result column="user_id_" property="userId"/>
  11. <result column="username_" property="username"/>
  12. <result column="trans_no_" property="transNo"/>
  13. <result column="return_fee_type_" property="returnFeeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  14. <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  15. <result column="amount_" property="amount"/>
  16. <result column="comment_" property="comment"/>
  17. <result column="create_time_" property="createTime"/>
  18. <result column="update_time_" property="updateTime"/>
  19. <result column="organ_name_" property="organName"/>
  20. <result column="group_id_" property="groupId"/>
  21. <result column="group_name_" property="groupName"/>
  22. <result column="pay_time_" property="payTime"/>
  23. </resultMap>
  24. <!-- 根据主键查询一条记录 -->
  25. <select id="get" resultMap="SysUserCashAccountLog">
  26. SELECT * FROM sys_user_cash_account_log WHERE id_ = #{id}
  27. </select>
  28. <!-- 全查询 -->
  29. <select id="findAll" resultMap="SysUserCashAccountLog">
  30. SELECT *
  31. FROM sys_user_cash_account_log
  32. ORDER BY id_
  33. </select>
  34. <!-- 向数据库增加一条记录 -->
  35. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysUserCashAccountLog" useGeneratedKeys="true"
  36. keyColumn="id" keyProperty="id">
  37. INSERT INTO sys_user_cash_account_log (user_id_,organ_id_,trans_no_,return_fee_type_,group_type_,
  38. group_id_,amount_,comment_,pay_time_,create_time_,update_time_)
  39. VALUES(#{userId},#{organId},#{transNo},#{returnFeeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  40. #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{groupId},#{amount},
  41. #{comment},#{payTime},NOW(),NOW())
  42. </insert>
  43. <!-- 根据主键查询一条记录 -->
  44. <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysUserCashAccountLog">
  45. UPDATE sys_user_cash_account_log
  46. <set>
  47. <if test="comment != null">comment_ = #{comment},</if>
  48. <if test="transNo != null">trans_no_ = #{transNo},</if>
  49. <if test="payTime != null">pay_time_ = #{payTime},</if>
  50. update_time_ = NOW()
  51. </set>
  52. WHERE id_ = #{id}
  53. </update>
  54. <!-- 根据主键删除一条记录 -->
  55. <delete id="delete">
  56. DELETE FROM sys_user_cash_account_log WHERE id_ = #{id}
  57. </delete>
  58. <!-- 分页查询 -->
  59. <select id="queryPage" resultMap="SysUserCashAccountLog" parameterType="map">
  60. SELECT cal.*,su.username_,o.name_ organ_name_ FROM sys_user_cash_account_log cal
  61. LEFT JOIN sys_user su ON su.id_ = cal.user_id_
  62. LEFT JOIN organization o ON o.id_ = cal.organ_id_
  63. <include refid="queryPageSql"/>
  64. ORDER BY id_ DESC
  65. <include refid="global.limit"/>
  66. </select>
  67. <!-- 查询当前表的总记录数 -->
  68. <select id="queryCount" resultType="int">
  69. SELECT COUNT(cal.id_) FROM sys_user_cash_account_log cal
  70. LEFT JOIN sys_user su ON su.id_ = cal.user_id_
  71. <include refid="queryPageSql"/>
  72. </select>
  73. <sql id="queryPageSql">
  74. <where>
  75. <if test="createStartTime != null">
  76. AND DATE_FORMAT(cal.create_time_,'%Y%m%d') >= #{createStartTime}
  77. </if>
  78. <if test="createEndTime != null">
  79. AND DATE_FORMAT(cal.create_time_,'%Y%m%d') &lt;= #{createEndTime}
  80. </if>
  81. <if test="payStartTime != null">
  82. AND DATE_FORMAT(cal.pay_time_,'%Y%m%d') >= #{payStartTime}
  83. </if>
  84. <if test="payEndTime != null">
  85. AND DATE_FORMAT(cal.pay_time_,'%Y%m%d') &lt;= #{payEndTime}
  86. </if>
  87. <if test="groupType != null and groupType != ''">
  88. AND cal.group_type_ = #{groupType}
  89. </if>
  90. <if test="returnFeeType != null and returnFeeType != ''">
  91. AND cal.return_fee_type_ = #{returnFeeType}
  92. </if>
  93. <if test="organId != null and organId != ''">
  94. AND FIND_IN_SET(cal.organ_id_,#{organId})
  95. </if>
  96. <if test="search != null and search != ''">
  97. AND (cal.user_id_ = #{search} OR cal.group_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR cal.trans_no_ LIKE CONCAT('%',#{search},'%'))
  98. </if>
  99. </where>
  100. </sql>
  101. </mapper>