<?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.panzhihua.service_community.dao.ComActDpcDAO">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActDpc" id="ComActDpcMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
<result property="nation" column="nation" jdbcType="VARCHAR"/>
|
<result property="sex" column="sex" jdbcType="INTEGER"/>
|
<result property="area" column="area" jdbcType="VARCHAR"/>
|
<result property="belong" column="belong" jdbcType="VARCHAR"/>
|
<result property="category" column="category" jdbcType="VARCHAR"/>
|
<result property="position" column="position" jdbcType="VARCHAR"/>
|
<result property="photo" column="photo" jdbcType="VARCHAR"/>
|
<result property="isDel" column="is_del" jdbcType="VARCHAR"/>
|
<result property="createdBy" column="created_by" jdbcType="INTEGER"/>
|
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
<result property="updatedBy" column="updated_by" jdbcType="INTEGER"/>
|
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
<result property="communityId" column="community_id" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<!-- 批量插入 -->
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_dpc(name, phone, nation, sex, area, belong, category, position, photo, is_del,
|
created_by, created_at, updated_by, updated_at, community_id)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.name}, #{entity.phone}, #{entity.nation}, #{entity.sex}, #{entity.area}, #{entity.belong},
|
#{entity.category}, #{entity.position}, #{entity.photo}, #{entity.isDel}, #{entity.createdBy},
|
#{entity.createdAt}, #{entity.updatedBy}, #{entity.updatedAt}, #{entity.communityId})
|
</foreach>
|
</insert>
|
<!-- 批量插入或按主键更新 -->
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_dpc(name, phone, nation, sex, area, belong, category, position, photo, is_del,
|
created_by, created_at, updated_by, updated_at, community_id)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.name}, #{entity.phone}, #{entity.nation}, #{entity.sex}, #{entity.area}, #{entity.belong},
|
#{entity.category}, #{entity.position}, #{entity.photo}, #{entity.isDel}, #{entity.createdBy},
|
#{entity.createdAt}, #{entity.updatedBy}, #{entity.updatedAt}, #{entity.communityId})
|
</foreach>
|
on duplicate key update
|
name = values(name) , phone = values(phone) , nation = values(nation) , sex = values(sex) , area = values(area)
|
, belong = values(belong) , category = values(category) , position = values(position) , photo = values(photo) ,
|
is_del = values(is_del) , created_by = values(created_by) , created_at = values(created_at) , updated_by =
|
values(updated_by) , updated_at = values(updated_at) , community_id = values(community_id)
|
</insert>
|
<select id="detailDpc" resultType="com.panzhihua.common.model.vos.community.ComActDpcVO">
|
SELECT * FROM com_act_dpc WHERE id = #{id}
|
</select>
|
<select id="pageDpc" resultType="com.panzhihua.common.model.vos.community.ComActDpcVO">
|
SELECT * FROM com_act_dpc
|
WHERE community_id = #{pageDpcDTO.communityId} AND is_del = 0
|
<if test="pageDpcDTO.keyword != null and pageDpcDTO.keyword != """>
|
AND (`name` LIKE CONCAT(#{pageDpcDTO.keyword}, '%')
|
OR phone LIKE CONCAT(#{pageDpcDTO.keyword}, '%'))
|
</if>
|
ORDER BY created_at DESC
|
</select>
|
<select id="selectUser" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
|
SELECT user_id, `name`, phone
|
FROM sys_user WHERE `type` = 1 AND phone = #{phone}
|
</select>
|
<insert id="insertComActDpc">
|
insert into com_act_dpc
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="comActDpc.id != null">
|
id,
|
</if>
|
<if test="comActDpc.name != null and comActDpc.name != ''">
|
name,
|
</if>
|
<if test="comActDpc.phone != null and comActDpc.phone != ''">
|
phone,
|
</if>
|
<if test="comActDpc.nation != null and comActDpc.nation != ''">
|
nation,
|
</if>
|
<if test="comActDpc.sex != null">
|
sex,
|
</if>
|
<if test="comActDpc.area != null and comActDpc.area != ''">
|
area,
|
</if>
|
<if test="comActDpc.belong != null and comActDpc.belong != ''">
|
belong,
|
</if>
|
<if test="comActDpc.category != null and comActDpc.category != ''">
|
category,
|
</if>
|
<if test="comActDpc.position != null and comActDpc.position != ''">
|
position,
|
</if>
|
<if test="comActDpc.photo != null and comActDpc.photo != ''">
|
photo,
|
</if>
|
<if test="comActDpc.communityId != null">
|
community_id,
|
</if>
|
<if test="comActDpc.createdBy != null ">
|
created_by,
|
</if>
|
<if test="comActDpc.createdAt != null ">
|
created_at,
|
</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="comActDpc.id != null">
|
#{comActDpc.id},
|
</if>
|
<if test="comActDpc.name != null and comActDpc.name != ''">
|
#{comActDpc.name},
|
</if>
|
<if test="comActDpc.phone != null and comActDpc.phone != ''">
|
#{comActDpc.phone},
|
</if>
|
<if test="comActDpc.nation != null and comActDpc.nation != ''">
|
#{comActDpc.nation},
|
</if>
|
<if test="comActDpc.sex != null">
|
#{comActDpc.sex},
|
</if>
|
<if test="comActDpc.area != null and comActDpc.area != ''">
|
#{comActDpc.area},
|
</if>
|
<if test="comActDpc.belong != null and comActDpc.belong != ''">
|
#{comActDpc.belong},
|
</if>
|
<if test="comActDpc.category != null and comActDpc.category != ''">
|
#{comActDpc.category},
|
</if>
|
<if test="comActDpc.position != null and comActDpc.position != ''">
|
#{comActDpc.position},
|
</if>
|
<if test="comActDpc.photo != null and comActDpc.photo != ''">
|
#{comActDpc.photo},
|
</if>
|
<if test="comActDpc.communityId != null ">
|
#{comActDpc.communityId},
|
</if>
|
<if test="comActDpc.createdBy != null ">
|
#{comActDpc.createdBy},
|
</if>
|
<if test="comActDpc.createdAt != null ">
|
#{comActDpc.createdAt},
|
</if>
|
</trim>
|
</insert>
|
|
</mapper>
|