市北互联平台后端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.5 KiB

4 years ago
<?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.epmet.dao.IcResiUserDao">
4 years ago
<insert id="add">
insert into ${tableName}
(
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
${key}
</foreach>
,DEL_FLAG
,REVISION
,CREATED_TIME
,UPDATED_TIME
) values
(
4 years ago
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
#{value}
</foreach>
,'0'
,'0'
,NOW()
,NOW()
4 years ago
)
</insert>
4 years ago
4 years ago
<update id="upTable">
UPDATE ${tableName}
SET
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
${key} = #{value}
</foreach>
,UPDATED_TIME = NOW()
WHERE id = #{id}
</update>
4 years ago
4 years ago
<select id="selectListMapById" parameterType="java.lang.String" resultType="map">
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId}
</select>
<select id="selectSubTableRecords" parameterType="map" resultType="map">
select * from ${tableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId}
</select>
<select id="selectListResiMap" parameterType="map" resultType="map">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
,
GROUP_CONCAT(ic_resi_demand.CATEGORY_CODE) as DEMAND_CATEGORY_IDS,
GROUP_CONCAT(ic_resi_demand_dict.CATEGORY_NAME) as DEMAND_NAME
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
left join ic_resi_demand_dict
on(ic_resi_user.customer_id=ic_resi_demand_dict.CUSTOMER_ID
and ic_resi_demand.CATEGORY_CODE=ic_resi_demand_dict.CATEGORY_CODE )
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
group by IC_RESI_USER.id
order by ic_resi_user.CREATED_TIME desc
</select>
4 years ago
</mapper>