193 lines
5.2 KiB
XML
193 lines
5.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.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="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,
|
|
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.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,
|
|
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,
|
|
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>
|
|
|
|
<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="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=";">
|
|
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>
|
|
|
|
|
|
<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>
|
|
</mapper> |