insert into ${tableName}
(
${key}
,DEL_FLAG
,REVISION
,CREATED_TIME
,UPDATED_TIME
) values
(
#{value}
,'0'
,'0'
,NOW()
,NOW()
)
DELETE
FROM
${tableName}
WHERE
ic_resi_user = #{resiUserId}
UPDATE ${tableName}
SET
${key} = #{value}
,UPDATED_TIME = NOW()
WHERE id = #{id}
UPDATE ${tableName}
SET
${key} = #{value}
,UPDATED_TIME = NOW()
WHERE id = #{id}
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId} and customer_id=#{customerId}
select * from ${subTableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId} and customer_id=#{customerId}
ic_resi_user.DEL_FLAG = '0'
AND ic_resi_user.status = '0'
AND ${resultTableName}.ID IS NOT NULL
and (
ic_resi_user.pids like concat(#{orgIdPath},'%')
or
ic_resi_user.GRID_ID in (
#{gridId}
)
)
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and (${subCondition.tableName}.${subCondition.columnName} is null
or ${subCondition.tableName}.${subCondition.columnName} ='')
${subCondition.tableName}.${subCondition.columnName} like concat('%',#{colValue},'%')
and ${subCondition.tableName}.${colValue} ='1'
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]}
and ic_resi_user.BIRTHDAY is not null
and ic_resi_user.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]}
and ${subCondition.tableName}.${subCondition.columnName} is not null
and ${subCondition.tableName}.${subCondition.columnName} !=''
and (${subCondition.tableName}.${subCondition.columnName} is null
or ${subCondition.tableName}.${subCondition.columnName} ='')
select
ic_resi_user.id as icResiUserId,
ic_resi_user.AGENCY_ID as ORG_ID,
${column.columnName}
FROM
ic_resi_user
${subTableName}
AND (
NAME like concat('%', #{keyword},'%')
or MOBILE like concat('%', #{keyword},'%')
or ID_CARD like concat('%', #{keyword},'%')
)
group by ic_resi_user.id
${groupTableName}.ID
ORDER BY
field( ic_resi_user.GRID_ID, '1537272060187049986', '1537272342477508609', '1537275342477501111', '1593432493598076929','1595582620679204865' ),
ic_resi_user.VILLAGE_ID ASC,
ic_resi_user.BUILD_ID ASC,
ic_resi_user.UNIT_ID ASC,
ic_resi_user.HOME_ID ASC,
ic_resi_user.ID ASC
ORDER BY
ic_resi_user.GRID_ID asc,
ic_resi_user.VILLAGE_ID ASC,
ic_resi_user.BUILD_ID ASC,
ic_resi_user.UNIT_ID ASC,
ic_resi_user.HOME_ID ASC,
ic_resi_user.ID ASC
update ic_resi_user
set del_flag='1',
UPDATED_TIME = now(),
UPDATED_BY = #{currentStaffId}
where id = #{icResiUserId}
update ${subTalbeName}
set del_flag='1',
UPDATED_TIME = now(),
UPDATED_BY = #{currentStaffId}
where IC_RESI_USER=#{icResiUserId}
update
ic_resi_user
set
name = #{entity.name},
mobile = #{entity.mobile},
birthday = #{entity.birthday},
home_id = #{entity.homeId},
village_id = #{entity.villageId},
build_id = #{entity.buildId},
unit_id = #{entity.unitId},
pids = #{entity.pids},
grid_id = #{entity.gridId},
updated_time = now()
where
id_card = #{entity.idCard}
AND customer_id = #{entity.customerId}
select
${column.tableName}.${column.columnName}
${resultTableName}.*
FROM
ic_resi_user
${subTableName}
group by IC_RESI_USER.id
${groupTableName}.ID
order by IC_RESI_USER.GRID_ID ASC,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
SELECT
GZDW,
name,
YSR,
TXJE,
ID_CARD,
MOBILE,
IS_TENANT as isTenant,
IFNULL(IS_VOLUNTEER,'0') AS isVolunteer,
CUSTOMER_ID,
GRID_ID,
HOME_ID
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND ID = #{userId}
SELECT
ID AS userId,
`NAME`,
VILLAGE_ID AS neighborHoodId,
BUILD_ID,
GRID_ID,
MOBILE,
( case when GENDER='1'then '男'
when GENDER='2' then '女'
else '未知'
end
) as GENDER,
ID_CARD,
IFNULL(BIRTHDAY,'') AS BIRTHDAY,
IFNULL(REMARKS,'') AS REMARKS
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE CONCAT('%',#{agencyId},'%'))
AND (AGENCY_ID = #{id} OR PIDS LIKE CONCAT('%',#{id},'%'))
AND GRID_ID = #{id}
AND VILLAGE_ID = #{id}
AND BUILD_ID = #{id}
AND `NAME` LIKE CONCAT('%',#{name},'%')
and ${columnName}='1'
AND `STATUS`='0'
ORDER BY `CREATED_TIME` DESC, `NAME`
SELECT DISTINCT
m.CATEGORY_CODE
FROM
ic_resi_demand m
WHERE
m.DEL_FLAG = '0'
AND m.IC_RESI_USER = #{icResiUserId}
ORDER BY
m.CREATED_TIME ASC
SELECT
GROUP_CONCAT(m.CATEGORY_NAME)
FROM
ic_resi_demand_dict m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND m.CATEGORY_CODE IN
#{code}
SELECT
HOME_ID,
SUM(IF('1' = IS_PARTY, 1, 0)) AS IS_PARTY,
SUM(IF('1' = IS_DBH, 1, 0)) AS IS_DBH,
SUM(IF('1' = IS_ENSURE_HOUSE, 1, 0)) AS IS_ENSURE_HOUSE,
SUM(IF('1' = IS_UNEMPLOYED, 1, 0)) AS IS_UNEMPLOYED,
SUM(IF('1' = IS_YLFN, 1, 0)) AS IS_YLFN,
SUM(IF('1' = IS_VETERANS, 1, 0)) AS IS_VETERANS,
SUM(IF('1' = IS_UNITED_FRONT, 1, 0)) AS IS_UNITED_FRONT,
SUM(IF('1' = IS_XFRY, 1, 0)) AS IS_XFRY,
SUM(IF('1' = IS_VOLUNTEER, 1, 0)) AS IS_VOLUNTEER,
SUM(IF('1' = IS_OLD_PEOPLE, 1, 0)) AS IS_OLD_PEOPLE,
SUM(IF('1' = IS_KC, 1, 0)) AS IS_KC,
SUM(IF('1' = IS_SD, 1, 0)) AS IS_SD,
SUM(IF('1' = IS_SN, 1, 0)) AS IS_SN,
SUM(IF('1' = IS_SZ, 1, 0)) AS IS_SZ,
SUM(IF('1' = IS_CJ, 1, 0)) AS IS_CJ,
SUM(IF('1' = IS_DB, 1, 0)) AS IS_DB,
SUM(IF('1' = IS_MB, 1, 0)) AS IS_MB,
SUM(IF('1' = IS_SPECIAL, 1, 0)) AS IS_SPECIAL
FROM ic_resi_user
WHERE DEL_FLAG = 0
AND BUILD_ID = #{buildId}
GROUP BY HOME_ID
SELECT VOLUNTEER_CATEGORY FROM ic_volunteer WHERE DEL_FLAG = '0' AND ic_resi_user = #{userId}
select
IFNULL(`${c}`,'0') AS `${c}`
from ${tableName}
where DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND ID = #{userId}
AND IC_RESI_USER = #{userId}
SELECT
id,
`name`,
id_card,
mobile,
agency_id,
grid_id,
home_id,
IS_PARTY as isParty
FROM
ic_resi_user
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
SELECT
ir.id as demandUserId,
IFNULL(ir.`NAME`,'') AS demandUserName,
IFNULL(ir.MOBILE,'') AS demandUserMobile,
(
case when ir.MOBILE is not null and ir.MOBILE!=''
then concat(ir.`NAME`,'(',ir.MOBILE,')')
else ir.`NAME`
end
) as label,
ir.grid_id as gridId,
ir.ID_CARD as idCard,
ir.AGENCY_ID as agencyId,
ir.HOME_ID as houseId
FROM
ic_resi_user ir
WHERE
ir.DEL_FLAG = '0'
AND ir.AGENCY_ID = #{agencyId}
AND ir.GRID_ID = #{gridId}
AND ir.`NAME` concat('%',#{name},'%')
and ir.status='0'
ORDER BY
CONVERT ( ir.NAME USING gbk ) ASC
select
ir.*
FROM
ic_resi_user ir
WHERE
ir.DEL_FLAG = '0'
and ir.customer_id=#{customerId}
and ir.ID_CARD=#{idNum}
and ir.id=#{icResiUserId}
SELECT
m.ID,
m.HOME_ID,
m.`NAME`
FROM
ic_resi_user m
WHERE
m.DEL_FLAG = '0'
AND m.id = #{isResiUserId}
SELECT
m.ID AS icResiUserId,
m.`NAME` AS icUserName,
m.AGENCY_ID AS agencyId,
m.GRID_ID AS gridId
FROM
ic_resi_user m
WHERE
m.DEL_FLAG = '0'
AND m.id != #{currentIcResiUserId}
and m.HOME_ID=#{homeId}
order by m.CREATED_TIME asc
SELECT
ageGroup AS "code",
COUNT(ID) AS "value"
FROM
(
SELECT
ID,
CASE
WHEN age < 50 THEN '0'
WHEN age >= 50 AND age <= 59 THEN '1'
WHEN age >= 60 AND age <= 69 THEN '2'
WHEN age >= 70 AND age <= 79 THEN '3'
ELSE '4'
END AS ageGroup
FROM
(
SELECT
ID,
YEAR (FROM_DAYS(DATEDIFF(NOW(),SUBSTRING( ID_CARD, 7, 8 )))) AS age
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND GRID_ID = #{orgId}
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
) a
) a
GROUP BY ageGroup
SELECT
ID AS "userId",
NAME,
MOBILE,
age
FROM
(
SELECT
ID,
NAME,
MOBILE,
age,
CASE
WHEN age < 50 THEN '0'
WHEN age >= 50 AND age <= 59 THEN '1'
WHEN age >= 60 AND age <= 69 THEN '2'
WHEN age >= 70 AND age <= 79 THEN '3'
ELSE '4'
END AS ageGroup
FROM
(
SELECT
ID,
NAME,
MOBILE,
YEAR (FROM_DAYS(DATEDIFF(NOW(),SUBSTRING( ID_CARD, 7, 8 )))) AS age
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND GRID_ID = #{orgId}
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
) a
) a
WHERE ageGroup = #{code}
ORDER BY CONVERT(NAME USING GBK) ASC
SELECT
ID AS "userId",
NAME,
MOBILE,
CULTURE AS education
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND CULTURE IS NOT NULL
AND CULTURE = #{code}
AND GRID_ID = #{orgId}
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
ORDER BY CONVERT(NAME USING GBK) ASC
SELECT
CULTURE AS "code",
count(ID) AS "value"
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND CULTURE IS NOT NULL
AND GRID_ID = #{orgId}
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
GROUP BY CULTURE
select userbaseinfo.USER_ID as epmetUserId,
icuser.ID as icResiUserId,
icuser.BUILD_ID as buildingId,
icvol.VOLUNTEER_CATEGORY as volunteerCategoriesStr
from user_base_info userbaseinfo
inner join ic_resi_user icuser on (userbaseinfo.ID_NUM = icuser.ID_CARD and icuser.DEL_FLAG = '0')
inner join ic_volunteer icvol on (icuser.ID = icvol.IC_RESI_USER and icvol.DEL_FLAG = '0')
where userbaseinfo.DEL_FLAG = '0'
and userbaseinfo.ID_NUM is not null
and userbaseinfo.USER_ID in
#{userId}
SELECT
IFNULL(`${c}`,'0') AS `${c}`
FROM
ic_resi_user
WHERE
del_flag = '0'
AND id = #{icUserId}
SELECT
ID AS userId,
GRID_ID AS gridId,
HOME_ID AS homeId,
`NAME` AS name,
MOBILE AS mobile,
${t}
FROM ic_resi_user
WHERE DEL_FLAG = 0
AND STATUS = '0'
AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
AND(
(${t} IS NOT NULL AND ${t} != 0)
)
ORDER BY CREATED_TIME DESC
select * from ic_resi_user
CUSTOMER_ID = #{customerId}
AND DEL_FLAG='0'
AND ID_CARD=#{idCard}
AND ID=#{resiId}
SELECT customer_id FROM ic_resi_user GROUP BY customer_id
SELECT
iru.id ID,
iru.customer_id CUSTOMER_ID,
iru.agency_id AGENCY_ID,
iru.pids PIDS,
iru.grid_id GRID_ID,
iru.village_id VILLAGE_ID,
iru.build_id BUILD_ID,
iru.unit_id UNIT_ID,
iru.home_id HOME_ID,
iru.name NAME,
iru.created_by CREATED_BY,
date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME
,
IFNULL(`${c}`,'0') AS `${c}`
FROM
ic_resi_user iru
LEFT JOIN ic_user_change_record iucr ON iru.id = iucr.ic_user_id AND iucr.type = 'add' AND iucr.del_flag = '0'
WHERE
iucr.ic_user_id IS NULL
AND iru.del_flag = '0'
AND iru.`status` = '0'
AND iru.customer_id = #{customerId}
ORDER BY iru.created_time ASC
SELECT
sum(case ${item} when '1' then 1 else 0 end) ${item}
FROM ic_resi_user
WHERE 1=1
AND (CONCAT(PIDS,':', agency_id) like CONCAT('%',#{id},'%'))
AND GRID_ID = #{id}
AND VILLAGE_ID = #{id}
VILLAGE_ID = #{id}
AND BUILD_ID = #{id}
AND CUSTOMER_ID = #{customerId}
AND DEL_FLAG = 0
AND `STATUS` = '0'
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
)
SELECT
DISTINCT home_id
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND home_id IN (
#{id}
)
SELECT * FROM
(SELECT
ID,
`NAME`,
GRID_ID,
HOME_ID,
MOBILE,
a.ID_CARD,
a.BIRTHDAY,
IFNULL( b.count, 0 ) AS vaccineCount,
IFNULL( c.count, 0 ) AS natCount
FROM
ic_resi_user a
LEFT JOIN (
SELECT ID_CARD, count(distinct INOCULATE_TIME ) AS count
FROM ic_vaccine
WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(INOCULATE_TIME,"%Y-%m-%d") >= #{startDate}
AND DATE_FORMAT(INOCULATE_TIME,"%Y-%m-%d") <= #{endDate}
GROUP BY ID_CARD ) b ON a.ID_CARD = b.ID_CARD
LEFT JOIN (
SELECT ID_CARD, count( id ) AS count
FROM ic_nat
WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") >= #{startDate}
AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") <= #{endDate}
AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") >= #{natStartDate}
AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") <= #{natEndDate}
GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD
WHERE
a.DEL_FLAG = '0'
AND a.`STATUS` = '0'
AND a.CUSTOMER_ID = #{customerId}
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
AND ID = #{id}
AND GRID_ID = #{gridId}
AND VILLAGE_ID = #{neighborId}
AND BUILD_ID = #{buildingId}
AND UNIT_ID = #{unitId}
AND HOME_ID = #{houseId}
AND `NAME` LIKE concat( '%', #{name}, '%' )
AND MOBILE LIKE concat( '%', #{mobile}, '%' )
AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' )
AND a.BIRTHDAY = ]]> #{startBirthDay}
AND a.BIRTHDAY #{endBirthDay}
ORDER BY GRID_ID,VILLAGE_ID,BUILD_ID,UNIT_ID,HOME_ID, convert(NAME using gbk)
) t
WHERE
1=1
AND vaccineCount = #{vaccineCount}
AND natCount = #{natCount}
order by t.vaccineCount desc, t.natCount desc
SELECT * FROM
(SELECT
ID,
`NAME`,
GRID_ID,
HOME_ID,
MOBILE,
a.ID_CARD,
c.created_time,
IFNULL( c.count, 0 ) AS natCount
FROM ic_resi_user a
LEFT JOIN ( SELECT ID_CARD, count( id ) AS count,created_time FROM ic_nat WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD
WHERE a.DEL_FLAG = '0'
and a.status = 0
AND a.CUSTOMER_ID = #{customerId}
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
AND GRID_ID = #{gridId}
AND a.VILLAGE_ID = #{neighborId}
AND a.BUILD_ID = #{buildingId}
AND a.UNIT_ID = #{unitId}
AND a.HOME_ID = #{houseId}
AND a.`NAME` LIKE concat( '%', #{name}, '%' )
AND a.MOBILE LIKE concat( '%', #{mobile}, '%' )
AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' )
AND a.BIRTHDAY = ]]> #{startBirthDay}
AND a.BIRTHDAY #{endBirthDay}
) t
WHERE 1=1
AND date_format(created_time,'%Y%m%d') >= #{startDate}
AND date_format(created_time,'%Y%m%d') #{endDate}
AND natCount #{natCount}
ORDER BY `NAME`
SELECT * FROM
(SELECT
ID,
`NAME`,
GRID_ID,
HOME_ID,
MOBILE,
a.ID_CARD,
b.created_time,
IFNULL( b.count, 0 ) AS vaccineCount
FROM ic_resi_user a
LEFT JOIN ( SELECT ID_CARD, count( id ) AS count,created_time FROM ic_vaccine WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) b ON a.ID_CARD = b.ID_CARD
WHERE a.DEL_FLAG = '0'
and a.status = 0
AND a.CUSTOMER_ID = #{customerId}
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
AND GRID_ID = #{gridId}
) t
WHERE 1=1
AND date_format(created_time,'%Y%m%d') >= #{startDate}
AND date_format(created_time,'%Y%m%d') #{endDate}
AND vaccineCount #{vaccineCount}
ORDER BY `NAME`
SELECT ID,NAME,ID_CARD,DEL_FLAG FROM ic_resi_user WHERE ID = #{icResiUserId}
SELECT
COUNT(id) num,
is_floating isFloating
FROM
ic_resi_user
WHERE
del_flag = '0'
AND status = '0'
AND (agency_id = #{orgId} OR pids LIKE CONCAT('%', #{orgId}, '%'))
#{agencyId}
#{gridId}
AND grid_id = #{orgId}
AND village_id = #{orgId}
GROUP BY is_floating
SELECT
HOME_ID,
ID,NAME,GENDER,MOBILE,ID_CARD,BIRTHDAY,HJSZD,YHZGX,IS_PARTY,IS_TENANT,IS_FLOATING,GZDW,MZ,JG,HYZK,CULTURE,FAITH,REMARKS
FROM ic_resi_user
WHERE
STATUS = '0'
AND DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
and ( AGENCY_ID = #{agencyId} OR PIDS like CONCAT(#{pids}, '%') )
and GRID_ID = #{gridId}
and VILLAGE_ID = #{neighborHoodId}
and BUILD_ID = #{buildingId}
and HOME_ID = #{houseId}
SELECT ID from ic_resi_user
WHERE
GRID_ID = #{gridId}
AND CUSTOMER_ID = #{customerId}
and VILLAGE_ID = #{neighborhoodId}
AND DEL_FLAG = '0'
SELECT
I.ID
FROM
ic_resi_user i
WHERE
i.DEL_FLAG = '0'
AND i.CUSTOMER_ID = #{customerId}
AND i.ID_CARD = #{idCard}
UNION
SELECT
ubi.USER_ID
FROM
user_base_info ubi
WHERE
ubi.DEL_FLAG = '0'
AND ubi.CUSTOMER_ID = #{customerId}
AND ubi.ID_NUM = #{idCard}
SELECT
a.ID AS icResiUser,
a.CUSTOMER_ID,
a.AGENCY_ID,
a.PIDS AS agencyPids,
`NAME`,
ID_CARD,
MOBILE,
GENDER,
IS_PARTY,
IFNULL( VOLUNTEER_CATEGORY, "qita" ) AS VOLUNTEER_CATEGORY,
IFNULL( IS_DYZXH, "0" ) AS IS_DYZXH
FROM
ic_resi_user a
LEFT JOIN ic_volunteer b ON a.ID = b.IC_RESI_USER
AND b.DEL_FLAG = '0'
LEFT JOIN ic_party_member c ON a.ID = c.IC_RESI_USER
AND c.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
AND a.IS_VOLUNTEER = '1'
AND a.CUSTOMER_ID = #{customerId}
AND a.ID = #{userId}
UNION ALL
SELECT
a.ID AS icResiUser,
a.CUSTOMER_ID,
a.AGENCY_ID,
a.PIDS AS agencyPids,
`NAME`,
ID_CARD,
MOBILE,
GENDER,
IS_PARTY,
'dangyuanzhongxinhu' AS VOLUNTEER_CATEGORY,
IFNULL( IS_DYZXH, "0" ) AS IS_DYZXH
FROM
ic_resi_user a
INNER JOIN ic_party_member c ON a.ID = c.IC_RESI_USER
AND c.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
AND a.IS_VOLUNTEER != '1'
AND a.IS_PARTY = '1'
AND a.CUSTOMER_ID = #{customerId}
AND c.IS_DYZXH = '1'
AND a.ID = #{userId}
select
count(*)
from
ic_resi_user
where
id_card = #{idCard}
and customer_id = #{customerId}
and del_flag = '0'
select id from ic_resi_user where id_card = #{idCard} and customer_id = #{customerId}
select
ID as icResiUserId,
name,
ID_CARD,
gender,
birthday,
MOBILE,
mz,
HJSZD,
yhzgx,
XJZD,
HOME_ID AS houseId
from ic_resi_user
where DEL_FLAG='0'
and Status='0'
and id=#{icResiUserId}
SELECT
AGENCY_ID,
PIDS,
HOME_ID AS houseId,
NAME as allName,
MOBILE,
GENDER,
ID_CARD,
BIRTHDAY,
HJSZD,
XJZD,
mz,
YHZGX
FROM
ic_resi_user
WHERE
id = #{icResiUserId}
AND customer_id = #{customerId}
AND STATUS = '0'
AND DEL_FLAG = '0'
select * from ic_resi_user
WHERE
ID_CARD = #{idCard}
AND customer_id = #{customerId}
AND DEL_FLAG = '0'
select
HOME_ID houseId,
count(1) resiNumber,
AVG(YSR) avgYsr
from ic_resi_user WHERE CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' AND `status` = '0' group by HOME_ID
select id, NAME,MOBILE
from ic_resi_user
WHERE 1=1
id = #{icResiUserId}
SELECT
CASE #{orgType}
WHEN '0' THEN AGENCY_ID
WHEN '1' THEN GRID_ID
WHEN '2' THEN VILLAGE_ID
WHEN '3' THEN BUILD_ID
WHEN '4' THEN UNIT_ID
ELSE HOME_ID END AS "id",
CASE #{orgType}
WHEN '0' THEN GRID_ID
WHEN '1' THEN VILLAGE_ID
WHEN '2' THEN BUILD_ID
WHEN '3' THEN UNIT_ID
WHEN '4' THEN HOME_ID
ELSE HOME_ID END AS "id",
COUNT(ID) AS "count"
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND STATUS = '0'
AND AGENCY_ID = #{orgId}
AND GRID_ID = #{orgId}
AND VILLAGE_ID = #{orgId}
AND BUILD_ID = #{orgId}
AND UNIT_ID = #{orgId}
GROUP BY
GRID_ID
VILLAGE_ID
BUILD_ID
UNIT_ID
HOME_ID
SELECT
id AS userId,
`name`,
village_id AS neighborHoodId,
build_id,
grid_id,
mobile,
(
case when gender = '1'then '男'
when gender = '2' then '女'
else '未知'
end
) as gender,
id_card,
IFNULL(birthday,'') AS birthday,
IFNULL(remarks,'') AS remarks
FROM
ic_resi_user
WHERE
del_flag = '0'
AND status = '0'
AND customer_id = #{customerId}
AND is_floating = '0'
AND (is_floating != '0' or is_floating is null)
AND RHZK = 'rhyz'
AND RHZK = 'rzhbz'
AND RHZK = 'hzrbz'
AND(RHZK = '' or RHZK IS null)
AND (agency_id = #{orgId} OR pids LIKE CONCAT('%', #{orgId}, '%'))
#{agencyId}
#{gridId}
AND grid_id = #{orgId}
AND village_id = #{orgId}
ORDER BY `name` ASC
SELECT
(SELECT
COUNT(ID)
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = 0
AND PIDS LIKE CONCAT('%',#{agencyId},'%')
AND ID_CARD = #{idCard}) AS isLocal,
COUNT(ID) AS isResi,
id as userId
from ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = 0
AND CUSTOMER_ID = #{customerId}
AND ID_CARD = #{idCard}
SELECT
COUNT(ID) AS total,
rhzk,
orgId
FROM
(SELECT
ID,
IFNULL(RHZK,'') AS rhzk,
AGENCY_ID AS orgId
GRID_ID AS orgId
VILLAGE_ID AS orgId
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = '0'
AND PIDS LIKE CONCAT('%',#{orgId},'%')
AND GRID_ID = #{orgId}
AND VILLAGE_ID = #{orgId}
) t
GROUP BY rhzk
SELECT
a.id,
a.customer_id,
a.`name`,
a.id_card
FROM
ic_resi_user a
LEFT JOIN ic_resi_comparison_record b on a.id = b.RESI_ID
WHERE
a.del_flag = '0'
AND a.pids LIKE CONCAT('%',#{agencyId},'%')
#{id}
AND b.id is null
order by a.pids ASC, a.created_time DESC
select * from ic_resi_user where pids like concat('%',#{agencyId},'%') and status='0' and customer_id=#{customerId}
SELECT
r.CULTURE AS `code`,
count( r.id ) AS totalResi
FROM
ic_resi_user r
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
and r.PIDS LIKE concat(#{orgIdPath},'%')
and r.GRID_ID = #{orgId}
AND r.`STATUS` = '0'
AND r.CULTURE IS NOT NULL
AND r.CULTURE != ''
GROUP BY
r.CULTURE
select
temp.CODE,
count(temp.ID) as totalResi
from (
select
temp1.id,
(
case when temp1.age < 50 then '0'
when temp1.age >= 50 and temp1.age <= 59 then '1'
when temp1.age >= 60 and temp1.age <= 69 then '2'
when temp1.age >= 70 and temp1.age <= 79 then '3'
when temp1.age >= 80 then '4'
end
) as `code`
from (
SELECT
u.ID,
YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) as age
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
and u.`STATUS`='0'
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and u.PIDS LIKE concat(#{orgIdPath},'%')
and u.GRID_ID = #{orgId}
)temp1
)temp
group by temp.`code`
SELECT
u.ID AS icResiUserId,
u.grid_id as gridId,
u.VILLAGE_ID as villageId,
u.BUILD_ID as buildId,
u.UNIT_ID as unitId,
u.HOME_ID as homeId,
u.`NAME` AS `name`,
u.MOBILE AS mobile,
u.ID_CARD AS idCard,
u.GENDER AS gender,
( CASE WHEN u.GENDER = '1' THEN '男' WHEN u.GENDER = '2' THEN '女' ELSE '未知' END ) AS genderName,
YEAR (NOW())- SUBSTR( u.BIRTHDAY, 1, 4 ) AS age,
u.CULTURE AS educationCode,
(
case when u.CULTURE='0' then '小学及文盲'
when u.CULTURE='1' then '初中'
when u.CULTURE='2' then '高中'
when u.CULTURE='3' then '大专'
when u.CULTURE='4' then '本科'
when u.CULTURE='5' then '硕士'
when u.CULTURE='6' then '博士'
when u.CULTURE='7' then '中专'
else ''
end
)as educationName,
'' AS educationName,
IFNULL(u.CULTURE,'')AS educationCode,
u.BIRTHDAY AS birthday
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
AND u.`STATUS` = '0'
and u.PIDS LIKE concat(#{orgIdPath},'%')
and u.GRID_ID = #{orgId}
and u.CULTURE = #{code}
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) < 50
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=59
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >= 60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <= 69
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=79
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=80
order by u.ID asc
select r.* from ic_resi_user r where r.id = #{icResiUserId}