parent
faaf451f55
commit
01ebed3954
@ -0,0 +1,54 @@ |
||||
package com.psdc.entity; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Author:Stone |
||||
* @Project:psdc |
||||
* @Filename:PsdcStrategy |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2023/6/15 16:50:24 |
||||
* @Version 1.0 |
||||
*/ |
||||
@Data |
||||
@Component |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
public class PsdcStrategy implements Serializable,Cloneable{ |
||||
/** 策略Id */ |
||||
private Integer strategyId ; |
||||
/** 用户Id */ |
||||
private Long userId ; |
||||
/** 策略名称 */ |
||||
private String strategyName ; |
||||
/** 策略码 */ |
||||
private Long strategyCode ; |
||||
/** 所属步骤集合【存储场景步骤策略码】 */ |
||||
private String scenes ; |
||||
/** 策略描述 */ |
||||
private String strategyInfo ; |
||||
/** 创建人 */ |
||||
private String createBy ; |
||||
/** 创建时间 */ |
||||
private String createTime ; |
||||
/** 修改人 */ |
||||
private String updateBy ; |
||||
/** 修改时间 */ |
||||
private String updateTime ; |
||||
|
||||
public PsdcStrategy(Long userId, String strategyName, Long strategyCode, String scenes, String strategyInfo, String createBy, String createTime) { |
||||
this.userId = userId; |
||||
this.strategyName = strategyName; |
||||
this.strategyCode = strategyCode; |
||||
this.scenes = scenes; |
||||
this.strategyInfo = strategyInfo; |
||||
this.createBy = createBy; |
||||
this.createTime = createTime; |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
package com.psdc.entity.vo; |
||||
|
||||
import com.psdc.entity.res.PsdcSceneRes; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author:Stone |
||||
* @Project:psdc |
||||
* @Filename:PsdcStrategy |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2023/6/15 16:50:24 |
||||
* @Version 1.0 |
||||
*/ |
||||
@Data |
||||
@Component |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
public class StrategyVo implements Serializable,Cloneable{ |
||||
/** 策略Id */ |
||||
private Integer strategyId ; |
||||
/** 用户Id */ |
||||
private Long userId ; |
||||
/** 策略名称 */ |
||||
private String strategyName ; |
||||
/** 策略码 */ |
||||
private Integer strategyCode ; |
||||
/** 所属步骤集合 */ |
||||
private List<PsdcSceneRes> scenesList ; |
||||
/** 策略描述 */ |
||||
private String strategyInfo ; |
||||
/** 创建时间 */ |
||||
private String createTime ; |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.psdc.mapper; |
||||
|
||||
import com.psdc.entity.PsdcScene; |
||||
import com.psdc.entity.PsdcStrategy; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author:戴仕崑 |
||||
* @Project:psdc |
||||
* @Filename:PsdcStrategyMapper |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2023/6/15 16:40 |
||||
* @Version 1.0 |
||||
*/ |
||||
@Mapper |
||||
@Repository |
||||
public interface PsdcStrategyMapper { |
||||
|
||||
|
||||
/** |
||||
* 通过用户ID查询数据 |
||||
* @param userId 主键 |
||||
* @return 实例对象 |
||||
*/ |
||||
List<PsdcStrategy> queryByUser(@Param("userId") Long userId, |
||||
@Param(value = "sceneCode") Long sceneCode); |
||||
|
||||
List<PsdcStrategy> strategyList(@Param(value = "userId") Long userId); |
||||
|
||||
/** |
||||
* 新增数据 |
||||
* @param psdcStrategy 实例对象 |
||||
* @return 影响行数 |
||||
*/ |
||||
Integer insert(PsdcStrategy psdcStrategy); |
||||
} |
@ -0,0 +1,41 @@ |
||||
<?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.psdc.mapper.PsdcStrategyMapper"> |
||||
<resultMap type="com.psdc.entity.PsdcStrategy" id="PsdcStrategyMap"> |
||||
<result property="strategyId" column="strategy_id" /> |
||||
<result property="userId" column="user_id" /> |
||||
<result property="strategyName" column="strategy_name" /> |
||||
<result property="strategyCode" column="strategy_code" /> |
||||
<result property="scenes" column="scenes" /> |
||||
<result property="strategyInfo" column="strategy_info" /> |
||||
<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> |
||||
|
||||
<select id="queryByUser" resultMap="PsdcStrategyMap"> |
||||
Select |
||||
strategy_id,user_id,strategy_name,strategy_code,scenes,strategy_info,create_by,create_time,update_by,update_time |
||||
From psdc_strategy |
||||
<where> |
||||
<if test="userId != null and userId != ''"> |
||||
And user_id = #{userId} |
||||
</if> |
||||
<if test="sceneCode != null and sceneCode != ''"> |
||||
And strategy_code = #{sceneCode} |
||||
</if> |
||||
</where> |
||||
Group By strategy_code |
||||
</select> |
||||
|
||||
<select id="strategyList" resultMap="PsdcStrategyMap"> |
||||
SELECT * FROM `psdc_strategy` WHERE user_id = ${userId} Group By strategy_code |
||||
</select> |
||||
|
||||
<!--新增数据--> |
||||
<insert id="insert" parameterType="com.psdc.entity.PsdcStrategy"> |
||||
Insert into psdc_strategy(user_id,strategy_name,strategy_code,scenes,strategy_info,create_by,create_time,update_by,update_time) |
||||
Values (#{userId},#{strategyName},#{strategyCode},#{scenes},#{strategyInfo},#{createBy},#{createTime},#{updateBy},#{updateTime}) |
||||
</insert> |
||||
</mapper> |
Loading…
Reference in new issue