场景化配置:场景化模板风格查询列表、增加、修改和查询详细信息接口
master
xs 2 weeks ago
parent fc919b0241
commit e0d09a4685

@ -0,0 +1,105 @@
package com.ruoyi.business.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.business.domain.HwTemplateStyle;
import com.ruoyi.business.service.IHwTemplateStyleService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xins
* @date 2025-01-06
*/
@RestController
@RequestMapping("/templateStyle")
public class HwTemplateStyleController extends BaseController
{
@Autowired
private IHwTemplateStyleService hwTemplateStyleService;
/**
*
*/
// @RequiresPermissions("business:templateStyle:list")
@GetMapping("/list")
public TableDataInfo list(HwTemplateStyle hwTemplateStyle)
{
startPage();
List<HwTemplateStyle> list = hwTemplateStyleService.selectHwTemplateStyleList(hwTemplateStyle);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("business:templateStyle:export")
@Log(title = "场景化图风格信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, HwTemplateStyle hwTemplateStyle)
{
List<HwTemplateStyle> list = hwTemplateStyleService.selectHwTemplateStyleList(hwTemplateStyle);
ExcelUtil<HwTemplateStyle> util = new ExcelUtil<HwTemplateStyle>(HwTemplateStyle.class);
util.exportExcel(response, list, "场景化图风格信息数据");
}
/**
*
*/
// @RequiresPermissions("business:templateStyle:query")
@GetMapping(value = "/{templateStyleId}")
public AjaxResult getInfo(@PathVariable("templateStyleId") Long templateStyleId)
{
return success(hwTemplateStyleService.selectHwTemplateStyleByTemplateStyleId(templateStyleId));
}
/**
*
*/
// @RequiresPermissions("business:templateStyle:add")
@Log(title = "场景化图风格信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwTemplateStyle hwTemplateStyle)
{
return toAjax(hwTemplateStyleService.insertHwTemplateStyle(hwTemplateStyle));
}
/**
*
*/
// @RequiresPermissions("business:templateStyle:edit")
@Log(title = "场景化图风格信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HwTemplateStyle hwTemplateStyle)
{
return toAjax(hwTemplateStyleService.updateHwTemplateStyle(hwTemplateStyle));
}
/**
*
*/
@RequiresPermissions("business:templateStyle:remove")
@Log(title = "场景化图风格信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{templateStyleIds}")
public AjaxResult remove(@PathVariable Long[] templateStyleIds)
{
return toAjax(hwTemplateStyleService.deleteHwTemplateStyleByTemplateStyleIds(templateStyleIds));
}
}

@ -0,0 +1,97 @@
package com.ruoyi.business.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* hw_template_style
*
* @author xins
* @date 2025-01-06
*/
public class HwTemplateStyle extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 风格信息ID */
private Long templateStyleId;
/** 风格类型(0自定义1风格1,2风格2,3风格3) */
@Excel(name = "风格类型(0自定义1风格1,2风格2,3风格3)")
private String templateStyleType;
/** 基准颜色 */
@Excel(name = "基准颜色")
private String baseColor;
/** 字体颜色 */
@Excel(name = "字体颜色")
private String fontColor;
/** 颜色库,多个以,隔开 */
@Excel(name = "颜色库,多个以,隔开")
private String colors;
public void setTemplateStyleId(Long templateStyleId)
{
this.templateStyleId = templateStyleId;
}
public Long getTemplateStyleId()
{
return templateStyleId;
}
public void setTemplateStyleType(String templateStyleType)
{
this.templateStyleType = templateStyleType;
}
public String getTemplateStyleType()
{
return templateStyleType;
}
public void setBaseColor(String baseColor)
{
this.baseColor = baseColor;
}
public String getBaseColor()
{
return baseColor;
}
public void setFontColor(String fontColor)
{
this.fontColor = fontColor;
}
public String getFontColor()
{
return fontColor;
}
public void setColors(String colors)
{
this.colors = colors;
}
public String getColors()
{
return colors;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("templateStyleId", getTemplateStyleId())
.append("templateStyleType", getTemplateStyleType())
.append("baseColor", getBaseColor())
.append("fontColor", getFontColor())
.append("colors", getColors())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.HwTemplateStyle;
/**
* Mapper
*
* @author xins
* @date 2025-01-06
*/
public interface HwTemplateStyleMapper
{
/**
*
*
* @param templateStyleId
* @return
*/
public HwTemplateStyle selectHwTemplateStyleByTemplateStyleId(Long templateStyleId);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public List<HwTemplateStyle> selectHwTemplateStyleList(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public int insertHwTemplateStyle(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public int updateHwTemplateStyle(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param templateStyleId
* @return
*/
public int deleteHwTemplateStyleByTemplateStyleId(Long templateStyleId);
/**
*
*
* @param templateStyleIds
* @return
*/
public int deleteHwTemplateStyleByTemplateStyleIds(Long[] templateStyleIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.business.service;
import java.util.List;
import com.ruoyi.business.domain.HwTemplateStyle;
/**
* Service
*
* @author xins
* @date 2025-01-06
*/
public interface IHwTemplateStyleService
{
/**
*
*
* @param templateStyleId
* @return
*/
public HwTemplateStyle selectHwTemplateStyleByTemplateStyleId(Long templateStyleId);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public List<HwTemplateStyle> selectHwTemplateStyleList(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public int insertHwTemplateStyle(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param hwTemplateStyle
* @return
*/
public int updateHwTemplateStyle(HwTemplateStyle hwTemplateStyle);
/**
*
*
* @param templateStyleIds
* @return
*/
public int deleteHwTemplateStyleByTemplateStyleIds(Long[] templateStyleIds);
/**
*
*
* @param templateStyleId
* @return
*/
public int deleteHwTemplateStyleByTemplateStyleId(Long templateStyleId);
}

@ -0,0 +1,99 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HwTemplateStyleMapper;
import com.ruoyi.business.domain.HwTemplateStyle;
import com.ruoyi.business.service.IHwTemplateStyleService;
/**
* Service
*
* @author xins
* @date 2025-01-06
*/
@Service
public class HwTemplateStyleServiceImpl implements IHwTemplateStyleService
{
@Autowired
private HwTemplateStyleMapper hwTemplateStyleMapper;
/**
*
*
* @param templateStyleId
* @return
*/
@Override
public HwTemplateStyle selectHwTemplateStyleByTemplateStyleId(Long templateStyleId)
{
return hwTemplateStyleMapper.selectHwTemplateStyleByTemplateStyleId(templateStyleId);
}
/**
*
*
* @param hwTemplateStyle
* @return
*/
@Override
public List<HwTemplateStyle> selectHwTemplateStyleList(HwTemplateStyle hwTemplateStyle)
{
return hwTemplateStyleMapper.selectHwTemplateStyleList(hwTemplateStyle);
}
/**
*
*
* @param hwTemplateStyle
* @return
*/
@Override
public int insertHwTemplateStyle(HwTemplateStyle hwTemplateStyle)
{
hwTemplateStyle.setCreateBy(SecurityUtils.getUsername());
hwTemplateStyle.setCreateTime(DateUtils.getNowDate());
return hwTemplateStyleMapper.insertHwTemplateStyle(hwTemplateStyle);
}
/**
*
*
* @param hwTemplateStyle
* @return
*/
@Override
public int updateHwTemplateStyle(HwTemplateStyle hwTemplateStyle)
{
hwTemplateStyle.setUpdateBy(SecurityUtils.getUsername());
hwTemplateStyle.setUpdateTime(DateUtils.getNowDate());
return hwTemplateStyleMapper.updateHwTemplateStyle(hwTemplateStyle);
}
/**
*
*
* @param templateStyleIds
* @return
*/
@Override
public int deleteHwTemplateStyleByTemplateStyleIds(Long[] templateStyleIds)
{
return hwTemplateStyleMapper.deleteHwTemplateStyleByTemplateStyleIds(templateStyleIds);
}
/**
*
*
* @param templateStyleId
* @return
*/
@Override
public int deleteHwTemplateStyleByTemplateStyleId(Long templateStyleId)
{
return hwTemplateStyleMapper.deleteHwTemplateStyleByTemplateStyleId(templateStyleId);
}
}

@ -0,0 +1,87 @@
<?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.business.mapper.HwTemplateStyleMapper">
<resultMap type="HwTemplateStyle" id="HwTemplateStyleResult">
<result property="templateStyleId" column="template_style_id" />
<result property="templateStyleType" column="template_style_type" />
<result property="baseColor" column="base_color" />
<result property="fontColor" column="font_color" />
<result property="colors" column="colors" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectHwTemplateStyleVo">
select template_style_id, template_style_type, base_color, font_color, colors, create_by, create_time, update_by, update_time from hw_template_style
</sql>
<select id="selectHwTemplateStyleList" parameterType="HwTemplateStyle" resultMap="HwTemplateStyleResult">
<include refid="selectHwTemplateStyleVo"/>
<where>
<if test="templateStyleType != null and templateStyleType != ''"> and template_style_type = #{templateStyleType}</if>
<if test="baseColor != null and baseColor != ''"> and base_color = #{baseColor}</if>
<if test="fontColor != null and fontColor != ''"> and font_color = #{fontColor}</if>
<if test="colors != null and colors != ''"> and colors = #{colors}</if>
</where>
</select>
<select id="selectHwTemplateStyleByTemplateStyleId" parameterType="Long" resultMap="HwTemplateStyleResult">
<include refid="selectHwTemplateStyleVo"/>
where template_style_id = #{templateStyleId}
</select>
<insert id="insertHwTemplateStyle" parameterType="HwTemplateStyle" useGeneratedKeys="true" keyProperty="templateStyleId">
insert into hw_template_style
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateStyleType != null and templateStyleType != ''">template_style_type,</if>
<if test="baseColor != null and baseColor != ''">base_color,</if>
<if test="fontColor != null and fontColor != ''">font_color,</if>
<if test="colors != null">colors,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateStyleType != null and templateStyleType != ''">#{templateStyleType},</if>
<if test="baseColor != null and baseColor != ''">#{baseColor},</if>
<if test="fontColor != null and fontColor != ''">#{fontColor},</if>
<if test="colors != null">#{colors},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateHwTemplateStyle" parameterType="HwTemplateStyle">
update hw_template_style
<trim prefix="SET" suffixOverrides=",">
<if test="templateStyleType != null and templateStyleType != ''">template_style_type = #{templateStyleType},</if>
<if test="baseColor != null and baseColor != ''">base_color = #{baseColor},</if>
<if test="fontColor != null and fontColor != ''">font_color = #{fontColor},</if>
<if test="colors != null">colors = #{colors},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where template_style_id = #{templateStyleId}
</update>
<delete id="deleteHwTemplateStyleByTemplateStyleId" parameterType="Long">
delete from hw_template_style where template_style_id = #{templateStyleId}
</delete>
<delete id="deleteHwTemplateStyleByTemplateStyleIds" parameterType="String">
delete from hw_template_style where template_style_id in
<foreach item="templateStyleId" collection="array" open="(" separator="," close=")">
#{templateStyleId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save