添加“broker”相关CRUD代码
This commit is contained in:
parent
33b7cd630c
commit
49790027f5
20
src/main/java/com/ycwl/basic/mapper/pc/BrokerMapper.java
Normal file
20
src/main/java/com/ycwl/basic/mapper/pc/BrokerMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.broker.entity.BrokerEntity;
|
||||
import com.ycwl.basic.model.pc.broker.req.BrokerReqQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:15
|
||||
* 推客/推广人
|
||||
*/
|
||||
public interface BrokerMapper {
|
||||
List<BrokerEntity> list(BrokerReqQuery brokerReqQuery);
|
||||
BrokerEntity getById(Long id);
|
||||
int add(BrokerEntity broker);
|
||||
int deleteById(Long id);
|
||||
int update(BrokerEntity broker);
|
||||
int updateStatus();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.menu.MenuNode;
|
||||
import com.ycwl.basic.model.pc.menu.entity.MenuEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -10,6 +11,7 @@ import java.util.List;
|
||||
public interface MenuMapper {
|
||||
int delete(@Param("id")String id);
|
||||
int addRoleMenu(@Param("id")String id,@Param("list") List<Integer> list);
|
||||
int add(MenuEntity menuEntity);
|
||||
|
||||
List<MenuNode>getListByType(@Param("type")Integer type);
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.ycwl.basic.model.pc.broker.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:19
|
||||
* 推客,也就是推广人
|
||||
*/
|
||||
@Data
|
||||
@TableName("broker")
|
||||
public class BrokerEntity {
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 推客名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 专属优惠码,新建时生成
|
||||
*/
|
||||
private String promoCode;
|
||||
/**
|
||||
* 状态,0禁用,1启用
|
||||
*/
|
||||
private Integer status;
|
||||
private Date createAt;
|
||||
private Date updateAt;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ycwl.basic.model.pc.broker.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:29
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("查询推客列表请求参数")
|
||||
public class BrokerReqQuery {
|
||||
private Long id;
|
||||
@ApiModelProperty("推客名称")
|
||||
private String name;
|
||||
@ApiModelProperty("专属优惠码")
|
||||
private String promoCode;
|
||||
@ApiModelProperty("状态,0禁用,1启用")
|
||||
private Integer status;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.ycwl.basic.model.pc.broker.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:24
|
||||
*/
|
||||
@Data
|
||||
public class BrokerRespVO {
|
||||
@TableId
|
||||
private Long id;
|
||||
@ApiModelProperty("推客名称")
|
||||
private String name;
|
||||
@ApiModelProperty("专属优惠码")
|
||||
private String promoCode;
|
||||
@ApiModelProperty("状态,0禁用,1启用")
|
||||
private Integer status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createAt;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateAt;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.ycwl.basic.model.pc.menu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:06
|
||||
*/
|
||||
@Data
|
||||
@TableName("menu")
|
||||
public class MenuEntity {
|
||||
@TableId
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "父节点ID")
|
||||
private String parentId;
|
||||
@ApiModelProperty(value = "路由")
|
||||
private String target;
|
||||
|
||||
@ApiModelProperty(value = "菜单名")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "菜单类型 (0菜单 1按钮)")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "权限路径")
|
||||
private String permissionUrl;
|
||||
@ApiModelProperty(value = "是否删除 (0正常 1删除)")
|
||||
private String isRemove;
|
||||
@ApiModelProperty(value = "业务类型 (0 系统菜单 1 业务菜单)")
|
||||
private Integer businessType;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
@ApiModelProperty("图标")
|
||||
private String icon;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.ycwl.basic.model.pc.menu.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:16
|
||||
*/
|
||||
@Data
|
||||
public class MenuRespVO {
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "父节点ID")
|
||||
private String parentId;
|
||||
@ApiModelProperty(value = "路由")
|
||||
private String target;
|
||||
|
||||
@ApiModelProperty(value = "菜单名")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "菜单类型 (0菜单 1按钮)")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "权限路径")
|
||||
private String permissionUrl;
|
||||
@ApiModelProperty(value = "是否删除 (0正常 1删除)")
|
||||
private String isRemove;
|
||||
@ApiModelProperty(value = "业务类型 (0 系统菜单 1 业务菜单)")
|
||||
private Integer businessType;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
@ApiModelProperty("图标")
|
||||
private String icon;
|
||||
}
|
45
src/main/resources/mapper/pc/BrokerMapper.xml
Normal file
45
src/main/resources/mapper/pc/BrokerMapper.xml
Normal 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>
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user