SysUserCashAccountLogMapper.xml 5.3 KB

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