<?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.ComActEnterpriseTypeDAO">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActEnterpriseType" id="ComActEnterpriseTypeMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="communityId" column="community_id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="description" column="description" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<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"/>
|
</resultMap>
|
|
<!-- 批量插入 -->
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_enterprise_type(community_id, name, description, status, is_del, created_by,
|
created_at, updated_by, updated_at)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.communityId}, #{entity.name}, #{entity.description}, #{entity.status}, #{entity.isDel},
|
#{entity.createdBy}, #{entity.createdAt}, #{entity.updatedBy}, #{entity.updatedAt})
|
</foreach>
|
</insert>
|
<!-- 批量插入或按主键更新 -->
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_enterprise_type(community_id, name, description, status, is_del, created_by,
|
created_at, updated_by, updated_at)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.communityId}, #{entity.name}, #{entity.description}, #{entity.status}, #{entity.isDel},
|
#{entity.createdBy}, #{entity.createdAt}, #{entity.updatedBy}, #{entity.updatedAt})
|
</foreach>
|
on duplicate key update
|
community_id = values(community_id) , name = values(name) , description = values(description) , status =
|
values(status) , 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)
|
</insert>
|
<select id="detailEnterpriseType"
|
resultType="com.panzhihua.common.model.vos.community.ComActEnterpriseTypeVO">
|
SELECT t.id, t.`name`, t.description, t.status, t1.`name` AS createdBy, t2.`name` AS updatedBy
|
FROM com_act_enterprise_type t
|
LEFT JOIN sys_user t1 ON t.created_by = t1.user_id
|
LEFT JOIN sys_user t2 ON t.updated_by = t2.user_id
|
WHERE t.id = #{id}
|
</select>
|
<select id="pageEnterpriseType"
|
resultType="com.panzhihua.common.model.vos.community.ComActEnterpriseTypeVO">
|
SELECT t.id, t.`name`, t.description, t.status, t1.`name` AS createdBy, t2.`name` AS updatedBy
|
FROM com_act_enterprise_type t
|
LEFT JOIN sys_user t1 ON t.created_by = t1.user_id
|
LEFT JOIN sys_user t2 ON t.updated_by = t2.user_id
|
WHERE t.community_id = #{pageEnterpriseTypeDTO.communityId} AND t.is_del = 0
|
<if test="pageEnterpriseTypeDTO.status != null">
|
AND t.status = #{pageEnterpriseTypeDTO.status}
|
</if>
|
<if test="pageEnterpriseTypeDTO.keyword != null and pageEnterpriseTypeDTO.keyword != """>
|
AND t.`name` LIKE CONCAT(#{pageEnterpriseTypeDTO.keyword}, '%')
|
</if>
|
ORDER BY t.created_at DESC
|
</select>
|
<select id="getEnterpriseTypeList"
|
resultType="com.panzhihua.common.model.vos.community.ComActEnterpriseTypeVO">
|
SELECT t.id, t.`name`, t.description, t.status, t1.`name` AS createdBy, t2.`name` AS updatedBy
|
FROM com_act_enterprise_type t
|
LEFT JOIN sys_user t1 ON t.created_by = t1.user_id
|
LEFT JOIN sys_user t2 ON t.updated_by = t2.user_id
|
WHERE t.community_id = #{communityId} AND t.is_del = 0 AND t.status = 1
|
</select>
|
|
</mapper>
|