123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?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.bz.smart_city.dao.OrganizationMapper">
- <!--auto generated Code-->
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.Organization">
- <result column="id" property="id" jdbcType="INTEGER"/>
- <result column="parent_id" property="parentId" jdbcType="INTEGER"/>
- <result column="name" property="name" jdbcType="VARCHAR"/>
- <result column="type" property="type" jdbcType="INTEGER"/>
- <result column="address" property="address" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="INTEGER"/>
- <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
- <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
- <result column="update_date" property="updateDate" jdbcType="TIMESTAMP"/>
- <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
- <result column="site_id" property="siteId" jdbcType="INTEGER"/>
- <result column="collections" property="collections" jdbcType="VARCHAR"/>
- </resultMap>
- <!--auto generated Code-->
- <sql id="Base_Column_List">
- id,
- parent_id,
- name,
- type,
- address,
- status,
- create_date,
- create_by,
- update_date,
- update_by,
- site_id,
- collections
- </sql>
- <sql id="Base_Column_List_Org">
- org.id,
- org.parent_id,
- org.name,
- org.type,
- org.address,
- org.status,
- org.create_date,
- org.create_by,
- org.update_date,
- org.update_by,
- org.site_id,
- org.collections
- </sql>
- <!--auto generated Code-->
- <insert id="insert" useGeneratedKeys="true" keyProperty="organization.id">
- INSERT INTO sc_organization (
- id,
- parent_id,
- name,
- type,
- address,
- status,
- create_date,
- create_by,
- update_date,
- update_by,
- site_id,
- collections,
- customer_id
- ) VALUES (
- #{organization.id,jdbcType=INTEGER},
- #{organization.parentId,jdbcType=INTEGER},
- #{organization.name,jdbcType=VARCHAR},
- #{organization.type,jdbcType=INTEGER},
- #{organization.address,jdbcType=VARCHAR},
- #{organization.status,jdbcType=INTEGER},
- #{organization.createDate,jdbcType=TIMESTAMP},
- #{organization.createBy,jdbcType=VARCHAR},
- #{organization.updateDate,jdbcType=TIMESTAMP},
- #{organization.updateBy,jdbcType=VARCHAR},
- #{organization.siteId,jdbcType=INTEGER},
- #{organization.collections,jdbcType=VARCHAR},
- #{organization.customerId,jdbcType=BIGINT}
- )
- </insert>
- <!--auto generated Code-->
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="organization.id">
- INSERT INTO sc_organization
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="organization.id!=null"> id,</if>
- <if test="organization.parentId!=null"> parent_id,</if>
- <if test="organization.name!=null"> name,</if>
- <if test="organization.type!=null"> type,</if>
- <if test="organization.address!=null"> address,</if>
- <if test="organization.status!=null"> status,</if>
- <if test="organization.createDate!=null"> create_date,</if>
- <if test="organization.createBy!=null"> create_by,</if>
- <if test="organization.updateDate!=null"> update_date,</if>
- <if test="organization.updateBy!=null"> update_by,</if>
- <if test="organization.siteId!=null"> site_id,</if>
- <if test="organization.collections!=null"> collections</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="organization.id!=null"> #{organization.id,jdbcType=INTEGER},</if>
- <if test="organization.parentId!=null"> #{organization.parentId,jdbcType=INTEGER},</if>
- <if test="organization.name!=null"> #{organization.name,jdbcType=VARCHAR},</if>
- <if test="organization.type!=null"> #{organization.type,jdbcType=INTEGER},</if>
- <if test="organization.address!=null"> #{organization.address,jdbcType=VARCHAR},</if>
- <if test="organization.status!=null"> #{organization.status,jdbcType=INTEGER},</if>
- <if test="organization.createDate!=null"> #{organization.createDate,jdbcType=TIMESTAMP},</if>
- <if test="organization.createBy!=null"> #{organization.createBy,jdbcType=VARCHAR},</if>
- <if test="organization.updateDate!=null"> #{organization.updateDate,jdbcType=TIMESTAMP},</if>
- <if test="organization.updateBy!=null"> #{organization.updateBy,jdbcType=VARCHAR},</if>
- <if test="organization.siteId!=null"> #{organization.siteId,jdbcType=INTEGER},</if>
- <if test="organization.collections!=null"> #{organization.collections,jdbcType=VARCHAR}</if>
- </trim>
- </insert>
- <!--auto generated Code-->
- <insert id="insertList">
- INSERT INTO sc_organization(
- id,
- parent_id,
- name,
- type,
- address,
- status,
- create_date,
- create_by,
- update_date,
- update_by,
- site_id,
- collections
- )VALUES
- <foreach collection="organizations" item="organization" index="index" separator=",">
- (
- #{organization.id,jdbcType=INTEGER},
- #{organization.parentId,jdbcType=INTEGER},
- #{organization.name,jdbcType=VARCHAR},
- #{organization.type,jdbcType=INTEGER},
- #{organization.address,jdbcType=VARCHAR},
- #{organization.status,jdbcType=INTEGER},
- #{organization.createDate,jdbcType=TIMESTAMP},
- #{organization.createBy,jdbcType=VARCHAR},
- #{organization.updateDate,jdbcType=TIMESTAMP},
- #{organization.updateBy,jdbcType=VARCHAR},
- #{organization.siteId,jdbcType=INTEGER},
- #{organization.collections,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <!--auto generated Code-->
- <update id="updateByPrimaryKeySelective">
- UPDATE sc_organization
- <set>
- <if test="organization.id != null"> id = #{organization.id,jdbcType=INTEGER},</if>
- <if test="organization.parentId != null"> parent_id = #{organization.parentId,jdbcType=INTEGER},</if>
- <if test="organization.name != null"> name = #{organization.name,jdbcType=VARCHAR},</if>
- <if test="organization.type != null"> type = #{organization.type,jdbcType=INTEGER},</if>
- <if test="organization.address != null"> address = #{organization.address,jdbcType=VARCHAR},</if>
- <if test="organization.status != null"> status = #{organization.status,jdbcType=INTEGER},</if>
- <if test="organization.createDate != null"> create_date = #{organization.createDate,jdbcType=TIMESTAMP},</if>
- <if test="organization.createBy != null"> create_by = #{organization.createBy,jdbcType=VARCHAR},</if>
- <if test="organization.updateDate != null"> update_date = #{organization.updateDate,jdbcType=TIMESTAMP},</if>
- <if test="organization.updateBy != null"> update_by = #{organization.updateBy,jdbcType=VARCHAR},</if>
- <if test="organization.siteId != null"> site_id = #{organization.siteId,jdbcType=INTEGER},</if>
- <if test="organization.collections != null"> collections = #{organization.collections,jdbcType=VARCHAR}</if>
- </set>
- WHERE id = #{organization.id,jdbcType=INTEGER}
- </update>
- <select id="findList" resultType="com.bz.smart_city.dto.OrganizationDto">
- select <include refid="Base_Column_List"/> from sc_organization
- where status = 1
- <if test="siteId != null"> and site_id = #{siteId} </if>
- order by create_date desc
- </select>
- <select id="findListForCustomer" resultType="com.bz.smart_city.dto.OrganizationDto">
- select <include refid="Base_Column_List"/>
- from sc_organization
- where status = 1
- <if test="customerId != null"> and customer_id = #{customerId} </if>
- order by create_date desc
- </select>
- <select id="findListByCustomer" resultType="com.bz.smart_city.dto.OrganizationDto">
- select <include refid="Base_Column_List_Org"/>
- from sc_organization org
- inner join sc_customer cus on cus.customer_org_id=org.id
- where org.status = 1
- <if test="customerId != null"> and org.customer_id = #{customerId} </if>
- order by org.create_date desc
- </select>
- <select id="findByNameUnique" resultType="int">
- select count(1) from sc_organization
- where status = 1 and name = #{name} and parent_id = #{parentId}
- and site_id = #{siteId}
- <if test="id != null"> and id != #{id} </if>
- </select>
- <select id="countParentId" resultType="java.lang.Integer">
- select count(1) from sc_organization where status = 1 and parent_id = #{id}
- </select>
- <select id="findListByIds" resultType="com.bz.smart_city.entity.Organization">
- select <include refid="Base_Column_List"/>
- from
- sc_organization
- where
- status = 1
- and id in
- <foreach collection="orgIds" item="orgId" open="(" separator="," close=")">#{orgId}</foreach>
- </select>
- <select id="fingByOrganizationOne" resultType="com.bz.smart_city.dto.OrganizationDto">
- select <include refid="Base_Column_List"/>
- from sc_organization
- where status = 1 and parent_id = '0'
- <if test="customerId != null"> and customer_id = #{customerId} </if>
- <if test="siteId != null">and site_id =#{siteId}</if>
- order by create_date desc
- </select>
- <select id="findListLikeOrgin" resultType="com.bz.smart_city.dto.OrganizationDto">
- select <include refid="Base_Column_List"/>
- from sc_organization
- where status = 1
- <if test="customerId != null"> and customer_id = #{customerId} </if>
- <if test="siteId != null">and site_id =#{siteId}</if>
- <if test="id != null">
- and collections like concat('%',#{id},'%')
- </if>
- order by create_date desc
- </select>
- <select id="findOrginName" resultType="java.lang.String">
- select name as "name"
- from sc_organization
- where status = 1
- <if test="customerId != null"> and customer_id = #{customerId} </if>
- <if test="siteId != null">and site_id =#{siteId}</if>
- <if test="id != null">
- and id=#{id}
- </if>
- </select>
- </mapper>
|