| @@ -0,0 +1,90 @@ | |||||
| package com.ruoyi.platform.controller.icon; | |||||
| import com.ruoyi.common.core.web.domain.AjaxResult; | |||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import com.ruoyi.platform.domain.Models; | |||||
| import com.ruoyi.platform.service.AssetIconService; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.annotation.Resource; | |||||
| /** | |||||
| * (AssetIcon)表控制层 | |||||
| * | |||||
| * @author Xidaray | |||||
| * @since 2024-03-07 16:02:03 | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("assetIcon") | |||||
| public class AssetIconController { | |||||
| /** | |||||
| * 服务对象 | |||||
| */ | |||||
| @Resource | |||||
| private AssetIconService assetIconService; | |||||
| /** | |||||
| * 分页查询 | |||||
| * | |||||
| * @param assetIcon 筛选条件 | |||||
| * @param page 分页对象 | |||||
| * @param size 分页对象 | |||||
| * @return 查询结果 | |||||
| */ | |||||
| @GetMapping | |||||
| @ApiOperation("分页查询") | |||||
| public AjaxResult queryByPage(AssetIcon assetIcon, int page, int size) { | |||||
| PageRequest pageRequest = PageRequest.of(page,size); | |||||
| return AjaxResult.success(this.assetIconService.queryByPage(assetIcon, pageRequest)); | |||||
| } | |||||
| /** | |||||
| * 通过主键查询单条数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 单条数据 | |||||
| */ | |||||
| @GetMapping("{id}") | |||||
| public AjaxResult queryById(@PathVariable("id") Integer id) { | |||||
| return AjaxResult.success(this.assetIconService.queryById(id)); | |||||
| } | |||||
| /** | |||||
| * 新增数据 | |||||
| * | |||||
| * @param assetIcon 实体 | |||||
| * @return 新增结果 | |||||
| */ | |||||
| @PostMapping | |||||
| public AjaxResult add(@RequestBody AssetIcon assetIcon) { | |||||
| return AjaxResult.success(this.assetIconService.insert(assetIcon)); | |||||
| } | |||||
| /** | |||||
| * 编辑数据 | |||||
| * | |||||
| * @param assetIcon 实体 | |||||
| * @return 编辑结果 | |||||
| */ | |||||
| @PutMapping | |||||
| public AjaxResult edit(@RequestBody AssetIcon assetIcon) { | |||||
| return AjaxResult.success(this.assetIconService.update(assetIcon)); | |||||
| } | |||||
| /** | |||||
| * 删除数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 删除是否成功 | |||||
| */ | |||||
| @DeleteMapping("{id}") | |||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) { | |||||
| return AjaxResult.success(this.assetIconService.removeById(id)); | |||||
| } | |||||
| } | |||||
| @@ -60,7 +60,7 @@ public class ImageVersionController { | |||||
| * @return 新增结果 | * @return 新增结果 | ||||
| */ | */ | ||||
| @PostMapping | @PostMapping | ||||
| public AjaxResult add(ImageVersion imageVersion) { | |||||
| public AjaxResult add(@RequestBody ImageVersion imageVersion) { | |||||
| return AjaxResult.success(this.imageVersionService.insert(imageVersion)); | return AjaxResult.success(this.imageVersionService.insert(imageVersion)); | ||||
| } | } | ||||
| @@ -71,7 +71,7 @@ public class ImageVersionController { | |||||
| * @return 编辑结果 | * @return 编辑结果 | ||||
| */ | */ | ||||
| @PutMapping | @PutMapping | ||||
| public AjaxResult edit(ImageVersion imageVersion) { | |||||
| public AjaxResult edit(@RequestBody ImageVersion imageVersion) { | |||||
| return AjaxResult.success(this.imageVersionService.update(imageVersion)); | return AjaxResult.success(this.imageVersionService.update(imageVersion)); | ||||
| } | } | ||||
| @@ -81,8 +81,8 @@ public class ImageVersionController { | |||||
| * @param id 主键 | * @param id 主键 | ||||
| * @return 删除是否成功 | * @return 删除是否成功 | ||||
| */ | */ | ||||
| @DeleteMapping | |||||
| public AjaxResult deleteById(Integer id) { | |||||
| @DeleteMapping("{id}") | |||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) { | |||||
| return AjaxResult.success(this.imageVersionService.removeById(id)); | return AjaxResult.success(this.imageVersionService.removeById(id)); | ||||
| } | } | ||||
| @@ -0,0 +1,139 @@ | |||||
| package com.ruoyi.platform.domain; | |||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import java.util.Date; | |||||
| import java.io.Serializable; | |||||
| /** | |||||
| * (AssetIcon)实体类 | |||||
| * | |||||
| * @author Xidaray | |||||
| * @since 2024-03-07 16:02:04 | |||||
| */ | |||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||||
| public class AssetIcon implements Serializable { | |||||
| private static final long serialVersionUID = 321623288300411326L; | |||||
| /** | |||||
| * 主键 | |||||
| */ | |||||
| private Integer id; | |||||
| /** | |||||
| * 资产图标名称 | |||||
| */ | |||||
| private String name; | |||||
| /** | |||||
| * 分类id | |||||
| */ | |||||
| private Integer categoryId; | |||||
| /** | |||||
| * 路径 | |||||
| */ | |||||
| private String path; | |||||
| /** | |||||
| * 描述 | |||||
| */ | |||||
| private String description; | |||||
| /** | |||||
| * 创建者 | |||||
| */ | |||||
| private String createBy; | |||||
| private Date createTime; | |||||
| /** | |||||
| * 更新者 | |||||
| */ | |||||
| private String updateBy; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| private Date updateTime; | |||||
| /** | |||||
| * 0失效,1生效 | |||||
| */ | |||||
| private Integer state; | |||||
| public Integer getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Integer id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public Integer getCategoryId() { | |||||
| return categoryId; | |||||
| } | |||||
| public void setCategoryId(Integer categoryId) { | |||||
| this.categoryId = categoryId; | |||||
| } | |||||
| public String getPath() { | |||||
| return path; | |||||
| } | |||||
| public void setPath(String path) { | |||||
| this.path = path; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getCreateBy() { | |||||
| return createBy; | |||||
| } | |||||
| public void setCreateBy(String createBy) { | |||||
| this.createBy = createBy; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date createTime) { | |||||
| this.createTime = createTime; | |||||
| } | |||||
| public String getUpdateBy() { | |||||
| return updateBy; | |||||
| } | |||||
| public void setUpdateBy(String updateBy) { | |||||
| this.updateBy = updateBy; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date updateTime) { | |||||
| this.updateTime = updateTime; | |||||
| } | |||||
| public Integer getState() { | |||||
| return state; | |||||
| } | |||||
| public void setState(Integer state) { | |||||
| this.state = state; | |||||
| } | |||||
| } | |||||
| @@ -1,5 +1,7 @@ | |||||
| package com.ruoyi.platform.domain; | package com.ruoyi.platform.domain; | ||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -11,6 +13,7 @@ import java.io.Serializable; | |||||
| * @author Xidaray | * @author Xidaray | ||||
| * @since 2024-03-05 14:45:48 | * @since 2024-03-05 14:45:48 | ||||
| */ | */ | ||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||||
| public class Image implements Serializable { | public class Image implements Serializable { | ||||
| private static final long serialVersionUID = 179166185018853959L; | private static final long serialVersionUID = 179166185018853959L; | ||||
| /** | /** | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.ruoyi.platform.domain; | package com.ruoyi.platform.domain; | ||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -11,6 +13,7 @@ import java.io.Serializable; | |||||
| * @author Xidaray | * @author Xidaray | ||||
| * @since 2024-03-05 15:00:02 | * @since 2024-03-05 15:00:02 | ||||
| */ | */ | ||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||||
| public class ImageVersion implements Serializable { | public class ImageVersion implements Serializable { | ||||
| private static final long serialVersionUID = 251017725389874890L; | private static final long serialVersionUID = 251017725389874890L; | ||||
| /** | /** | ||||
| @@ -0,0 +1,83 @@ | |||||
| package com.ruoyi.platform.mapper; | |||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import java.util.List; | |||||
| /** | |||||
| * (AssetIcon)表数据库访问层 | |||||
| * | |||||
| * @author Xidaray | |||||
| * @since 2024-03-07 16:02:03 | |||||
| */ | |||||
| public interface AssetIconDao { | |||||
| /** | |||||
| * 通过ID查询单条数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| AssetIcon queryById(Integer id); | |||||
| /** | |||||
| * 查询指定行数据 | |||||
| * | |||||
| * @param assetIcon 查询条件 | |||||
| * @param pageable 分页对象 | |||||
| * @return 对象列表 | |||||
| */ | |||||
| List<AssetIcon> queryAllByLimit(@Param("assetIcon") AssetIcon assetIcon, @Param("pageable") Pageable pageable); | |||||
| /** | |||||
| * 统计总行数 | |||||
| * | |||||
| * @param assetIcon 查询条件 | |||||
| * @return 总行数 | |||||
| */ | |||||
| long count(@Param("assetIcon") AssetIcon assetIcon); | |||||
| /** | |||||
| * 新增数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 影响行数 | |||||
| */ | |||||
| int insert(@Param("assetIcon") AssetIcon assetIcon); | |||||
| /** | |||||
| * 批量新增数据(MyBatis原生foreach方法) | |||||
| * | |||||
| * @param entities List<AssetIcon> 实例对象列表 | |||||
| * @return 影响行数 | |||||
| */ | |||||
| int insertBatch(@Param("entities") List<AssetIcon> entities); | |||||
| /** | |||||
| * 批量新增或按主键更新数据(MyBatis原生foreach方法) | |||||
| * | |||||
| * @param entities List<AssetIcon> 实例对象列表 | |||||
| * @return 影响行数 | |||||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | |||||
| */ | |||||
| int insertOrUpdateBatch(@Param("entities") List<AssetIcon> entities); | |||||
| /** | |||||
| * 修改数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 影响行数 | |||||
| */ | |||||
| int update(@Param("assetIcon") AssetIcon assetIcon); | |||||
| /** | |||||
| * 通过主键删除数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 影响行数 | |||||
| */ | |||||
| int deleteById(Integer id); | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.ruoyi.platform.service; | |||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| /** | |||||
| * (AssetIcon)表服务接口 | |||||
| * | |||||
| * @author Xidaray | |||||
| * @since 2024-03-07 16:02:04 | |||||
| */ | |||||
| public interface AssetIconService { | |||||
| /** | |||||
| * 通过ID查询单条数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| AssetIcon queryById(Integer id); | |||||
| /** | |||||
| * 分页查询 | |||||
| * | |||||
| * @param assetIcon 筛选条件 | |||||
| * @param pageRequest 分页对象 | |||||
| * @return 查询结果 | |||||
| */ | |||||
| Page<AssetIcon> queryByPage(AssetIcon assetIcon, PageRequest pageRequest); | |||||
| /** | |||||
| * 新增数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| AssetIcon insert(AssetIcon assetIcon); | |||||
| /** | |||||
| * 修改数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| AssetIcon update(AssetIcon assetIcon); | |||||
| /** | |||||
| * 通过主键删除数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 是否成功 | |||||
| */ | |||||
| boolean deleteById(Integer id); | |||||
| String removeById(Integer id); | |||||
| } | |||||
| @@ -0,0 +1,117 @@ | |||||
| package com.ruoyi.platform.service.impl; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||||
| import com.ruoyi.platform.domain.AssetIcon; | |||||
| import com.ruoyi.platform.domain.Models; | |||||
| import com.ruoyi.platform.mapper.AssetIconDao; | |||||
| import com.ruoyi.platform.service.AssetIconService; | |||||
| import com.ruoyi.system.api.model.LoginUser; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageImpl; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| import javax.annotation.Resource; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * (AssetIcon)表服务实现类 | |||||
| * | |||||
| * @author Xidaray | |||||
| * @since 2024-03-07 16:02:04 | |||||
| */ | |||||
| @Service("assetIconService") | |||||
| public class AssetIconServiceImpl implements AssetIconService { | |||||
| @Resource | |||||
| private AssetIconDao assetIconDao; | |||||
| /** | |||||
| * 通过ID查询单条数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| @Override | |||||
| public AssetIcon queryById(Integer id) { | |||||
| return this.assetIconDao.queryById(id); | |||||
| } | |||||
| /** | |||||
| * 分页查询 | |||||
| * | |||||
| * @param assetIcon 筛选条件 | |||||
| * @param pageRequest 分页对象 | |||||
| * @return 查询结果 | |||||
| */ | |||||
| @Override | |||||
| public Page<AssetIcon> queryByPage(AssetIcon assetIcon, PageRequest pageRequest) { | |||||
| long total = this.assetIconDao.count(assetIcon); | |||||
| return new PageImpl<>(this.assetIconDao.queryAllByLimit(assetIcon, pageRequest), pageRequest, total); | |||||
| } | |||||
| /** | |||||
| * 新增数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| @Override | |||||
| public AssetIcon insert(AssetIcon assetIcon) { | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||||
| assetIcon.setCreateBy(loginUser.getUsername()); | |||||
| assetIcon.setUpdateBy(loginUser.getUsername()); | |||||
| assetIcon.setUpdateTime(new Date()); | |||||
| assetIcon.setCreateTime(new Date()); | |||||
| assetIcon.setState(1); | |||||
| this.assetIconDao.insert(assetIcon); | |||||
| return assetIcon; | |||||
| } | |||||
| /** | |||||
| * 修改数据 | |||||
| * | |||||
| * @param assetIcon 实例对象 | |||||
| * @return 实例对象 | |||||
| */ | |||||
| @Override | |||||
| public AssetIcon update(AssetIcon assetIcon) { | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||||
| assetIcon.setUpdateBy(loginUser.getUsername()); | |||||
| assetIcon.setUpdateTime(new Date()); | |||||
| this.assetIconDao.update(assetIcon); | |||||
| return this.queryById(assetIcon.getId()); | |||||
| } | |||||
| /** | |||||
| * 通过主键删除数据 | |||||
| * | |||||
| * @param id 主键 | |||||
| * @return 是否成功 | |||||
| */ | |||||
| @Override | |||||
| public boolean deleteById(Integer id) { | |||||
| return this.assetIconDao.deleteById(id) > 0; | |||||
| } | |||||
| @Override | |||||
| public String removeById(Integer id) { | |||||
| AssetIcon assetIcon = this.assetIconDao.queryById(id); | |||||
| if (assetIcon == null){ | |||||
| return "图标不存在"; | |||||
| } | |||||
| //判断权限,只有admin和创建者本身可以删除 | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||||
| String username = loginUser.getUsername(); | |||||
| String createdBy = assetIcon.getCreateBy(); | |||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | |||||
| return "无权限删除该图标"; | |||||
| } | |||||
| assetIcon.setState(0); | |||||
| return this.assetIconDao.update(assetIcon)>0?"删除成功":"删除失败"; | |||||
| } | |||||
| } | |||||
| @@ -160,7 +160,7 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| return "无权限删除该模型"; | return "无权限删除该模型"; | ||||
| } | } | ||||
| if (modelsVersionService.queryByModelsId(id).size()>0){ | if (modelsVersionService.queryByModelsId(id).size()>0){ | ||||
| return "请先删除该数据集的版本文件"; | |||||
| return "请先删除该模型的版本文件"; | |||||
| } | } | ||||
| models.setState(0); | models.setState(0); | ||||
| return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | ||||
| @@ -0,0 +1,171 @@ | |||||
| <?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.ruoyi.platform.mapper.AssetIconDao"> | |||||
| <resultMap type="com.ruoyi.platform.domain.AssetIcon" id="AssetIconMap"> | |||||
| <result property="id" column="id" jdbcType="INTEGER"/> | |||||
| <result property="name" column="name" jdbcType="VARCHAR"/> | |||||
| <result property="categoryId" column="category_id" jdbcType="INTEGER"/> | |||||
| <result property="path" column="path" jdbcType="VARCHAR"/> | |||||
| <result property="description" column="description" jdbcType="VARCHAR"/> | |||||
| <result property="createBy" column="create_by" jdbcType="VARCHAR"/> | |||||
| <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateBy" column="update_by" jdbcType="VARCHAR"/> | |||||
| <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="state" column="state" jdbcType="INTEGER"/> | |||||
| </resultMap> | |||||
| <!--查询单个--> | |||||
| <select id="queryById" resultMap="AssetIconMap"> | |||||
| select | |||||
| id,name, category_id, path, description, create_by, create_time, update_by, update_time, state | |||||
| from asset_icon | |||||
| where id = #{id} and state = 1 | |||||
| </select> | |||||
| <select id="queryAllByLimit" resultMap="AssetIconMap"> | |||||
| select | |||||
| id, name, category_id, path, description, create_by, create_time, update_by, update_time, state | |||||
| from asset_icon | |||||
| <where> | |||||
| state = 1 | |||||
| <if test="assetIcon.id != null"> | |||||
| and id = #{assetIcon.id} | |||||
| </if> | |||||
| <if test="assetIcon.name != null and assetIcon.name != ''"> | |||||
| and name = #{assetIcon.name} | |||||
| </if> | |||||
| <if test="assetIcon.categoryId != null"> | |||||
| and category_id = #{assetIcon.categoryId} | |||||
| </if> | |||||
| <if test="assetIcon.path != null and assetIcon.path != ''"> | |||||
| and path = #{assetIcon.path} | |||||
| </if> | |||||
| <if test="assetIcon.description != null and assetIcon.description != ''"> | |||||
| and description = #{assetIcon.description} | |||||
| </if> | |||||
| <if test="assetIcon.createBy != null and assetIcon.createBy != ''"> | |||||
| and create_by = #{assetIcon.createBy} | |||||
| </if> | |||||
| <if test="assetIcon.createTime != null"> | |||||
| and create_time = #{assetIcon.createTime} | |||||
| </if> | |||||
| <if test="assetIcon.updateBy != null and assetIcon.updateBy != ''"> | |||||
| and update_by = #{assetIcon.updateBy} | |||||
| </if> | |||||
| <if test="assetIcon.updateTime != null"> | |||||
| and update_time = #{assetIcon.updateTime} | |||||
| </if> | |||||
| <if test="assetIcon.state != null"> | |||||
| and state = #{assetIcon.state} | |||||
| </if> | |||||
| </where> | |||||
| limit #{pageable.offset}, #{pageable.pageSize} | |||||
| </select> | |||||
| <!--统计总行数--> | |||||
| <select id="count" resultType="java.lang.Long"> | |||||
| select count(1) | |||||
| from asset_icon | |||||
| <where> | |||||
| state = 1 | |||||
| <if test="assetIcon.id != null"> | |||||
| and id = #{assetIcon.id} | |||||
| </if> | |||||
| <if test="assetIcon.name != null and assetIcon.name != ''"> | |||||
| and name = #{assetIcon.name} | |||||
| </if> | |||||
| <if test="assetIcon.categoryId != null"> | |||||
| and category_id = #{assetIcon.categoryId} | |||||
| </if> | |||||
| <if test="assetIcon.path != null and assetIcon.path != ''"> | |||||
| and path = #{assetIcon.path} | |||||
| </if> | |||||
| <if test="assetIcon.description != null and assetIcon.description != ''"> | |||||
| and description = #{assetIcon.description} | |||||
| </if> | |||||
| <if test="assetIcon.createBy != null and assetIcon.createBy != ''"> | |||||
| and create_by = #{assetIcon.createBy} | |||||
| </if> | |||||
| <if test="assetIcon.createTime != null"> | |||||
| and create_time = #{assetIcon.createTime} | |||||
| </if> | |||||
| <if test="assetIcon.updateBy != null and assetIcon.updateBy != ''"> | |||||
| and update_by = #{assetIcon.updateBy} | |||||
| </if> | |||||
| <if test="assetIcon.updateTime != null"> | |||||
| and update_time = #{assetIcon.updateTime} | |||||
| </if> | |||||
| <if test="assetIcon.state != null"> | |||||
| and state = #{assetIcon.state} | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into asset_icon(name, category_id, path, description, create_by, create_time, update_by, update_time, state) | |||||
| values (#{assetIcon.name}, #{assetIcon.categoryId}, #{assetIcon.path}, #{assetIcon.description}, #{assetIcon.createBy}, #{assetIcon.createTime}, #{assetIcon.updateBy}, #{assetIcon.updateTime}, #{assetIcon.state}) | |||||
| </insert> | |||||
| <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into asset_icon(name,category_id,path,description,create_by,create_time,update_by,update_time,state) | |||||
| values | |||||
| <foreach collection="entities" item="entity" separator=","> | |||||
| (#{entity.name}#{entity.categoryId}#{entity.path}#{entity.description}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state}) | |||||
| </foreach> | |||||
| </insert> | |||||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into asset_icon(name,category_id,path,description,create_by,create_time,update_by,update_time,state) | |||||
| values | |||||
| <foreach collection="entities" item="entity" separator=","> | |||||
| (#{entity.name}#{entity.categoryId}#{entity.path}#{entity.description}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state}) | |||||
| </foreach> | |||||
| on duplicate key update | |||||
| name = values(name)category_id = values(category_id)path = values(path)description = values(description)create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state) | |||||
| </insert> | |||||
| <!--通过主键修改数据--> | |||||
| <update id="update"> | |||||
| update asset_icon | |||||
| <set> | |||||
| <if test="assetIcon.name != null and assetIcon.name != ''"> | |||||
| name = #{assetIcon.name}, | |||||
| </if> | |||||
| <if test="assetIcon.categoryId != null"> | |||||
| category_id = #{assetIcon.categoryId}, | |||||
| </if> | |||||
| <if test="assetIcon.path != null and assetIcon.path != ''"> | |||||
| path = #{assetIcon.path}, | |||||
| </if> | |||||
| <if test="assetIcon.description != null and assetIcon.description != ''"> | |||||
| description = #{assetIcon.description}, | |||||
| </if> | |||||
| <if test="assetIcon.createBy != null and assetIcon.createBy != ''"> | |||||
| create_by = #{assetIcon.createBy}, | |||||
| </if> | |||||
| <if test="assetIcon.createTime != null"> | |||||
| create_time = #{assetIcon.createTime}, | |||||
| </if> | |||||
| <if test="assetIcon.updateBy != null and assetIcon.updateBy != ''"> | |||||
| update_by = #{assetIcon.updateBy}, | |||||
| </if> | |||||
| <if test="assetIcon.updateTime != null"> | |||||
| update_time = #{assetIcon.updateTime}, | |||||
| </if> | |||||
| <if test="assetIcon.state != null"> | |||||
| state = #{assetIcon.state}, | |||||
| </if> | |||||
| </set> | |||||
| where id = #{assetIcon.id} | |||||
| </update> | |||||
| <!--通过主键删除--> | |||||
| <delete id="deleteById"> | |||||
| delete from asset_icon where id = #{id} | |||||
| </delete> | |||||
| </mapper> | |||||