From 5a97f23995f2467953678e938a89a97e09886665 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 20 Sep 2024 18:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/screen/domain/ScreenDeskConfig.java | 69 +++++ .../screen/mapper/ScreenDeskConfigMapper.java | 74 +++++ .../service/ScreenDeskConfigService.java | 38 +++ .../impl/ScreenDeskConfigServiceImpl.java | 90 ++++++ .../mapper/screen/ScreenDeskConfigMapper.xml | 263 ++++++++++++++++++ 5 files changed, 534 insertions(+) create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/screen/domain/ScreenDeskConfig.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/screen/mapper/ScreenDeskConfigMapper.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/ScreenDeskConfigService.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/impl/ScreenDeskConfigServiceImpl.java create mode 100644 bonus-modules/bonus-base/src/main/resources/mapper/screen/ScreenDeskConfigMapper.xml diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/screen/domain/ScreenDeskConfig.java b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/domain/ScreenDeskConfig.java new file mode 100644 index 0000000..a97a39f --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/domain/ScreenDeskConfig.java @@ -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; +} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/screen/mapper/ScreenDeskConfigMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/mapper/ScreenDeskConfigMapper.java new file mode 100644 index 0000000..5f156c6 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/mapper/ScreenDeskConfigMapper.java @@ -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 list); + + int deleteAll(); + + + /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(ScreenDeskConfig record); + + int insertList(@Param("list") List 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 getAll(); + + + int updateBatch(List list); +} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/ScreenDeskConfigService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/ScreenDeskConfigService.java new file mode 100644 index 0000000..ba65ffb --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/ScreenDeskConfigService.java @@ -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 list); + + int insert(ScreenDeskConfig record); + + int insertSelective(ScreenDeskConfig record); + + ScreenDeskConfig selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ScreenDeskConfig record); + + int updateByPrimaryKey(ScreenDeskConfig record); + + int updateBatch(List list); + + List getAll(); + + + int deleteAll(); + + int insertList(List list); + + +} diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/impl/ScreenDeskConfigServiceImpl.java b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/impl/ScreenDeskConfigServiceImpl.java new file mode 100644 index 0000000..5897db7 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/screen/service/impl/ScreenDeskConfigServiceImpl.java @@ -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 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 list) { + return screenDeskConfigMapper.updateBatch(list); + } + + @Override + public List getAll(){ + List list = screenDeskConfigMapper.getAll(); + return list; + } + + @Override + public int deleteAll(){ + return screenDeskConfigMapper.deleteAll(); + } + + /** + * 批量插入,异常则回滚 + * @param list 集合 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertList(List list) { + screenDeskConfigMapper.deleteAll(); + return screenDeskConfigMapper.insertList(list); + } + + + +} diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/screen/ScreenDeskConfigMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/screen/ScreenDeskConfigMapper.xml new file mode 100644 index 0000000..bf1fb5c --- /dev/null +++ b/bonus-modules/bonus-base/src/main/resources/mapper/screen/ScreenDeskConfigMapper.xml @@ -0,0 +1,263 @@ + + + + + + + + + + + + + + + + + + + + id, component_name, x, y, h, w, i, is_accord, is_success, moved + + + + + delete from screen_desk_config + where id = #{id,jdbcType=INTEGER} + + + + 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 into screen_desk_config + + + id, + + + component_name, + + + x, + + + y, + + + h, + + + w, + + + i, + + + is_accord, + + + is_success, + + + moved, + + + + + #{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}, + + + + + + update screen_desk_config + + + 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 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 screen_desk_config + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.componentName,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.x,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.y,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.h,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.w,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.i,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.isAccord,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.isSuccess,jdbcType=TINYINT} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.moved,jdbcType=TINYINT} + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + delete from screen_desk_config where id in + + #{id,jdbcType=INTEGER} + + + + + + + + + update screen_desk_config set moved = 1 + + + + + INSERT INTO screen_desk_config(component_name, + x, + y, + h, + w, + i, + is_accord, + is_success, + moved + )VALUES + + ( + #{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} + ) + + + \ No newline at end of file