添加“broker”相关CRUD代码

This commit is contained in:
longbinbin
2024-11-29 14:47:46 +08:00
parent 33b7cd630c
commit 49790027f5
9 changed files with 240 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<?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.ycwl.basic.mapper.pc.BrokerMapper">
<insert id="add">
insert into broker(id, `name`, promo_code) values (#{id}, #{name}, #{promoCode})
</insert>
<update id="update">
update broker set `name` = #{name}, promo_code = #{promoCode} where id = #{id}
</update>
<update id="updateStatus">
update broker
set status = (CASE
status
WHEN 1 THEN
0
WHEN 0 THEN
1
ELSE null
END)
where id = #{id}
</update>
<delete id="deleteById">
delete from broker where id = #{id}
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.broker.entity.BrokerEntity">
select id, `name`, promo_code, status, create_at, update_at
from broker
<where>
<if test="name!= null and name!= ''">
and `name` like concat('%', #{name}, '%')
</if>
<if test="promoCode!= null and promoCode!= ''">
and promo_code like concat('%', #{promoCode}, '%')
</if>
<if test="status!= null">
and `status` = #{status}
</if>
</where>
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.broker.entity.BrokerEntity">
select id, `name`, promo_code, status, create_at, update_at
from broker
where id = #{id}
</select>
</mapper>

View File

@ -8,6 +8,11 @@
(#{id},#{item})
</foreach>
</insert>
<insert id="add">
insert into menu(id, parent_id, target, `name`, type, sort, permission_url, is_remove, business_type, icon)
values
(#{id}, #{parentId}, #{target}, #{name}, #{type}, #{sort}, #{permissionUrl}, #{isRemove}, #{businessType}, #{icon})
</insert>
<delete id="delete">
delete