120 lines
6.2 KiB
XML
120 lines
6.2 KiB
XML
<?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.stdiet.custom.mapper.SysImportFanWxAccountMapper">
|
|
|
|
<resultMap type="SysImportFanWxAccount" id="SysImportFanWxAccountResult">
|
|
<result property="id" column="id" />
|
|
<result property="importFanRecordId" column="import_fan_record_id" />
|
|
<result property="importWxAccountId" column="import_wx_account_id" />
|
|
<result property="importFanNum" column="import_fan_num" />
|
|
<result property="importTime" column="import_time" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="delFlag" column="del_flag" />
|
|
</resultMap>
|
|
|
|
<sql id="selectSysImportFanWxAccountVo">
|
|
select id, import_fan_record_id, import_wx_account_id, import_fan_num,import_time, create_time, create_by, update_time, update_by, del_flag from sys_import_fan_wx_account
|
|
</sql>
|
|
|
|
<select id="selectSysImportFanWxAccountList" parameterType="SysImportFanWxAccount" resultMap="SysImportFanWxAccountResult">
|
|
<include refid="selectSysImportFanWxAccountVo"/> where del_flag = 0
|
|
<if test="importFanRecordId != null "> and import_fan_record_id = #{importFanRecordId}</if>
|
|
<if test="importWxAccountId != null "> and import_wx_account_id = #{importWxAccountId}</if>
|
|
<if test="importFanNum != null "> and import_fan_num = #{importFanNum}</if>
|
|
</select>
|
|
|
|
<select id="selectSysImportFanWxAccountById" parameterType="Long" resultMap="SysImportFanWxAccountResult">
|
|
<include refid="selectSysImportFanWxAccountVo"/>
|
|
where id = #{id} and del_flag = 0
|
|
</select>
|
|
|
|
<insert id="insertSysImportFanWxAccount" parameterType="SysImportFanWxAccount" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sys_import_fan_wx_account
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="importFanRecordId != null">import_fan_record_id,</if>
|
|
<if test="importWxAccountId != null">import_wx_account_id,</if>
|
|
<if test="importFanNum != null">import_fan_num,</if>
|
|
<if test="importTime != null">import_time,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="importFanRecordId != null">#{importFanRecordId},</if>
|
|
<if test="importWxAccountId != null">#{importWxAccountId},</if>
|
|
<if test="importFanNum != null">#{importFanNum},</if>
|
|
<if test="importTime != null">#{importTime},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateSysImportFanWxAccount" parameterType="SysImportFanWxAccount">
|
|
update sys_import_fan_wx_account
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="importFanRecordId != null">import_fan_record_id = #{importFanRecordId},</if>
|
|
<if test="importWxAccountId != null">import_wx_account_id = #{importWxAccountId},</if>
|
|
<if test="importFanNum != null">import_fan_num = #{importFanNum},</if>
|
|
<if test="importTime != null">import_time = #{importTime},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysImportFanWxAccountById" parameterType="Long">
|
|
update sys_import_fan_wx_account set del_flag = 1 where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysImportFanWxAccountByIds" parameterType="String">
|
|
update sys_import_fan_wx_account set del_flag = 1 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="getWxAccountByFanRecordId" parameterType="SysImportFanWxAccount" resultMap="SysImportFanWxAccountResult">
|
|
select * from sys_import_fan_wx_account where del_flag = 0 and import_fan_record_id = #{importFanRecordId}
|
|
and import_wx_account_id = #{importWxAccountId} order by id desc limit 1
|
|
</select>
|
|
|
|
<!-- 根据微信号ID查询导粉多少 -->
|
|
<select id="getTotalImportFanNum" parameterType="SysImportFanWxAccount" resultType="Map">
|
|
select w.import_wx_account_id as wxAccountId,sum(w.import_fan_num) as fanNum
|
|
from
|
|
(
|
|
select fwa.import_wx_account_id,fwa.import_fan_num from sys_import_fan_wx_account fwa
|
|
left join sys_import_fan_record ifr on fwa.import_fan_record_id = ifr.id and ifr.del_flag = 0
|
|
where fwa.del_flag = 0
|
|
<if test="importFanDate != null">
|
|
and ifr.import_fan_date = #{importFanDate}
|
|
</if>
|
|
<if test="importWxAccountId != null">
|
|
and fwa.import_wx_account_id = #{importWxAccountId}
|
|
</if>
|
|
) w
|
|
group by w.import_wx_account_id order by w.import_wx_account_id desc
|
|
</select>
|
|
|
|
<!-- 根据导粉ID删除对应所有微信记录 -->
|
|
<update id="deleteSysImportFanWxAccountByFanRecordIds" parameterType="String">
|
|
update sys_import_fan_wx_account set del_flag = 1 where import_fan_record_id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
</mapper> |