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.
125 lines
4.6 KiB
125 lines
4.6 KiB
<?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">
|
|
|
|
<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
|
|
(
|
|
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
|
|
#{value}
|
|
</foreach>
|
|
,'0'
|
|
,'0'
|
|
,NOW()
|
|
,NOW()
|
|
)
|
|
</insert>
|
|
|
|
<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>
|
|
|
|
|
|
<select id="selectListMapById" parameterType="map" resultType="map">
|
|
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId} and customer_id=#{customerId}
|
|
</select>
|
|
|
|
<select id="selectSubTableRecords" parameterType="map" resultType="map">
|
|
select * from ${subTableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId} and customer_id=#{customerId}
|
|
</select>
|
|
|
|
|
|
<!-- 公用where条件 -->
|
|
<sql id="listWhere">
|
|
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>
|
|
</sql>
|
|
|
|
<!-- 查询列表用 -->
|
|
<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>
|
|
<include refid="listWhere"></include>
|
|
</where>
|
|
group by IC_RESI_USER.id
|
|
order by ic_resi_user.CREATED_TIME desc
|
|
</select>
|
|
|
|
<update id="updateToDel" parameterType="java.lang.String">
|
|
update ic_resi_user set del_flag='1' where id=#{icResiUserId}
|
|
</update>
|
|
|
|
<update id="updateSubTableToDel" parameterType="map">
|
|
update ${subTalbeName} set del_flag='1' where IC_RESI_USER=#{icResiUserId}
|
|
</update>
|
|
|
|
<select id="dynamicQuery" parameterType="map" resultType="map">
|
|
select
|
|
${resultTableName}.*
|
|
FROM
|
|
ic_resi_user
|
|
<if test="null != subTables and subTables.size() > 0">
|
|
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
|
|
${subTableName}
|
|
</foreach>
|
|
</if>
|
|
|
|
<where>
|
|
<include refid="listWhere"></include>
|
|
</where>
|
|
group by IC_RESI_USER.id
|
|
order by ic_resi_user.CREATED_TIME desc
|
|
</select>
|
|
</mapper>
|