311 lines
14 KiB
XML
311 lines
14 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.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper">
|
|
|
|
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount" id="TbMerchantAccountMap">
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="account" column="account" jdbcType="VARCHAR"/>
|
|
<result property="password" column="password" jdbcType="VARCHAR"/>
|
|
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
|
|
<result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
|
|
<result property="shopSnap" column="shop_snap" jdbcType="VARCHAR"/>
|
|
<result property="isAdmin" column="is_admin" jdbcType="INTEGER"/>
|
|
<result property="isMercantile" column="is_mercantile" jdbcType="INTEGER"/>
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
<result property="sex" column="sex" jdbcType="INTEGER"/>
|
|
<result property="email" column="email" jdbcType="VARCHAR"/>
|
|
<result property="headImg" column="head_img" jdbcType="VARCHAR"/>
|
|
<result property="telephone" column="telephone" jdbcType="VARCHAR"/>
|
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
|
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
|
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
|
|
<result property="lastLoginAt" column="last_login_at" jdbcType="INTEGER"/>
|
|
<result property="mpOpenId" column="mp_open_id" jdbcType="VARCHAR"/>
|
|
<result property="msgAble" column="msg_able" jdbcType="INTEGER"/>
|
|
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
|
|
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="TbMerchantAccountMap">
|
|
select
|
|
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at
|
|
from tb_merchant_account
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="queryAllByLimit" resultMap="TbMerchantAccountMap">
|
|
select
|
|
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at
|
|
from tb_merchant_account
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="account != null and account != ''">
|
|
and account = #{account}
|
|
</if>
|
|
<if test="password != null and password != ''">
|
|
and password = #{password}
|
|
</if>
|
|
<if test="merchantId != null and merchantId != ''">
|
|
and merchant_id = #{merchantId}
|
|
</if>
|
|
<if test="shopId != null and shopId != ''">
|
|
and shop_id = #{shopId}
|
|
</if>
|
|
<if test="shopSnap != null and shopSnap != ''">
|
|
and shop_snap = #{shopSnap}
|
|
</if>
|
|
<if test="isAdmin != null">
|
|
and is_admin = #{isAdmin}
|
|
</if>
|
|
<if test="isMercantile != null">
|
|
and is_mercantile = #{isMercantile}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and name = #{name}
|
|
</if>
|
|
<if test="sex != null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="email != null and email != ''">
|
|
and email = #{email}
|
|
</if>
|
|
<if test="headImg != null and headImg != ''">
|
|
and head_img = #{headImg}
|
|
</if>
|
|
<if test="telephone != null and telephone != ''">
|
|
and telephone = #{telephone}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="sort != null">
|
|
and sort = #{sort}
|
|
</if>
|
|
<if test="roleId != null">
|
|
and role_id = #{roleId}
|
|
</if>
|
|
<if test="lastLoginAt != null">
|
|
and last_login_at = #{lastLoginAt}
|
|
</if>
|
|
<if test="mpOpenId != null and mpOpenId != ''">
|
|
and mp_open_id = #{mpOpenId}
|
|
</if>
|
|
<if test="msgAble != null">
|
|
and msg_able = #{msgAble}
|
|
</if>
|
|
<if test="createdAt != null">
|
|
and created_at = #{createdAt}
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
and updated_at = #{updatedAt}
|
|
</if>
|
|
</where>
|
|
limit #{pageable.offset}, #{pageable.pageSize}
|
|
</select>
|
|
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from tb_merchant_account
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="account != null and account != ''">
|
|
and account = #{account}
|
|
</if>
|
|
<if test="password != null and password != ''">
|
|
and password = #{password}
|
|
</if>
|
|
<if test="merchantId != null and merchantId != ''">
|
|
and merchant_id = #{merchantId}
|
|
</if>
|
|
<if test="shopId != null and shopId != ''">
|
|
and shop_id = #{shopId}
|
|
</if>
|
|
<if test="shopSnap != null and shopSnap != ''">
|
|
and shop_snap = #{shopSnap}
|
|
</if>
|
|
<if test="isAdmin != null">
|
|
and is_admin = #{isAdmin}
|
|
</if>
|
|
<if test="isMercantile != null">
|
|
and is_mercantile = #{isMercantile}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and name = #{name}
|
|
</if>
|
|
<if test="sex != null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="email != null and email != ''">
|
|
and email = #{email}
|
|
</if>
|
|
<if test="headImg != null and headImg != ''">
|
|
and head_img = #{headImg}
|
|
</if>
|
|
<if test="telephone != null and telephone != ''">
|
|
and telephone = #{telephone}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="sort != null">
|
|
and sort = #{sort}
|
|
</if>
|
|
<if test="roleId != null">
|
|
and role_id = #{roleId}
|
|
</if>
|
|
<if test="lastLoginAt != null">
|
|
and last_login_at = #{lastLoginAt}
|
|
</if>
|
|
<if test="mpOpenId != null and mpOpenId != ''">
|
|
and mp_open_id = #{mpOpenId}
|
|
</if>
|
|
<if test="msgAble != null">
|
|
and msg_able = #{msgAble}
|
|
</if>
|
|
<if test="createdAt != null">
|
|
and created_at = #{createdAt}
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
and updated_at = #{updatedAt}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="selectByAccount" resultType="com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount">
|
|
select
|
|
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at
|
|
from tb_merchant_account
|
|
where account = #{account}
|
|
</select>
|
|
<select id="selectByShopId" resultType="com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount">
|
|
select
|
|
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at
|
|
from tb_merchant_account
|
|
where shop_id = #{shopId}
|
|
</select>
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_merchant_account(account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at)
|
|
values (#{account}, #{password}, #{merchantId}, #{shopId}, #{shopSnap}, #{isAdmin}, #{isMercantile}, #{name}, #{sex}, #{email}, #{headImg}, #{telephone}, #{status}, #{sort}, #{roleId}, #{lastLoginAt}, #{mpOpenId}, #{msgAble}, #{createdAt}, #{updatedAt})
|
|
</insert>
|
|
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_merchant_account(account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.account}, #{entity.password}, #{entity.merchantId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.isAdmin}, #{entity.isMercantile}, #{entity.name}, #{entity.sex}, #{entity.email}, #{entity.headImg}, #{entity.telephone}, #{entity.status}, #{entity.sort}, #{entity.roleId}, #{entity.lastLoginAt}, #{entity.mpOpenId}, #{entity.msgAble}, #{entity.createdAt}, #{entity.updatedAt})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_merchant_account(account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile, name, sex, email, head_img, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able, created_at, updated_at)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.account}, #{entity.password}, #{entity.merchantId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.isAdmin}, #{entity.isMercantile}, #{entity.name}, #{entity.sex}, #{entity.email}, #{entity.headImg}, #{entity.telephone}, #{entity.status}, #{entity.sort}, #{entity.roleId}, #{entity.lastLoginAt}, #{entity.mpOpenId}, #{entity.msgAble}, #{entity.createdAt}, #{entity.updatedAt})
|
|
</foreach>
|
|
on duplicate key update
|
|
account = values(account),
|
|
password = values(password),
|
|
merchant_id = values(merchant_id),
|
|
shop_id = values(shop_id),
|
|
shop_snap = values(shop_snap),
|
|
is_admin = values(is_admin),
|
|
is_mercantile = values(is_mercantile),
|
|
name = values(name),
|
|
sex = values(sex),
|
|
email = values(email),
|
|
head_img = values(head_img),
|
|
telephone = values(telephone),
|
|
status = values(status),
|
|
sort = values(sort),
|
|
role_id = values(role_id),
|
|
last_login_at = values(last_login_at),
|
|
mp_open_id = values(mp_open_id),
|
|
msg_able = values(msg_able),
|
|
created_at = values(created_at),
|
|
updated_at = values(updated_at)
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
update tb_merchant_account
|
|
<set>
|
|
<if test="account != null and account != ''">
|
|
account = #{account},
|
|
</if>
|
|
<if test="password != null and password != ''">
|
|
password = #{password},
|
|
</if>
|
|
<if test="merchantId != null and merchantId != ''">
|
|
merchant_id = #{merchantId},
|
|
</if>
|
|
<if test="shopId != null and shopId != ''">
|
|
shop_id = #{shopId},
|
|
</if>
|
|
<if test="shopSnap != null and shopSnap != ''">
|
|
shop_snap = #{shopSnap},
|
|
</if>
|
|
<if test="isAdmin != null">
|
|
is_admin = #{isAdmin},
|
|
</if>
|
|
<if test="isMercantile != null">
|
|
is_mercantile = #{isMercantile},
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="sex != null">
|
|
sex = #{sex},
|
|
</if>
|
|
<if test="email != null and email != ''">
|
|
email = #{email},
|
|
</if>
|
|
<if test="headImg != null and headImg != ''">
|
|
head_img = #{headImg},
|
|
</if>
|
|
<if test="telephone != null and telephone != ''">
|
|
telephone = #{telephone},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status},
|
|
</if>
|
|
<if test="sort != null">
|
|
sort = #{sort},
|
|
</if>
|
|
<if test="roleId != null">
|
|
role_id = #{roleId},
|
|
</if>
|
|
<if test="lastLoginAt != null">
|
|
last_login_at = #{lastLoginAt},
|
|
</if>
|
|
<if test="mpOpenId != null and mpOpenId != ''">
|
|
mp_open_id = #{mpOpenId},
|
|
</if>
|
|
<if test="msgAble != null">
|
|
msg_able = #{msgAble},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at = #{createdAt},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at = #{updatedAt},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete from tb_merchant_account where id = #{id}
|
|
</delete>
|
|
|
|
</mapper>
|
|
|