wangzhenglan
2 years ago
17 changed files with 425 additions and 16 deletions
@ -0,0 +1,29 @@ |
|||||||
|
package com.lan.textja.controller.dealer; |
||||||
|
|
||||||
|
import com.lan.textja.entity.Dealer; |
||||||
|
import com.lan.textja.entity.Supplier; |
||||||
|
import com.lan.textja.entity.Supply; |
||||||
|
import com.lan.textja.service.dealer.DealerService; |
||||||
|
import com.lan.textja.util.JsonResult; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@CrossOrigin |
||||||
|
@RequestMapping("/Dealer") |
||||||
|
public class DealerController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private DealerService dealerService; |
||||||
|
|
||||||
|
@RequestMapping(value = "/dealerNames",method = RequestMethod.GET) |
||||||
|
public JsonResult dealerNames(){ |
||||||
|
List<Dealer> dealerNames= dealerService.dealerNames(); |
||||||
|
return JsonResult.ok(dealerNames); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.lan.textja.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
@Data |
||||||
|
@TableName("dealer") |
||||||
|
@Accessors(chain = true) |
||||||
|
public class Dealer implements Serializable { |
||||||
|
private Integer dealerNum; |
||||||
|
private String dealerName; |
||||||
|
private String dealerContact; |
||||||
|
private String dealerAddress; |
||||||
|
private String dealerNumber; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.lan.textja.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("orders") |
||||||
|
public class Order implements Serializable { |
||||||
|
private Integer orderNo; |
||||||
|
private String orderName; |
||||||
|
private Integer orderPrice; |
||||||
|
private Integer orderQty; |
||||||
|
private Integer orderTotalPrice; |
||||||
|
private String orderType; |
||||||
|
private String orderSupplierContact; |
||||||
|
private String orderSupplierAddress; |
||||||
|
private String orderSupplierNumber; |
||||||
|
private String orderDealerContact; |
||||||
|
private String orderDealerAddress; |
||||||
|
private String orderDealerNumber; |
||||||
|
private Integer orderGoodsNo; |
||||||
|
private Integer orderSupplierNo; |
||||||
|
private Integer orderDealerNo; |
||||||
|
private Boolean orderState; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.lan.textja.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.lan.textja.entity.Dealer; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface DealerMapper extends BaseMapper<Dealer> { |
||||||
|
List<Dealer> dealerNames(); |
||||||
|
|
||||||
|
|
||||||
|
Dealer select(String dealerName); |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.lan.textja.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.lan.textja.entity.Order; |
||||||
|
|
||||||
|
public interface OrderMapper extends BaseMapper<Order> { |
||||||
|
|
||||||
|
void SureOrder(Order order); |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.lan.textja.service.dealer; |
||||||
|
|
||||||
|
import com.lan.textja.entity.Dealer; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface DealerService{ |
||||||
|
List<Dealer> dealerNames(); |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.lan.textja.service.dealer; |
||||||
|
|
||||||
|
import com.lan.textja.entity.Dealer; |
||||||
|
import com.lan.textja.entity.Supplier; |
||||||
|
import com.lan.textja.mapper.DealerMapper; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class DealerServiceImp implements DealerService{ |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private DealerMapper dealerMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<Dealer> dealerNames() { |
||||||
|
List<Dealer> dealerNames =dealerMapper.dealerNames(); |
||||||
|
return dealerNames; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
<?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.lan.textja.mapper.DealerMapper"> |
||||||
|
<sql id="dealerColumns"> |
||||||
|
dealer_Num AS "dealerNum", |
||||||
|
dealer_Name AS "dealerName", |
||||||
|
dealer_Contact AS "dealerContact", |
||||||
|
dealer_Address AS "dealerAddress", |
||||||
|
dealer_Number AS "dealerNumber", |
||||||
|
</sql> |
||||||
|
|
||||||
|
<select id="dealerNames" resultType="com.lan.textja.entity.Dealer"> |
||||||
|
select distinct dealer_Name,dealer_Num from dealer |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="select" resultType="com.lan.textja.entity.Dealer"> |
||||||
|
select dealer_Contact,dealer_Address,dealer_Number,dealer_Num from dealer |
||||||
|
where dealer_Name=#{dealerName} |
||||||
|
</select> |
||||||
|
</mapper> |
@ -0,0 +1,65 @@ |
|||||||
|
<?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.lan.textja.mapper.OrderMapper"> |
||||||
|
<sql id="OrderColumns"> |
||||||
|
order_No AS "orderNo", |
||||||
|
order_Name AS "orderName", |
||||||
|
order_Price AS "orderPrice", |
||||||
|
order_Qty AS "orderQty", |
||||||
|
order_Total_Price AS "orderTotalPrice", |
||||||
|
order_Type AS "orderType", |
||||||
|
order_Supplier_Contact AS "orderSupplierContact", |
||||||
|
order_Supplier_Address AS "orderSupplierAddress", |
||||||
|
order_Supplier_Number AS "orderSupplierNumber", |
||||||
|
order_Dealer_Contact AS "orderDealerContact", |
||||||
|
order_Dealer_Address AS "orderDealerAddress", |
||||||
|
order_Dealer_Number AS "orderDealerNumber", |
||||||
|
order_Goods_No AS "orderGoodsNo", |
||||||
|
order_Supplier_No AS "orderSupplierNo", |
||||||
|
order_Dealer_No AS "orderDealerNo", |
||||||
|
order_State AS "orderState" |
||||||
|
</sql> |
||||||
|
|
||||||
|
<insert id="SureOrder" parameterType="com.lan.textja.entity.Order"> |
||||||
|
insert into |
||||||
|
orders ( |
||||||
|
order_No, |
||||||
|
order_Name, |
||||||
|
order_Price, |
||||||
|
order_Qty, |
||||||
|
order_Total_Price, |
||||||
|
order_Type, |
||||||
|
order_Supplier_Contact, |
||||||
|
order_Supplier_Address, |
||||||
|
order_Supplier_Number, |
||||||
|
order_Dealer_Contact, |
||||||
|
order_Dealer_Address, |
||||||
|
order_Dealer_Number, |
||||||
|
order_Goods_No, |
||||||
|
order_Supplier_No, |
||||||
|
order_Dealer_No, |
||||||
|
order_State |
||||||
|
) |
||||||
|
values ( |
||||||
|
#{orderNo}, |
||||||
|
#{orderName}, |
||||||
|
#{orderPrice}, |
||||||
|
#{orderQty}, |
||||||
|
#{orderTotalPrice}, |
||||||
|
#{orderType}, |
||||||
|
#{orderSupplierContact}, |
||||||
|
#{orderSupplierAddress}, |
||||||
|
#{orderSupplierNumber}, |
||||||
|
#{orderDealerContact}, |
||||||
|
#{orderDealerAddress}, |
||||||
|
#{orderDealerNumber}, |
||||||
|
#{orderGoodsNo}, |
||||||
|
#{orderSupplierNo}, |
||||||
|
#{orderDealerNo}, |
||||||
|
#{orderState} |
||||||
|
) |
||||||
|
</insert> |
||||||
|
|
||||||
|
</mapper> |
Loading…
Reference in new issue