大屏接口

This commit is contained in:
syruan 2024-09-20 18:46:47 +08:00
parent f7d597edce
commit 5a97f23995
5 changed files with 534 additions and 0 deletions

View File

@ -0,0 +1,69 @@
package com.bonus.screen.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
/**
*@PackagePath: com.bonus.base.domain
*@author : 阮世耀
*@CreateTime: 2024-09-20 16:36
*@Description: 描述
*@version : 1.0
*/
@ApiModel(description="screen_desk_config")
@Data
public class ScreenDeskConfig implements Serializable {
@ApiModelProperty(value="")
private Integer id;
/**
* 模块名称
*/
@ApiModelProperty(value="模块名称")
@Size(max = 30,message = "模块名称最大长度要小于 30")
private String componentName;
@ApiModelProperty(value="")
private Integer x;
@ApiModelProperty(value="")
private Integer y;
@ApiModelProperty(value="")
private Integer h;
@ApiModelProperty(value="")
private Integer w;
/**
* 下标
*/
@ApiModelProperty(value="下标")
private Integer i;
/**
* 计算方式
*/
@ApiModelProperty(value="计算方式")
@Size(max = 30,message = "计算方式最大长度要小于 30")
private String isAccord;
/**
* 0 false 1 true
*/
@ApiModelProperty(value="0 false 1 true")
private Boolean isSuccess;
/**
* 0 false 1 true
*/
@ApiModelProperty(value="0 false 1 true")
private Boolean moved;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,74 @@
package com.bonus.screen.mapper;
import org.apache.ibatis.annotations.Param;
import com.bonus.screen.domain.ScreenDeskConfig;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
*@PackagePath: com.bonus.base.mapper
*@author : 阮世耀
*@CreateTime: 2024-09-20 16:36
*@Description: 描述
*@version : 1.0
*/
@Mapper
public interface ScreenDeskConfigMapper {
/**
* delete by primary key
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKeyIn(List<Integer> list);
int deleteAll();
/**
* insert record to table
* @param record the record
* @return insert count
*/
int insert(ScreenDeskConfig record);
int insertList(@Param("list") List<ScreenDeskConfig> list);
/**
* insert record to table selective
* @param record the record
* @return insert count
*/
int insertSelective(ScreenDeskConfig record);
/**
* select by primary key
* @param id primary key
* @return object by primary key
*/
ScreenDeskConfig selectByPrimaryKey(Integer id);
/**
* update record selective
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(ScreenDeskConfig record);
/**
* update record
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(ScreenDeskConfig record);
List<ScreenDeskConfig> getAll();
int updateBatch(List<ScreenDeskConfig> list);
}

View File

@ -0,0 +1,38 @@
package com.bonus.screen.service;
import java.util.List;
import com.bonus.screen.domain.ScreenDeskConfig;
/**
*@PackagePath: com.bonus.base.service
*@author : 阮世耀
*@CreateTime: 2024-09-20 16:36
*@Description: 描述
*@version : 1.0
*/
public interface ScreenDeskConfigService{
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKeyIn(List<Integer> list);
int insert(ScreenDeskConfig record);
int insertSelective(ScreenDeskConfig record);
ScreenDeskConfig selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ScreenDeskConfig record);
int updateByPrimaryKey(ScreenDeskConfig record);
int updateBatch(List<ScreenDeskConfig> list);
List<ScreenDeskConfig> getAll();
int deleteAll();
int insertList(List<ScreenDeskConfig> list);
}

View File

@ -0,0 +1,90 @@
package com.bonus.screen.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.bonus.screen.mapper.ScreenDeskConfigMapper;
import com.bonus.screen.domain.ScreenDeskConfig;
import com.bonus.screen.service.ScreenDeskConfigService;
import org.springframework.transaction.annotation.Transactional;
/**
*@PackagePath: com.bonus.base.service.impl
*@author : 阮世耀
*@CreateTime: 2024-09-20 16:36
*@Description: 描述
*@version : 1.0
*/
@Service
public class ScreenDeskConfigServiceImpl implements ScreenDeskConfigService{
@Autowired
private ScreenDeskConfigMapper screenDeskConfigMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return screenDeskConfigMapper.deleteByPrimaryKey(id);
}
@Override
public int deleteByPrimaryKeyIn(List<Integer> list) {
return screenDeskConfigMapper.deleteByPrimaryKeyIn(list);
}
@Override
public int insert(ScreenDeskConfig record) {
return screenDeskConfigMapper.insert(record);
}
@Override
public int insertSelective(ScreenDeskConfig record) {
return screenDeskConfigMapper.insertSelective(record);
}
@Override
public ScreenDeskConfig selectByPrimaryKey(Integer id) {
return screenDeskConfigMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ScreenDeskConfig record) {
return screenDeskConfigMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ScreenDeskConfig record) {
return screenDeskConfigMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<ScreenDeskConfig> list) {
return screenDeskConfigMapper.updateBatch(list);
}
@Override
public List<ScreenDeskConfig> getAll(){
List<ScreenDeskConfig> list = screenDeskConfigMapper.getAll();
return list;
}
@Override
public int deleteAll(){
return screenDeskConfigMapper.deleteAll();
}
/**
* 批量插入异常则回滚
* @param list 集合
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertList(List<ScreenDeskConfig> list) {
screenDeskConfigMapper.deleteAll();
return screenDeskConfigMapper.insertList(list);
}
}

View File

@ -0,0 +1,263 @@
<?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.bonus.screen.mapper.ScreenDeskConfigMapper">
<resultMap id="BaseResultMap" type="com.bonus.screen.domain.ScreenDeskConfig">
<!--@mbg.generated-->
<!--@Table screen_desk_config-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="component_name" jdbcType="VARCHAR" property="componentName" />
<result column="x" jdbcType="INTEGER" property="x" />
<result column="y" jdbcType="INTEGER" property="y" />
<result column="h" jdbcType="INTEGER" property="h" />
<result column="w" jdbcType="INTEGER" property="w" />
<result column="i" jdbcType="INTEGER" property="i" />
<result column="is_accord" jdbcType="VARCHAR" property="isAccord" />
<result column="is_success" jdbcType="TINYINT" property="isSuccess" />
<result column="moved" jdbcType="TINYINT" property="moved" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, component_name, x, y, h, w, i, is_accord, is_success, moved
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from screen_desk_config
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from screen_desk_config
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.bonus.screen.domain.ScreenDeskConfig">
<!--@mbg.generated-->
insert into screen_desk_config (id, component_name, x,
y, h, w, i,
is_accord, is_success, moved
)
values (#{id,jdbcType=INTEGER}, #{componentName,jdbcType=VARCHAR}, #{x,jdbcType=INTEGER},
#{y,jdbcType=INTEGER}, #{h,jdbcType=INTEGER}, #{w,jdbcType=INTEGER}, #{i,jdbcType=INTEGER},
#{isAccord,jdbcType=VARCHAR}, #{isSuccess,jdbcType=TINYINT}, #{moved,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.bonus.screen.domain.ScreenDeskConfig">
<!--@mbg.generated-->
insert into screen_desk_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="componentName != null and componentName != ''">
component_name,
</if>
<if test="x != null">
x,
</if>
<if test="y != null">
y,
</if>
<if test="h != null">
h,
</if>
<if test="w != null">
w,
</if>
<if test="i != null">
i,
</if>
<if test="isAccord != null and isAccord != ''">
is_accord,
</if>
<if test="isSuccess != null">
is_success,
</if>
<if test="moved != null">
moved,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="componentName != null and componentName != ''">
#{componentName,jdbcType=VARCHAR},
</if>
<if test="x != null">
#{x,jdbcType=INTEGER},
</if>
<if test="y != null">
#{y,jdbcType=INTEGER},
</if>
<if test="h != null">
#{h,jdbcType=INTEGER},
</if>
<if test="w != null">
#{w,jdbcType=INTEGER},
</if>
<if test="i != null">
#{i,jdbcType=INTEGER},
</if>
<if test="isAccord != null and isAccord != ''">
#{isAccord,jdbcType=VARCHAR},
</if>
<if test="isSuccess != null">
#{isSuccess,jdbcType=TINYINT},
</if>
<if test="moved != null">
#{moved,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.screen.domain.ScreenDeskConfig">
<!--@mbg.generated-->
update screen_desk_config
<set>
<if test="componentName != null and componentName != ''">
component_name = #{componentName,jdbcType=VARCHAR},
</if>
<if test="x != null">
x = #{x,jdbcType=INTEGER},
</if>
<if test="y != null">
y = #{y,jdbcType=INTEGER},
</if>
<if test="h != null">
h = #{h,jdbcType=INTEGER},
</if>
<if test="w != null">
w = #{w,jdbcType=INTEGER},
</if>
<if test="i != null">
i = #{i,jdbcType=INTEGER},
</if>
<if test="isAccord != null and isAccord != ''">
is_accord = #{isAccord,jdbcType=VARCHAR},
</if>
<if test="isSuccess != null">
is_success = #{isSuccess,jdbcType=TINYINT},
</if>
<if test="moved != null">
moved = #{moved,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bonus.screen.domain.ScreenDeskConfig">
<!--@mbg.generated-->
update screen_desk_config
set component_name = #{componentName,jdbcType=VARCHAR},
x = #{x,jdbcType=INTEGER},
y = #{y,jdbcType=INTEGER},
h = #{h,jdbcType=INTEGER},
w = #{w,jdbcType=INTEGER},
i = #{i,jdbcType=INTEGER},
is_accord = #{isAccord,jdbcType=VARCHAR},
is_success = #{isSuccess,jdbcType=TINYINT},
moved = #{moved,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update screen_desk_config
<trim prefix="set" suffixOverrides=",">
<trim prefix="component_name = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.componentName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="x = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.x,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="y = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.y,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="h = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.h,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="w = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.w,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="i = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.i,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="is_accord = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.isAccord,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="is_success = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.isSuccess,jdbcType=TINYINT}
</foreach>
</trim>
<trim prefix="moved = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.moved,jdbcType=TINYINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<delete id="deleteByPrimaryKeyIn">
<!--@mbg.generated-->
delete from screen_desk_config where id in
<foreach close=")" collection="list" item="id" open="(" separator=", ">
#{id,jdbcType=INTEGER}
</foreach>
</delete>
<!--by syruan on 2024-09-20-->
<select id="getAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from screen_desk_config
where moved = 0
</select>
<!--by syruan on 2024-09-20-->
<delete id="deleteAll">
update screen_desk_config set moved = 1
</delete>
<!--by syruan on 2024-09-20-->
<insert id="insertList">
INSERT INTO screen_desk_config(component_name,
x,
y,
h,
w,
i,
is_accord,
is_success,
moved
)VALUES
<foreach collection="list" item="element" index="index" separator=",">
(
#{element.componentName,jdbcType=VARCHAR},
#{element.x,jdbcType=INTEGER},
#{element.y,jdbcType=INTEGER},
#{element.h,jdbcType=INTEGER},
#{element.w,jdbcType=INTEGER},
#{element.i,jdbcType=INTEGER},
#{element.isAccord,jdbcType=VARCHAR},
#{element.isSuccess,jdbcType=TINYINT},
#{element.moved,jdbcType=TINYINT}
)
</foreach>
</insert>
</mapper>