feat(portal): 添加 typeId 字段支持

- 修改 SQL 查询语句,插入语句和更新语句以支持 typeId 条件
- 在服务实现中设置 typeId 和 deviceId用于唯一性校验
- 在 HwWeb1 实体类中新增 typeId 属性及其 getter/setter 方法
- 更新 toString 方法以包含 typeId 字段
- 在 HwWebMapper1.xml 中添加 typeId 的映射配置
master
zangch@mesnac.com 2 months ago
parent c535c2a7a4
commit 1de194e247

@ -32,6 +32,8 @@ public class HwWeb1 extends BaseEntity
private Long deviceId; private Long deviceId;
private Long typeId;
public void setWebId(Long webId) public void setWebId(Long webId)
{ {
this.webId = webId; this.webId = webId;
@ -77,6 +79,15 @@ public class HwWeb1 extends BaseEntity
this.deviceId = deviceId; this.deviceId = deviceId;
} }
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -85,6 +96,7 @@ public class HwWeb1 extends BaseEntity
.append("webJsonString", getWebJsonString()) .append("webJsonString", getWebJsonString())
.append("webCode", getWebCode()) .append("webCode", getWebCode())
.append("deviceId", getDeviceId()) .append("deviceId", getDeviceId())
.append("typeId", getTypeId())
.toString(); .toString();
} }
} }

@ -72,6 +72,8 @@ public class HwWebServiceImpl1 implements IHwWebService1
HwWeb1 codeWeb = new HwWeb1(); HwWeb1 codeWeb = new HwWeb1();
//编号唯一 //编号唯一
codeWeb.setWebCode(hwWeb1.getWebCode()); codeWeb.setWebCode(hwWeb1.getWebCode());
codeWeb.setTypeId(hwWeb1.getTypeId());
codeWeb.setDeviceId(hwWeb1.getDeviceId());
if(hwWebMapper1.selectHwWebList(codeWeb).isEmpty()){ if(hwWebMapper1.selectHwWebList(codeWeb).isEmpty()){
return hwWebMapper1.insertHwWeb(hwWeb1); return hwWebMapper1.insertHwWeb(hwWeb1);
} }

@ -10,11 +10,12 @@
<result property="webJsonString" column="web_json_string" /> <result property="webJsonString" column="web_json_string" />
<result property="webCode" column="web_code" /> <result property="webCode" column="web_code" />
<result property="deviceId" column="device_id" /> <result property="deviceId" column="device_id" />
<result property="typeId" column="typeId" />
</resultMap> </resultMap>
<sql id="selectHwWebVo"> <sql id="selectHwWebVo">
select web_id, web_json, web_json_string, web_code, select web_id, web_json, web_json_string, web_code,
device_id device_id,typeId
from hw_web1 from hw_web1
</sql> </sql>
@ -26,6 +27,7 @@
<if test="webJsonString != null and webJsonString != ''"> and web_json_string = #{webJsonString}</if> <if test="webJsonString != null and webJsonString != ''"> and web_json_string = #{webJsonString}</if>
<if test="webCode != null "> and web_code = #{webCode}</if> <if test="webCode != null "> and web_code = #{webCode}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if> <if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="typeId != null "> and typeId = #{typeId}</if>
</where> </where>
</select> </select>
@ -41,12 +43,14 @@
<if test="webJsonString != null">web_json_string,</if> <if test="webJsonString != null">web_json_string,</if>
<if test="webCode != null">web_code,</if> <if test="webCode != null">web_code,</if>
<if test="deviceId != null">device_id,</if> <if test="deviceId != null">device_id,</if>
<if test="typeId != null">typeId,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="webJson != null">#{webJson},</if> <if test="webJson != null">#{webJson},</if>
<if test="webJsonString != null">#{webJsonString},</if> <if test="webJsonString != null">#{webJsonString},</if>
<if test="webCode != null">#{webCode},</if> <if test="webCode != null">#{webCode},</if>
<if test="deviceId != null">#{deviceId},</if> <if test="deviceId != null">#{deviceId},</if>
<if test="typeId != null">#{typeId},</if>
</trim> </trim>
</insert> </insert>
@ -56,9 +60,12 @@
<if test="webJson != null">web_json = #{webJson},</if> <if test="webJson != null">web_json = #{webJson},</if>
<if test="webJsonString != null">web_json_string = #{webJsonString},</if> <if test="webJsonString != null">web_json_string = #{webJsonString},</if>
<!-- <if test="webCode != null">web_code = #{webCode},</if>--> <!-- <if test="webCode != null">web_code = #{webCode},</if>-->
<if test="deviceId != null">device_id = #{deviceId},</if> <!-- <if test="deviceId != null">device_id = #{deviceId},</if>-->
<!-- <if test="typeId != null">typeId = #{typeId},</if>-->
</trim> </trim>
where web_code = #{webCode} where web_code = #{webCode}
and device_id = #{deviceId}
and typeId = #{typeId}
</update> </update>
<delete id="deleteHwWebByWebId" parameterType="Long"> <delete id="deleteHwWebByWebId" parameterType="Long">

Loading…
Cancel
Save