<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--
这个文件是自动生成的。
不要修改此文件。所有改动将在下次重新自动生成时丢失。
-->
<mapper namespace="com.ym.mec.biz.dal.dao.SysImComplaintDao">
	
	<resultMap type="com.ym.mec.biz.dal.entity.SysImComplaint" id="SysImComplaint">
		<result column="id_" property="id" />
		<result column="type_" property="type" />
		<result column="url_" property="url" />
		<result column="memo_" property="memo" />
		<result column="user_id_" property="userId" />
		<result column="target_id_" property="targetId" />
		<result column="operator_" property="operator" />
		<result column="operator_time_" property="operatorTime" />
		<result column="status_" property="status" />
		<result column="create_time_" property="createTime" />
		<result column="update_time_" property="updateTime" />
        <result column="tenant_id_" property="tenantId"/>
	</resultMap>
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="SysImComplaint">
		SELECT * FROM sys_im_complaint where tenant_id_ = #{tenantId}
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysImComplaint" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO sys_im_complaint (type_,url_,memo_,user_id_,target_id_,operator_,operator_time_,status_,create_time_,update_time_,tenant_id_)
		VALUES(#{type},#{url},#{memo},#{userId},#{targetId},#{operator},#{operatorTime},#{status},NOW(),NOW(),#{tenantId})
	</insert>
	
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="SysImComplaint" parameterType="map">
		SELECT * FROM sys_im_complaint where tenant_id_ = #{tenantId} <include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM sys_im_complaint where tenant_id_ = #{tenantId}
	</select>
</mapper>
