老数据数据处理

This commit is contained in:
shuo.wang
2025-05-12 17:12:05 +08:00
parent 6e2274af88
commit db4c7b2bd9
43 changed files with 1604 additions and 205 deletions

View File

@@ -1,203 +1,216 @@
<?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.cool.store.mapper.ShopAccountMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopAccountDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="system_name" jdbcType="VARCHAR" property="systemName" />
<result column="account" jdbcType="VARCHAR" property="account" />
<result column="bound_phone" jdbcType="VARCHAR" property="boundPhone" />
<result column="password_salt" jdbcType="VARCHAR" property="passwordSalt" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="status" jdbcType="BIT" property="status" />
<result column="entry_status" jdbcType="TINYINT" property="entryStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_sync_time" jdbcType="TIMESTAMP" property="lastSyncTime" />
<result column="secondary_password" jdbcType="VARCHAR" property="secondaryPassword" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopAccountDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="shop_id" jdbcType="INTEGER" property="shopId"/>
<result column="system_name" jdbcType="VARCHAR" property="systemName"/>
<result column="account" jdbcType="VARCHAR" property="account"/>
<result column="bound_phone" jdbcType="VARCHAR" property="boundPhone"/>
<result column="password_salt" jdbcType="VARCHAR" property="passwordSalt"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
<result column="status" jdbcType="BIT" property="status"/>
<result column="entry_status" jdbcType="TINYINT" property="entryStatus"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="last_sync_time" jdbcType="TIMESTAMP" property="lastSyncTime"/>
<result column="secondary_password" jdbcType="VARCHAR" property="secondaryPassword"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO xfsg_shop_account (
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
last_sync_time,
secondary_password,
remark
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.shopId},
#{item.systemName},
#{item.account},
#{item.boundPhone},
#{item.passwordSalt},
#{item.password},
#{item.status},
#{item.entryStatus},
#{item.lastSyncTime},
#{item.secondaryPassword},
#{item.remark}
)
</foreach>
</insert>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO xfsg_shop_account (
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
last_sync_time,
secondary_password,
remark
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.shopId},
#{item.systemName},
#{item.account},
#{item.boundPhone},
#{item.passwordSalt},
#{item.password},
#{item.status},
#{item.entryStatus},
#{item.lastSyncTime},
#{item.secondaryPassword},
#{item.remark}
)
</foreach>
</insert>
<!-- 根据shopId查询多条数据 -->
<select id="selectByShopId" resultMap="BaseResultMap">
SELECT
id,
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
create_time,
last_sync_time,
secondary_password,
remark
FROM
xfsg_shop_account
WHERE
shop_id = #{shopId}
order by id
</select>
<!-- 根据shopId查询多条数据 -->
<select id="selectByShopId" resultMap="BaseResultMap">
SELECT
id,
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
create_time,
last_sync_time,
secondary_password,
remark
FROM
xfsg_shop_account
WHERE
shop_id = #{shopId}
order by id
</select>
<select id="selectByShopIdAndSystemName" resultMap="BaseResultMap">
SELECT
id,
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
create_time,
last_sync_time,
secondary_password,
remark
FROM
xfsg_shop_account
WHERE
shop_id = #{shopId}
and system_name = #{systemName}
</select>
<select id="selectByShopIdAndSystemName" resultMap="BaseResultMap">
SELECT
id,
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
create_time,
last_sync_time,
secondary_password,
remark
FROM
xfsg_shop_account
WHERE
shop_id = #{shopId}
and system_name = #{systemName}
</select>
<!-- 根据shopId与system_name修改status -->
<update id="updateStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
<set>
<if test="status != null">
status = #{status},
</if>
<if test="syncTime != null">
last_sync_time = #{syncTime},
</if>
<if test="ylsCode != null">
account = #{ylsCode},
</if>
</set>
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<!-- 根据shopId与system_name修改status -->
<update id="updateStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
<set>
<if test="status != null">
status = #{status},
</if>
<if test="syncTime != null">
last_sync_time = #{syncTime},
</if>
<if test="ylsCode != null">
account = #{ylsCode},
</if>
</set>
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<update id="updateEntryStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
entry_status = #{entryStatus,jdbcType=BIT}
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<update id="updateEntryStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
entry_status = #{entryStatus,jdbcType=BIT}
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<update id="updateAccountByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
account = #{account},
password = #{password},
status = #{status}
WHERE
shop_id = #{shopId}
AND system_name = #{systemName}
</update>
<update id="updateAccountByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
account = #{account},
password = #{password},
status = #{status}
WHERE
shop_id = #{shopId}
AND system_name = #{systemName}
</update>
<!-- 批量修改密码和密码盐 -->
<update id="batchUpdatePasswordByShopIds">
UPDATE
xfsg_shop_account
SET
password = #{password},
secondary_password = #{secondaryPassword},
password_salt = #{passwordSalt},
last_sync_time = #{lastSyncTime,jdbcType=TIMESTAMP}
WHERE
system_name in ('火码POS','云流水','新掌柜')
and shop_id IN
<foreach close=")" collection="shopIds" item="shopId" open="(" separator=",">
#{shopId}
</foreach>
</update>
<!-- 批量修改密码和密码盐 -->
<update id="batchUpdatePasswordByShopIds">
UPDATE
xfsg_shop_account
SET
password = #{password},
secondary_password = #{secondaryPassword},
password_salt = #{passwordSalt},
last_sync_time = #{lastSyncTime,jdbcType=TIMESTAMP}
WHERE
system_name in ('火码POS','云流水','新掌柜')
and shop_id IN
<foreach close=")" collection="shopIds" item="shopId" open="(" separator=",">
#{shopId}
</foreach>
</update>
<update id="dateHandle">
<foreach collection="list" item="item" separator=";">
<foreach collection="list" item="item" separator=";">
update xfsg_shop_account
<set>
<if test="item.passwordSalt != null">
password_salt = #{item.passwordSalt},
</if>
<if test="item.password != null">
password = #{item.password},
</if>
<if test="item.secondaryPassword != null">
secondary_password = #{item.secondaryPassword},
</if>
</set>
where id = #{item.id}
</foreach>
</update>
<update id="updateStatusDataHandle">
update xfsg_shop_account
<set>
<if test="item.passwordSalt != null">
password_salt = #{item.passwordSalt},
</if>
<if test="item.password != null">
password = #{item.password},
</if>
<if test="item.secondaryPassword != null">
secondary_password = #{item.secondaryPassword},
</if>
status = 5
</set>
where id = #{item.id}
</foreach>
where
shop_id in
<foreach collection="list" item="shopId" open="(" close=")" separator=",">
#{shopId}
</foreach>
and system_name in ('火码POS','云流水','新掌柜')
</update>
<select id="getALlFail">
select * from xfsg_shop_account WHERE
system_name in ('火码POS')
and status = 6
</select>
<select id="getSpecificByShopIds" resultType="com.cool.store.entity.ShopAccountDO">
select shop_id as shopId,system_name as systemName,status from xfsg_shop_account
where shop_id in
<foreach collection="shopIds" item="shopId" open="(" close=")" separator=",">
#{shopId}
</foreach>
select * from xfsg_shop_account WHERE
system_name in ('火码POS')
and status = 6
</select>
<select id="getPasswordIsNull" resultType="java.lang.Long">
SELECT shop_id as shopId FROM xfsg_shop_account
WHERE `password` is null and `system_name` = '火码POS'
<select id="getSpecificByShopIds" resultType="com.cool.store.entity.ShopAccountDO">
select shop_id as shopId,system_name as systemName,status from xfsg_shop_account
where shop_id in
<foreach collection="shopIds" item="shopId" open="(" close=")" separator=",">
#{shopId}
</foreach>
</select>
<select id="getPasswordIsNull" resultType="java.lang.Long">
SELECT shop_id as shopId FROM xfsg_shop_account
WHERE `password` is null and `system_name` = '火码POS'
</select>
</select>
</mapper>