Commit be44a071 authored by 周昊's avatar 周昊

Merge branch 'develop' into 公司测试环境4.221

parents 34ae82ca 2a734e5d
...@@ -61,9 +61,9 @@ public class AlgorithmBaseController extends BaseController { ...@@ -61,9 +61,9 @@ public class AlgorithmBaseController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:algorithmBase:add')") @PreAuthorize("@ss.hasPermi('system:algorithmBase:add')")
@Log(title = "算法", businessType = BusinessType.INSERT) @Log(title = "算法", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AlgorithmBase algorithmBase) { public AjaxResult add(@RequestBody AlgorithmBaseListDto algorithmBaseListDto) {
algorithmBase.setCreateBy(getUsername()); algorithmBaseListDto.setCreateBy(getUsername());
return toAjax(algorithmBaseService.insertAlgorithmBase(algorithmBase)); return toAjax(algorithmBaseService.insertAlgorithmBaseListDto(algorithmBaseListDto));
} }
/** /**
...@@ -72,9 +72,9 @@ public class AlgorithmBaseController extends BaseController { ...@@ -72,9 +72,9 @@ public class AlgorithmBaseController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:algorithmBase:edit')") @PreAuthorize("@ss.hasPermi('system:algorithmBase:edit')")
@Log(title = "算法", businessType = BusinessType.UPDATE) @Log(title = "算法", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AlgorithmBase algorithmBase) { public AjaxResult edit(@RequestBody AlgorithmBaseListDto algorithmBaseListDto) {
algorithmBase.setUpdateBy(getUsername()); algorithmBaseListDto.setUpdateBy(getUsername());
return toAjax(algorithmBaseService.updateAlgorithmBase(algorithmBase)); return toAjax(algorithmBaseService.updateAlgorithmBaseListDto(algorithmBaseListDto));
} }
/** /**
......
...@@ -65,7 +65,7 @@ public class AlgorithmPieceBaseController extends BaseController ...@@ -65,7 +65,7 @@ public class AlgorithmPieceBaseController extends BaseController
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
return success(algorithmPieceBaseService.selectAlgorithmPieceBaseById(id)); return success(algorithmPieceBaseService.selectAlgorithmPieceListDtoById(id));
} }
/** /**
...@@ -74,10 +74,10 @@ public class AlgorithmPieceBaseController extends BaseController ...@@ -74,10 +74,10 @@ public class AlgorithmPieceBaseController extends BaseController
@PreAuthorize("@ss.hasPermi('system:algorithmPiece:add')") @PreAuthorize("@ss.hasPermi('system:algorithmPiece:add')")
@Log(title = "策略算法块", businessType = BusinessType.INSERT) @Log(title = "策略算法块", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AlgorithmPieceBase algorithmPieceBase) public AjaxResult add(@RequestBody AlgorithmPieceListDto algorithmPieceListDto)
{ {
algorithmPieceBase.setCreateBy(getUsername()); algorithmPieceListDto.setCreateBy(getUsername());
return toAjax(algorithmPieceBaseService.insertAlgorithmPieceBase(algorithmPieceBase)); return toAjax(algorithmPieceBaseService.insertAlgorithmPieceListDto(algorithmPieceListDto));
} }
/** /**
...@@ -86,10 +86,10 @@ public class AlgorithmPieceBaseController extends BaseController ...@@ -86,10 +86,10 @@ public class AlgorithmPieceBaseController extends BaseController
@PreAuthorize("@ss.hasPermi('system:algorithmPiece:edit')") @PreAuthorize("@ss.hasPermi('system:algorithmPiece:edit')")
@Log(title = "策略算法块", businessType = BusinessType.UPDATE) @Log(title = "策略算法块", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AlgorithmPieceBase algorithmPieceBase) public AjaxResult edit(@RequestBody AlgorithmPieceListDto algorithmPieceListDto)
{ {
algorithmPieceBase.setUpdateBy(getUsername()); algorithmPieceListDto.setUpdateBy(getUsername());
return toAjax(algorithmPieceBaseService.updateAlgorithmPieceBase(algorithmPieceBase)); return toAjax(algorithmPieceBaseService.updateAlgorithmPieceListDto(algorithmPieceListDto));
} }
/** /**
......
...@@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; ...@@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2023-04-26 * @date 2023-04-26
*/ */
public class AlgorithmPieceVariable extends BaseEntity public class AlgorithmPieceVariable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -29,6 +29,9 @@ public class AlgorithmBaseListDto{ ...@@ -29,6 +29,9 @@ public class AlgorithmBaseListDto{
/** 创建时间 */ /** 创建时间 */
private Date createTime; private Date createTime;
/** 更新者 */
private String updateBy;
/** 排序 */ /** 排序 */
private Long sort; private Long sort;
......
...@@ -22,6 +22,9 @@ public class AlgorithmPieceListDto { ...@@ -22,6 +22,9 @@ public class AlgorithmPieceListDto {
/** 创建者 */ /** 创建者 */
private String createBy; private String createBy;
/** 更新者 */
private String updateBy;
/** 创建时间 */ /** 创建时间 */
private Date createTime; private Date createTime;
......
...@@ -3,6 +3,7 @@ package com.ruoyi.algorithm.mapper; ...@@ -3,6 +3,7 @@ package com.ruoyi.algorithm.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.algorithm.domain.AlgorithmPieceBase; import com.ruoyi.algorithm.domain.AlgorithmPieceBase;
import com.ruoyi.algorithm.domain.dto.AlgorithmPieceListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmPieceListDto;
import org.apache.ibatis.annotations.Param;
/** /**
* 策略算法块Mapper接口 * 策略算法块Mapper接口
...@@ -60,5 +61,7 @@ public interface AlgorithmPieceBaseMapper ...@@ -60,5 +61,7 @@ public interface AlgorithmPieceBaseMapper
*/ */
public int deleteAlgorithmPieceBaseByIds(Long[] ids); public int deleteAlgorithmPieceBaseByIds(Long[] ids);
List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase); public List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase);
public AlgorithmPieceListDto selectAlgorithmPieceListDtoById(@Param("id") Long id);
} }
...@@ -68,5 +68,9 @@ public interface IAlgorithmBaseService ...@@ -68,5 +68,9 @@ public interface IAlgorithmBaseService
*/ */
public List<AlgorithmBaseListDto> selectAlgorithmBaseListDto(AlgorithmBase algorithmBase); public List<AlgorithmBaseListDto> selectAlgorithmBaseListDto(AlgorithmBase algorithmBase);
AlgorithmBaseListDto selectAlgorithmBaseListDtoById(Long id); public AlgorithmBaseListDto selectAlgorithmBaseListDtoById(Long id);
public int insertAlgorithmBaseListDto(AlgorithmBaseListDto algorithmBaseListDto);
public int updateAlgorithmBaseListDto(AlgorithmBaseListDto algorithmBaseListDto);
} }
...@@ -60,5 +60,11 @@ public interface IAlgorithmPieceBaseService ...@@ -60,5 +60,11 @@ public interface IAlgorithmPieceBaseService
*/ */
public int deleteAlgorithmPieceBaseById(Long id); public int deleteAlgorithmPieceBaseById(Long id);
List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase); public List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase);
public AlgorithmPieceListDto selectAlgorithmPieceListDtoById(Long id);
public int insertAlgorithmPieceListDto(AlgorithmPieceListDto algorithmPieceListDto);
public int updateAlgorithmPieceListDto(AlgorithmPieceListDto algorithmPieceListDto);
} }
package com.ruoyi.algorithm.service.impl; package com.ruoyi.algorithm.service.impl;
import java.util.List; import com.ruoyi.algorithm.domain.AlgorithmBase;
import com.ruoyi.algorithm.domain.AlgorithmBaseType;
import com.ruoyi.algorithm.domain.dto.AlgorithmBaseListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmBaseListDto;
import com.ruoyi.algorithm.mapper.AlgorithmBaseMapper;
import com.ruoyi.algorithm.service.IAlgorithmBaseService;
import com.ruoyi.algorithm.service.IAlgorithmBaseTypeService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.algorithm.mapper.AlgorithmBaseMapper;
import com.ruoyi.algorithm.domain.AlgorithmBase; import javax.annotation.Resource;
import com.ruoyi.algorithm.service.IAlgorithmBaseService; import java.util.List;
/** /**
* 算法Service业务层处理 * 算法Service业务层处理
* *
* @author ruoyi * @author ruoyi
* @date 2023-04-26 * @date 2023-04-26
*/ */
@Service @Service
public class AlgorithmBaseServiceImpl implements IAlgorithmBaseService public class AlgorithmBaseServiceImpl implements IAlgorithmBaseService {
{
@Autowired @Autowired
private AlgorithmBaseMapper algorithmBaseMapper; private AlgorithmBaseMapper algorithmBaseMapper;
@Resource
private IAlgorithmBaseTypeService algorithmBaseTypeService;
/** /**
* 查询算法 * 查询算法
* *
* @param id 算法主键 * @param id 算法主键
* @return 算法 * @return 算法
*/ */
@Override @Override
public AlgorithmBase selectAlgorithmBaseById(Long id) public AlgorithmBase selectAlgorithmBaseById(Long id) {
{
return algorithmBaseMapper.selectAlgorithmBaseById(id); return algorithmBaseMapper.selectAlgorithmBaseById(id);
} }
/** /**
* 查询算法列表 * 查询算法列表
* *
* @param algorithmBase 算法 * @param algorithmBase 算法
* @return 算法 * @return 算法
*/ */
@Override @Override
public List<AlgorithmBase> selectAlgorithmBaseList(AlgorithmBase algorithmBase) public List<AlgorithmBase> selectAlgorithmBaseList(AlgorithmBase algorithmBase) {
{
return algorithmBaseMapper.selectAlgorithmBaseList(algorithmBase); return algorithmBaseMapper.selectAlgorithmBaseList(algorithmBase);
} }
/** /**
* 新增算法 * 新增算法
* *
* @param algorithmBase 算法 * @param algorithmBase 算法
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertAlgorithmBase(AlgorithmBase algorithmBase) public int insertAlgorithmBase(AlgorithmBase algorithmBase) {
{
algorithmBase.setCreateTime(DateUtils.getNowDate()); algorithmBase.setCreateTime(DateUtils.getNowDate());
return algorithmBaseMapper.insertAlgorithmBase(algorithmBase); return algorithmBaseMapper.insertAlgorithmBase(algorithmBase);
} }
/** /**
* 修改算法 * 修改算法
* *
* @param algorithmBase 算法 * @param algorithmBase 算法
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateAlgorithmBase(AlgorithmBase algorithmBase) public int updateAlgorithmBase(AlgorithmBase algorithmBase) {
{
algorithmBase.setUpdateTime(DateUtils.getNowDate()); algorithmBase.setUpdateTime(DateUtils.getNowDate());
return algorithmBaseMapper.updateAlgorithmBase(algorithmBase); return algorithmBaseMapper.updateAlgorithmBase(algorithmBase);
} }
/** /**
* 批量删除算法 * 批量删除算法
* *
* @param ids 需要删除的算法主键 * @param ids 需要删除的算法主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteAlgorithmBaseByIds(Long[] ids) public int deleteAlgorithmBaseByIds(Long[] ids) {
{
return algorithmBaseMapper.deleteAlgorithmBaseByIds(ids); return algorithmBaseMapper.deleteAlgorithmBaseByIds(ids);
} }
/** /**
* 删除算法信息 * 删除算法信息
* *
* @param id 算法主键 * @param id 算法主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteAlgorithmBaseById(Long id) public int deleteAlgorithmBaseById(Long id) {
{
return algorithmBaseMapper.deleteAlgorithmBaseById(id); return algorithmBaseMapper.deleteAlgorithmBaseById(id);
} }
...@@ -105,4 +105,40 @@ public class AlgorithmBaseServiceImpl implements IAlgorithmBaseService ...@@ -105,4 +105,40 @@ public class AlgorithmBaseServiceImpl implements IAlgorithmBaseService
public AlgorithmBaseListDto selectAlgorithmBaseListDtoById(Long id) { public AlgorithmBaseListDto selectAlgorithmBaseListDtoById(Long id) {
return algorithmBaseMapper.selectAlgorithmBaseListDtoById(id); return algorithmBaseMapper.selectAlgorithmBaseListDtoById(id);
} }
@Override
public int insertAlgorithmBaseListDto(AlgorithmBaseListDto algorithmBaseListDto) {
//新建算法
AlgorithmBase algorithmBase = new AlgorithmBase();
BeanUtils.copyBeanProp(algorithmBase, algorithmBaseListDto);
int i = algorithmBaseMapper.insertAlgorithmBase(algorithmBase);
//删除对应算法类型
algorithmBaseTypeService.deleteAlgorithmBaseTypeByAlgorithmId(algorithmBase.getId());
//新建算法类型
for (AlgorithmBaseType type : algorithmBaseListDto.getTypes()) {
type.setAlgorithmId(algorithmBase.getId());
algorithmBaseTypeService.insertAlgorithmBaseType(type);
}
return i;
}
@Override
public int updateAlgorithmBaseListDto(AlgorithmBaseListDto algorithmBaseListDto) {
//更新算法
AlgorithmBase algorithmBase = new AlgorithmBase();
BeanUtils.copyBeanProp(algorithmBase, algorithmBaseListDto);
int i = algorithmBaseMapper.updateAlgorithmBase(algorithmBase);
//删除对应算法类型
algorithmBaseTypeService.deleteAlgorithmBaseTypeByAlgorithmId(algorithmBase.getId());
//新建算法类型
for (AlgorithmBaseType type : algorithmBaseListDto.getTypes()) {
type.setAlgorithmId(algorithmBase.getId());
algorithmBaseTypeService.insertAlgorithmBaseType(type);
}
return i;
}
} }
...@@ -2,14 +2,20 @@ package com.ruoyi.algorithm.service.impl; ...@@ -2,14 +2,20 @@ package com.ruoyi.algorithm.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.algorithm.domain.AlgorithmPieceVariable;
import com.ruoyi.algorithm.domain.dto.AlgorithmPieceListDto; import com.ruoyi.algorithm.domain.dto.AlgorithmPieceListDto;
import com.ruoyi.algorithm.mapper.AlgorithmPieceVariableMapper;
import com.ruoyi.algorithm.service.IAlgorithmPieceVariableService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.algorithm.mapper.AlgorithmPieceBaseMapper; import com.ruoyi.algorithm.mapper.AlgorithmPieceBaseMapper;
import com.ruoyi.algorithm.domain.AlgorithmPieceBase; import com.ruoyi.algorithm.domain.AlgorithmPieceBase;
import com.ruoyi.algorithm.service.IAlgorithmPieceBaseService; import com.ruoyi.algorithm.service.IAlgorithmPieceBaseService;
import javax.annotation.Resource;
/** /**
* 策略算法块Service业务层处理 * 策略算法块Service业务层处理
* *
...@@ -22,6 +28,9 @@ public class AlgorithmPieceBaseServiceImpl implements IAlgorithmPieceBaseService ...@@ -22,6 +28,9 @@ public class AlgorithmPieceBaseServiceImpl implements IAlgorithmPieceBaseService
@Autowired @Autowired
private AlgorithmPieceBaseMapper algorithmPieceBaseMapper; private AlgorithmPieceBaseMapper algorithmPieceBaseMapper;
@Resource
private IAlgorithmPieceVariableService algorithmPieceVariableService;
/** /**
* 查询策略算法块 * 查询策略算法块
* *
...@@ -100,4 +109,45 @@ public class AlgorithmPieceBaseServiceImpl implements IAlgorithmPieceBaseService ...@@ -100,4 +109,45 @@ public class AlgorithmPieceBaseServiceImpl implements IAlgorithmPieceBaseService
public List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase) { public List<AlgorithmPieceListDto> selectAlgorithmPieceListDto(AlgorithmPieceBase algorithmPieceBase) {
return algorithmPieceBaseMapper.selectAlgorithmPieceListDto(algorithmPieceBase); return algorithmPieceBaseMapper.selectAlgorithmPieceListDto(algorithmPieceBase);
} }
@Override
public AlgorithmPieceListDto selectAlgorithmPieceListDtoById(Long id) {
return algorithmPieceBaseMapper.selectAlgorithmPieceListDtoById(id);
}
@Override
public int insertAlgorithmPieceListDto(AlgorithmPieceListDto algorithmPieceListDto) {
//新建算法块
AlgorithmPieceBase algorithmPieceBase = new AlgorithmPieceBase();
BeanUtils.copyBeanProp(algorithmPieceBase,algorithmPieceListDto);
int i = algorithmPieceBaseMapper.insertAlgorithmPieceBase(algorithmPieceBase);
//删除算法块参数
algorithmPieceVariableService.deleteAlgorithmPieceVariableByAlgorithmPieceBaseId(algorithmPieceBase.getId());
//新建算法块参数
for (AlgorithmPieceVariable variable : algorithmPieceListDto.getVariables()) {
variable.setAlgorithmPieceBaseId(algorithmPieceBase.getId());
algorithmPieceVariableService.insertAlgorithmPieceVariable(variable);
}
return i;
}
@Override
public int updateAlgorithmPieceListDto(AlgorithmPieceListDto algorithmPieceListDto) {
//更新算法块
AlgorithmPieceBase algorithmPieceBase = new AlgorithmPieceBase();
BeanUtils.copyBeanProp(algorithmPieceBase,algorithmPieceListDto);
int i = algorithmPieceBaseMapper.updateAlgorithmPieceBase(algorithmPieceBase);
//删除算法块参数
algorithmPieceVariableService.deleteAlgorithmPieceVariableByAlgorithmPieceBaseId(algorithmPieceBase.getId());
//新建算法块参数
for (AlgorithmPieceVariable variable : algorithmPieceListDto.getVariables()) {
variable.setAlgorithmPieceBaseId(algorithmPieceBase.getId());
algorithmPieceVariableService.insertAlgorithmPieceVariable(variable);
}
return i;
}
} }
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
ab.id = #{id} ab.id = #{id}
</select> </select>
<insert id="insertAlgorithmBase" parameterType="AlgorithmBase"> <insert id="insertAlgorithmBase" parameterType="AlgorithmBase" useGeneratedKeys="true" keyProperty="id">
insert into algorithm_base insert into algorithm_base
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
......
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="clazz" column="clazz"/> <result property="clazz" column="clazz"/>
<collection property="variables" ofType="com.ruoyi.algorithm.domain.AlgorithmPieceVariable"> <collection property="variables" ofType="com.ruoyi.algorithm.domain.AlgorithmPieceVariable">
<result property="algorithmPieceBaseId" column="id"/>
<result property="variableName" column="variable_name"/> <result property="variableName" column="variable_name"/>
<result property="variableKey" column="variable_key"/> <result property="variableKey" column="variable_key"/>
<result property="variableType" column="variable_type"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -89,11 +91,30 @@ ...@@ -89,11 +91,30 @@
ORDER BY ORDER BY
apb.sort ASC apb.sort ASC
</select> </select>
<select id="selectAlgorithmPieceListDtoById" resultMap="AlgorithmPieceListDtoResult">
SELECT
apb.id,
apb.piece_name,
apv.variable_name,
apv.variable_key,
apv.variable_type,
apb.sort,
apb.STATUS,
su.nick_name,
apb.clazz,
apb.create_time
FROM
algorithm_piece_base apb
LEFT JOIN algorithm_piece_variable apv ON apv.algorithm_piece_base_id = apb.id
LEFT JOIN sys_user su ON su.user_name = apb.create_by
AND su.del_flag = '0'
WHERE
apb.id = #{id}
</select>
<insert id="insertAlgorithmPieceBase" parameterType="AlgorithmPieceBase"> <insert id="insertAlgorithmPieceBase" parameterType="AlgorithmPieceBase" useGeneratedKeys="true" keyProperty="id">
insert into algorithm_piece_base insert into algorithm_piece_base
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="pieceName != null">piece_name,</if> <if test="pieceName != null">piece_name,</if>
<if test="sort != null">sort,</if> <if test="sort != null">sort,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
...@@ -106,7 +127,6 @@ ...@@ -106,7 +127,6 @@
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="pieceName != null">#{pieceName},</if> <if test="pieceName != null">#{pieceName},</if>
<if test="sort != null">#{sort},</if> <if test="sort != null">#{sort},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment