Commit 7958bb32 authored by lanbaoming's avatar lanbaoming

2024-05-27

parent 65fdb9d1
package cn.iocoder.yudao.module.delivery.entity.deptex;
import java.util.List;
public class TreeNode {
private int id; // 节点id
private String text; // 节点名称
private int fid; // 父节点id
private List<TreeNode> children; // 包含的子节点
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getFid() {
return fid;
}
public void setFid(int fid) {
this.fid = fid;
}
public List<TreeNode> getChildren() {
return children;
}
public void setChildren(List<TreeNode> children) {
this.children = children;
}
}
...@@ -58,7 +58,7 @@ public class CalculateOrderVValueListener { ...@@ -58,7 +58,7 @@ public class CalculateOrderVValueListener {
if (orderDO.getTransportId() == 1) { if (orderDO.getTransportId() == 1) {
//海运计算V值 //海运计算V值
temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>() temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
.eqIfPresent(EcwVz::getTitleZh, "M3")); .eqIfPresent(EcwVz::getFuhao, "M3"));
if (temp == null) { if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS); throw exception(VCONFIG_NOT_EXISTS);
} }
...@@ -66,7 +66,7 @@ public class CalculateOrderVValueListener { ...@@ -66,7 +66,7 @@ public class CalculateOrderVValueListener {
} else if (orderDO.getTransportId() == 3) { } else if (orderDO.getTransportId() == 3) {
//空运计算V值 //空运计算V值
temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>() temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
.eqIfPresent(EcwVz::getTitleZh, "KG")); .eqIfPresent(EcwVz::getFuhao, "KG"));
if (temp == null) { if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS); throw exception(VCONFIG_NOT_EXISTS);
} }
......
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.deptex.zTest;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/*
用注解实现简单的功能 lanbm 2024-05-26 add
*/
public interface MyTest {
// 查询所有商品类型
@Select("select * from z_test")
public List<zTest> selectAll();
// 根据类型编号查询商品类型
@Select("select * from z_test where id = #{id}")
zTest selectById(int id);
// 添加商品类型
@Insert("insert into z_test(name) values(#{name})")
@Options(useGeneratedKeys = true, keyProperty = "id")
public int add(zTest type);
// 更新商品类型
@Update("update z_test set name = #{name} where id = #{id}")
public int update(zTest type);
}
package cn.iocoder.yudao.module.delivery.utility;
import cn.iocoder.yudao.module.delivery.entity.deptex.TreeNode;
import java.util.ArrayList;
import java.util.List;
/*
递归的例子 lanbm 2024-05-26 add
*/
public class JsonFactory {
public static List<TreeNode> buildtree(List<TreeNode> nodes, int id) {
List<TreeNode> treeNodes = new ArrayList<TreeNode>();
for (TreeNode treeNode : nodes) {
TreeNode node = new TreeNode();
node.setId(treeNode.getId());
node.setText(treeNode.getText());
if (id == treeNode.getFid()) {
//递给调用buildtree方法给TreeNode中的children属性赋值
node.setChildren(buildtree(nodes, node.getId()));
treeNodes.add(node);
}
}
return treeNodes;
}
}
...@@ -19,6 +19,36 @@ ...@@ -19,6 +19,36 @@
<!-- 通用查询结果列 2024-04-22--> <!-- 通用查询结果列 2024-04-22-->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, name, emp_gender, age, email </sql> id, name, emp_gender, age, email </sql>
<!-- 目的:为dao接口方法提供sql语句配置 -->
<insert id="addUser">
<!-- 具体的sql -->
insert into user(user_name,user_password,phone_number,day)
value (#{userName},#{userPassword},#{phoneNumber},#{day})
</insert>
<select id="queryUserByname" resultType="cn.iocoder.yudao.module.delivery.entity.Employee">
select *
from user
where user_name = #{userName}
</select>
<select id="queryUser" resultType="cn.iocoder.yudao.module.delivery.entity.Employee">
select *
from user
</select>
<update id="updateUserDay">
UPDATE user
SET day=#{day}
WHERE user_name = #{userName}
</update>
<update id="addUserOverdue">
UPDATE user
SET Overdue=Overdue + 1
WHERE user_name = #{userName}
</update>
</mapper> </mapper>
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