314 lines
12 KiB
XML
Raw Normal View History

2022-01-27 09:52:02 +08:00
<?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">
<!--suppress ALL -->
<mapper namespace="com.xhpc.card.mapper.TIccardInfoMapper">
<resultMap id="BaseResultMap" type="com.xhpc.card.pojo.TIccardInfo">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="cardID" jdbcType="VARCHAR" property="cardid"/>
<result column="cardNo" jdbcType="VARCHAR" property="cardno"/>
<result column="is_platform" jdbcType="TINYINT" property="isPlatform"/>
<result column="cardType" jdbcType="TINYINT" property="cardtype"/>
<result column="userIndex" jdbcType="INTEGER" property="userindex"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
<result column="corpNo" jdbcType="VARCHAR" property="corpno"/>
<result column="cashPledge" jdbcType="INTEGER" property="cashpledge"/>
<result column="balance" jdbcType="INTEGER" property="balance"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createtime"/>
</resultMap>
<sql id="Base_Column_List">
id
, cardID, cardNo, is_platform, cardType, userIndex, `password`, corpNo, cashPledge,
balance, `status`, createTime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_iccard_info
where id = #{id,jdbcType=INTEGER}
</select>
2022-01-27 15:03:46 +08:00
<select id="selectAll" resultMap="BaseResultMap">
2022-01-27 09:52:02 +08:00
select
<include refid="Base_Column_List"/>
from t_iccard_info
</select>
<select id="selectAllBy" resultType="Map">
SELECT
t_card.id,
t_card.cardID,
t_card.cardNo,
t_card.cardType,
t_card.is_platform,
t_card.userIndex,
t_card.corpNo,
t_card.`status`,
t_card.cashPledge,
op.`name`,
xhpc_card.ic_card_info_id,
xhpc_card.t_iccard_info_id,
xhpc_card.use_status,
xhpc_card.user_account,
xhpc_card.user_type
FROM
t_iccard_info t_card
LEFT JOIN xhpc_operator op ON t_card.corpNo = op.operator_id
LEFT JOIN xhpc_ic_card_info xhpc_card ON t_card.id = xhpc_card.t_iccard_info_id
AND xhpc_card.del_flag = 0
2022-01-27 15:03:46 +08:00
<where>
<!-- 只查询指定租户id下的被初始化了的卡 -->
t_card.tenant_id = #{tenantId}
<!-- 登录运营商的id只查询该运营商下面的被初始化了的卡 -->
<if test="loginUserId!=null">
and t_card.corpNo = #{loginUserId}
</if>
<!-- 授权运营商id -->
<if test="grantOperatorIds!=null and grantOperatorIds!=''">
and t_card.corpNo in
<foreach collection="grantOperatorIds" open="(" close=")" item="operatorId" separator=",">
#{operatorId}
</foreach>
2022-01-27 15:03:46 +08:00
</if>
<!-- 卡类型,只查询指定卡类型的卡 -->
<if test="cardType!=null">
and t_card.cardType = #{cardType}
2022-01-27 15:03:46 +08:00
</if>
<!-- 卡状态 -->
<if test="cardStatus!=null">
and t_card.status = #{cardStatus}
2022-01-27 15:03:46 +08:00
</if>
<!-- 卡分类 -->
<if test="classification!=null">
and t_card.is_platform = #{classification}
2022-01-27 15:03:46 +08:00
</if>
<!--模糊查询卡序列号或卡编号-->
<if test="cardNumber!=null and cardNumber!=''">
AND (t_card.cardID LIKE concat('%',#{cardNumber},'%')
OR t_card.cardNo LIKE concat('%',#{cardNumber},'%'))
</if>
<!--用户类型查询-->
<if test="userType!=null">
<if test="userType==10">
and t_card.cardType = 0
</if>
<if test="userType!=10">
and xhpc_card.user_type = #{userType}
</if>
2022-01-27 15:03:46 +08:00
</if>
</where>
order by t_card.id desc
2022-01-27 15:03:46 +08:00
limit #{currentPage},#{items}
</select>
<select id="selectTotalCountBy" resultType="java.lang.Long">
SELECT
count(t_card.id)
FROM
t_iccard_info t_card
LEFT JOIN xhpc_operator op ON t_card.corpNo = op.operator_id
LEFT JOIN xhpc_ic_card_info xhpc_card ON t_card.id = xhpc_card.t_iccard_info_id
AND xhpc_card.del_flag = 0
<where>
<!-- 只查询指定租户id下的被初始化了的卡 -->
t_card.tenant_id = #{tenantId}
<!-- 登录运营商的id只查询该运营商下面的被初始化了的卡 -->
<if test="loginUserId!=null">
and t_card.corpNo = #{loginUserId}
</if>
<!-- 授权运营商id -->
<if test="grantOperatorIds!=null and grantOperatorIds!=''">
and t_card.corpNo in
<foreach collection="grantOperatorIds" open="(" close=")" item="operatorId" separator=",">
#{operatorId}
</foreach>
</if>
<!-- 卡类型,只查询指定卡类型的卡 -->
<if test="cardType!=null">
and t_card.cardType = #{cardType}
</if>
<!-- 卡状态 -->
<if test="cardStatus!=null">
and t_card.status = #{cardStatus}
</if>
<!-- 卡分类 -->
<if test="classification!=null">
and t_card.is_platform = #{classification}
</if>
<!--模糊查询卡序列号或卡编号-->
<if test="cardNumber!=null and cardNumber!=''">
AND (t_card.cardID LIKE concat('%',#{cardNumber},'%')
OR t_card.cardNo LIKE concat('%',#{cardNumber},'%'))
</if>
<!--用户类型查询-->
<if test="userType!=null">
<if test="userType==10">
and t_card.cardType = 0
</if>
<if test="userType!=10">
and xhpc_card.user_type = #{userType}
</if>
</if>
</where>
</select>
2022-02-12 15:09:20 +08:00
<select id="selectByPhone" resultType="java.util.Map">
SELECT users.userAge,
users.userName,
users.userSex,
users.idNumber,
users.phone,
users.licencePlate,
info.cardID,
info.cardNo,
operator.`name`,
info.is_platform,
info.cardType,
info.cashPledge,
info.balance
FROM t_iccard_users users
LEFT JOIN t_iccard_info info ON users.id = info.userIndex
LEFT JOIN xhpc_operator operator ON info.corpNo = operator.operator_id
WHERE users.phone = #{userAccount}
</select>
2022-01-27 09:52:02 +08:00
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from t_iccard_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardInfo"
useGeneratedKeys="true">
insert into t_iccard_info (cardID, cardNo, is_platform,
cardType, userIndex, `password`,
corpNo, cashPledge, balance,
`status`, createTime)
values (#{cardid,jdbcType=VARCHAR}, #{cardno,jdbcType=VARCHAR}, #{isPlatform,jdbcType=TINYINT},
#{cardtype,jdbcType=TINYINT}, #{userindex,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR},
#{corpno,jdbcType=VARCHAR}, #{cashpledge,jdbcType=INTEGER}, #{balance,jdbcType=INTEGER},
#{status,jdbcType=TINYINT}, #{createtime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardInfo"
useGeneratedKeys="true">
insert into t_iccard_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cardid != null">
cardID,
</if>
<if test="cardno != null">
cardNo,
</if>
<if test="isPlatform != null">
is_platform,
</if>
<if test="cardtype != null">
cardType,
</if>
<if test="userindex != null">
userIndex,
</if>
<if test="password != null">
`password`,
</if>
<if test="corpno != null">
corpNo,
</if>
<if test="cashpledge != null">
cashPledge,
</if>
<if test="balance != null">
balance,
</if>
<if test="status != null">
`status`,
</if>
<if test="createtime != null">
createTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cardid != null">
#{cardid,jdbcType=VARCHAR},
</if>
<if test="cardno != null">
#{cardno,jdbcType=VARCHAR},
</if>
<if test="isPlatform != null">
#{isPlatform,jdbcType=TINYINT},
</if>
<if test="cardtype != null">
#{cardtype,jdbcType=TINYINT},
</if>
<if test="userindex != null">
#{userindex,jdbcType=INTEGER},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="corpno != null">
#{corpno,jdbcType=VARCHAR},
</if>
<if test="cashpledge != null">
#{cashpledge,jdbcType=INTEGER},
</if>
<if test="balance != null">
#{balance,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.TIccardInfo">
update t_iccard_info
<set>
<if test="cardid != null">
cardID = #{cardid,jdbcType=VARCHAR},
</if>
<if test="cardno != null">
cardNo = #{cardno,jdbcType=VARCHAR},
</if>
<if test="isPlatform != null">
is_platform = #{isPlatform,jdbcType=TINYINT},
</if>
<if test="cardtype != null">
cardType = #{cardtype,jdbcType=TINYINT},
</if>
<if test="userindex != null">
userIndex = #{userindex,jdbcType=INTEGER},
</if>
<if test="password != null">
`password` = #{password,jdbcType=VARCHAR},
</if>
<if test="corpno != null">
corpNo = #{corpno,jdbcType=VARCHAR},
</if>
<if test="cashpledge != null">
cashPledge = #{cashpledge,jdbcType=INTEGER},
</if>
<if test="balance != null">
balance = #{balance,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.card.pojo.TIccardInfo">
update t_iccard_info
set cardID = #{cardid,jdbcType=VARCHAR},
cardNo = #{cardno,jdbcType=VARCHAR},
is_platform = #{isPlatform,jdbcType=TINYINT},
cardType = #{cardtype,jdbcType=TINYINT},
userIndex = #{userindex,jdbcType=INTEGER},
`password` = #{password,jdbcType=VARCHAR},
corpNo = #{corpno,jdbcType=VARCHAR},
cashPledge = #{cashpledge,jdbcType=INTEGER},
balance = #{balance,jdbcType=INTEGER},
`status` = #{status,jdbcType=TINYINT},
createTime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>