<?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.ComActSocialOrgHatchAuditDAO">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActSocialOrgHatchAudit"
|
id="ComActSocialOrgHatchAuditMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="responsibility" column="responsibility" jdbcType="VARCHAR"/>
|
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
<result property="hatchUnit" column="hatch_unit" jdbcType="INTEGER"/>
|
<result property="hatchUnitType" column="hatch_unit_type" jdbcType="INTEGER"/>
|
<result property="hatchUnitName" column="hatch_unit_name" jdbcType="VARCHAR"/>
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
<result property="introduction" column="introduction" jdbcType="VARCHAR"/>
|
<result property="logo" column="logo" jdbcType="VARCHAR"/>
|
<result property="applyReason" column="apply_reason" jdbcType="VARCHAR"/>
|
<result property="serviceScope" column="service_scope" jdbcType="VARCHAR"/>
|
</resultMap>
|
|
<!-- 批量插入 -->
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_social_org_hatch_audit(name, responsibility, phone, hatch_unit, hatch_unit_type,
|
hatch_unit_name, user_id, status, created_at, updated_at, introduction, logo, apply_reason, service_scope)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.name}, #{entity.responsibility}, #{entity.phone}, #{entity.hatchUnit}, #{entity.hatchUnitType},
|
#{entity.hatchUnitName}, #{entity.userId}, #{entity.status}, #{entity.createdAt}, #{entity.updatedAt},
|
#{entity.introduction}, #{entity.logo}, #{entity.applyReason}, #{entity.serviceScope})
|
</foreach>
|
</insert>
|
<!-- 批量插入或按主键更新 -->
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.com_act_social_org_hatch_audit(name, responsibility, phone, hatch_unit, hatch_unit_type,
|
hatch_unit_name, user_id, status, created_at, updated_at, introduction, logo, apply_reason, service_scope)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.name}, #{entity.responsibility}, #{entity.phone}, #{entity.hatchUnit}, #{entity.hatchUnitType},
|
#{entity.hatchUnitName}, #{entity.userId}, #{entity.status}, #{entity.createdAt}, #{entity.updatedAt},
|
#{entity.introduction}, #{entity.logo}, #{entity.applyReason}, #{entity.serviceScope})
|
</foreach>
|
on duplicate key update
|
name = values(name) , responsibility = values(responsibility) , phone = values(phone) , hatch_unit =
|
values(hatch_unit) , hatch_unit_type = values(hatch_unit_type) , hatch_unit_name = values(hatch_unit_name) ,
|
user_id = values(user_id) , status = values(status) , created_at = values(created_at) , updated_at =
|
values(updated_at) , introduction = values(introduction) , logo = values(logo) , apply_reason =
|
values(apply_reason) , service_scope = values(service_scope)
|
</insert>
|
<select id="pageHatchAudit"
|
resultType="com.panzhihua.common.model.vos.community.social.SocialOrgHatchAuditVO">
|
SELECT id, `name`, responsibility, phone, hatch_unit_name, created_at, `status`
|
FROM com_act_social_org_hatch_audit
|
<where>
|
<if test="pageHatchAuditDTO.keyword != null and pageHatchAuditDTO.keyword != """>
|
AND (`name` LIKE CONCAT(#{pageHatchAuditDTO.keyword}, '%')
|
OR responsibility LIKE CONCAT(#{pageHatchAuditDTO.keyword}, '%')
|
OR phone LIKE CONCAT(#{pageHatchAuditDTO.keyword}, '%'))
|
</if>
|
<if test="pageHatchAuditDTO.hatchUnit != null and pageHatchAuditDTO.hatchUnitType != null">
|
AND hatch_unit = #{pageHatchAuditDTO.hatchUnit} AND hatch_unit_type = #{pageHatchAuditDTO.hatchUnitType}
|
</if>
|
<if test="pageHatchAuditDTO.status != null">
|
AND `status` = #{pageHatchAuditDTO.status}
|
</if>
|
</where>
|
ORDER BY created_at DESC
|
</select>
|
<select id="detailHatchAudit"
|
resultType="com.panzhihua.common.model.vos.community.social.SocialOrgHatchAuditVO">
|
SELECT a.*, GROUP_CONCAT(c.`name`) AS serviceScopeName
|
FROM com_act_social_org_hatch_audit a
|
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.service_scope ) - length( REPLACE ( a.service_scope, ',', '' ))+ 1 )
|
LEFT JOIN com_act_column c ON substring_index( substring_index( a.service_scope, ',', b.help_topic_id + 1 ), ',',- 1 ) = c.id
|
WHERE a.id = #{id}
|
</select>
|
<select id="getHatchAuditSchedule"
|
resultType="com.panzhihua.common.model.vos.community.social.SocialOrgHatchAuditVO">
|
SELECT a.*, GROUP_CONCAT(c.`name`) AS serviceScopeName
|
FROM com_act_social_org_hatch_audit a
|
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.service_scope ) - length( REPLACE ( a.service_scope, ',', '' ))+ 1 )
|
LEFT JOIN com_act_column c ON substring_index( substring_index( a.service_scope, ',', b.help_topic_id + 1 ), ',',- 1 ) = c.id
|
WHERE a.user_id = #{userId}
|
</select>
|
|
</mapper>
|