148 lines
5.4 KiB
XML
Raw Normal View History

<?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.xhpc.user.mapper.XhpcCommunityMapper">
<resultMap type="com.xhpc.user.domain.XhpcCommunity" id="XhpcCommunityResult">
<result column="community_id" property="communityId"/>
<result column="name" property="name"/>
<result column="service_preferential" property="servicePreferential"/>
<result column="min_people" property="minPeople"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="address" property="address"/>
<result column="parent_id" property="parentId"/>
<result column="type" property="type"/>
<result column="dimension" property="dimension"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="list" resultType="map">
select
community_id as communityId,
name as name
from xhpc_community
where del_flag =1
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
</select>
<insert id="addMechanism">
<foreach collection="chargingStationIds" item="item" index="index" open="" close="" separator="">
insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUE (#{item},#{mechanismId},#{source})
</foreach>
</insert>
<insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
insert into xhpc_community
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != communityId">
community_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != servicePreferential">
service_preferential,
</if>
<if test="null != minPeople">
min_people,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != dimension">
dimension,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != communityId">
#{communityId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != servicePreferential">
#{servicePreferential},
</if>
<if test="null != minPeople">
#{minPeople},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != dimension">
#{dimension},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
</trim>
</insert>
<update id="deleteCommunity">
update xhpc_community set del_flag =1 where community_id=#{communityId}
</update>
<select id="countCommunityPersonnel" resultType="java.lang.Integer">
select count (community_personnel_id) from xhpc_community_personnel where community_id=#{communityId} and del_flag=0
</select>
</mapper>