SporadicChargeInfo.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <mapper namespace="com.ym.mec.biz.dal.dao.SporadicChargeInfoDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.SporadicChargeInfo" id="SporadicChargeInfo">
  6. <result column="id_" property="id" />
  7. <result column="title_" property="title" />
  8. <result column="charge_type_" property="chargeType"/>
  9. <result column="organ_id_" property="organId"/>
  10. <result column="amount_" property="amount" />
  11. <result column="detail_" property="detail" />
  12. <result column="create_time_" property="createTime" />
  13. <result column="update_time_" property="updateTime" />
  14. <result column="operator_id_" property="operatorId" />
  15. <result column="del_flag_" property="delFlag" />
  16. <result column="organ_name_" property="organName" />
  17. <result column="user_id_" property="userId" />
  18. </resultMap>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="SporadicChargeInfo">
  21. SELECT * FROM sporadic_charge_info WHERE id_ = #{id}
  22. </select>
  23. <!-- 全查询 -->
  24. <select id="findAll" resultMap="SporadicChargeInfo">
  25. SELECT * FROM sporadic_charge_info ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SporadicChargeInfo"
  29. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  30. INSERT INTO sporadic_charge_info
  31. (title_,charge_type_,organ_id_,amount_,detail_,create_time_,update_time_,operator_id_,user_id_)
  32. VALUES(#{title},#{chargeType},#{organId},#{amount},#{detail},now(),now(),#{operatorId},#{userId})
  33. </insert>
  34. <!-- 根据主键查询一条记录 -->
  35. <update id="update" parameterType="com.ym.mec.biz.dal.entity.SporadicChargeInfo">
  36. UPDATE sporadic_charge_info
  37. <set>
  38. <if test="title != null">
  39. title_ = #{title},
  40. </if>
  41. <if test="chargeType != null">
  42. charge_type_ = #{chargeType},
  43. </if>
  44. <if test="organId != null">
  45. organ_id_ = #{organId},
  46. </if>
  47. <if test="amount != null">
  48. amount_ = #{amount},
  49. </if>
  50. <if test="detail != null">
  51. detail_ = #{detail},
  52. </if>
  53. <if test="updateTime != null">
  54. update_time_ = now(),
  55. </if>
  56. <if test="operatorId != null">
  57. operator_id_ = #{operatorId},
  58. </if>
  59. <if test="userId != null">
  60. user_id_ = #{userId},
  61. </if>
  62. </set>
  63. WHERE id_ = #{id}
  64. </update>
  65. <!-- 根据主键删除一条记录 -->
  66. <update id="delete">
  67. UPDATE sporadic_charge_info SET del_flag_ = 1 WHERE id_ = #{id}
  68. </update>
  69. <!-- 分页查询 -->
  70. <select id="queryPage" resultMap="SporadicChargeInfo" parameterType="map">
  71. SELECT * FROM sporadic_charge_info sci
  72. LEFT JOIN sys_user su ON su.id_ = sci.user_id_
  73. <include refid="queryPageSql"/>
  74. ORDER BY id_ DESC
  75. <include refid="global.limit" />
  76. </select>
  77. <sql id="queryPageSql">
  78. <where>
  79. sci.del_flag_ != 1
  80. <if test="organId != null">
  81. AND FIND_IN_SET(sci.organ_id_,#{organId})
  82. </if>
  83. <if test="chargeType != null">
  84. AND sci.charge_type_ = #{chargeType}
  85. </if>
  86. <if test="search != null">
  87. AND (sci.title_ LIKE CONCAT('%',#{search},'%') OR su.username LIKE CONCAT('%',#{search},'%'))
  88. </if>
  89. </where>
  90. </sql>
  91. <!-- 查询当前表的总记录数 -->
  92. <select id="queryCount" resultType="int">
  93. SELECT COUNT(id_) FROM sporadic_charge_info sci
  94. <include refid="queryPageSql"/>
  95. </select>
  96. <select id="findInfoById" resultMap="SporadicChargeInfo">
  97. SELECT * FROM sporadic_charge_info where id_ = #{id}
  98. </select>
  99. </mapper>