|
@@ -0,0 +1,138 @@
|
|
|
+<?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.zoniot.ccrc.dao.CommunityOrgMapper">
|
|
|
+ <!-- 结果集 -->
|
|
|
+ <resultMap type="com.zoniot.ccrc.entity.CommunityOrg" id="CommunityOrgMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="orgId" column="org_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="communityId" column="community_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="siteId" column="site_id" jdbcType="INTEGER"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基本字段 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, org_id, community_id, create_date, update_date, create_by, update_by, status, site_id </sql>
|
|
|
+
|
|
|
+ <!-- 查询单个 -->
|
|
|
+ <select id="selectById" resultMap="CommunityOrgMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from sc_community_org
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查询全部 -->
|
|
|
+ <select id="selectAll" resultMap="CommunityOrgMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from sc_community_org
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--通过实体作为筛选条件查询-->
|
|
|
+ <select id="selectList" resultMap="CommunityOrgMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from sc_community_org
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null">
|
|
|
+ and org_id = #{orgId}
|
|
|
+ </if>
|
|
|
+ <if test="communityId != null">
|
|
|
+ and community_id = #{communityId}
|
|
|
+ </if>
|
|
|
+ <if test="createDate != null">
|
|
|
+ and create_date = #{createDate}
|
|
|
+ </if>
|
|
|
+ <if test="updateDate != null">
|
|
|
+ and update_date = #{updateDate}
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
+ and create_by = #{createBy}
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
+ and update_by = #{updateBy}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ and site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 新增所有列 -->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into sc_community_org(id, org_id, community_id, create_date, update_date, create_by, update_by, status,
|
|
|
+ site_id)
|
|
|
+ values (#{id}, #{orgId}, #{communityId}, #{createDate}, #{updateDate}, #{createBy}, #{updateBy}, #{status},
|
|
|
+ #{siteId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 批量新增 -->
|
|
|
+ <insert id="batchInsert">
|
|
|
+ insert into sc_community_org(id, org_id, community_id, create_date, update_date, create_by, update_by, status,
|
|
|
+ site_id)
|
|
|
+ values
|
|
|
+ <foreach collection="communityOrgs" item="item" index="index" separator=",">
|
|
|
+ (
|
|
|
+ #{item.id}, #{item.orgId}, #{item.communityId}, #{item.createDate}, #{item.updateDate}, #{item.createBy},
|
|
|
+ #{item.updateBy}, #{item.status}, #{item.siteId} )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 通过主键修改数据 -->
|
|
|
+ <update id="update">
|
|
|
+ update sc_community_org
|
|
|
+ <set>
|
|
|
+ <if test="orgId != null">
|
|
|
+ org_id = #{orgId},
|
|
|
+ </if>
|
|
|
+ <if test="communityId != null">
|
|
|
+ community_id = #{communityId},
|
|
|
+ </if>
|
|
|
+ <if test="createDate != null">
|
|
|
+ create_date = #{createDate},
|
|
|
+ </if>
|
|
|
+ <if test="updateDate != null">
|
|
|
+ update_date = #{updateDate},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
+ create_by = #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
+ update_by = #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ site_id = #{siteId},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete
|
|
|
+ from sc_community_org
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 总数 -->
|
|
|
+ <select id="count" resultType="int">
|
|
|
+ select count(*)
|
|
|
+ from sc_community_org
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|