master
Guo YuKun 2024-03-22 20:48:53 +08:00
parent 2758b49a1b
commit e2864331e8
22 changed files with 233 additions and 88 deletions

View File

@ -1,4 +1,6 @@
package com.bwie.common.domain; package com.bwie.common.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -17,7 +19,9 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("askbuy")
public class AskBuy { public class AskBuy {
@TableId
private BigInteger askBuyId; //求租ID private BigInteger askBuyId; //求租ID
private String askBuyAddress; //求租具体地址 private String askBuyAddress; //求租具体地址
private String askBuyTitle; //求租标签 private String askBuyTitle; //求租标签

View File

@ -1,4 +1,6 @@
package com.bwie.common.domain; package com.bwie.common.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -15,7 +17,9 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("askrent")
public class AskRent { public class AskRent {
@TableId
private BigInteger askRentId; //求租ID private BigInteger askRentId; //求租ID
private String askRentAddress; //求租具体地址 private String askRentAddress; //求租具体地址
private String askRentTitle; //求租标签 private String askRentTitle; //求租标签

View File

@ -9,6 +9,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigInteger;
import java.util.Date; import java.util.Date;
@Data @Data

View File

@ -1,13 +1,12 @@
package com.bwie.background; package com.bwie.ask;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@MapperScan("com.bwie.group.mapper") @MapperScan("com.bwie.ask.mapper")
public class AskMapperApp { public class AskMapperApp {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AskMapperApp.class); SpringApplication.run(AskMapperApp.class);

View File

@ -0,0 +1,36 @@
package com.bwie.ask.controller;
import com.bwie.ask.seriver.AskBuyService;
import com.bwie.common.domain.AskBuy;
import com.bwie.common.result.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* controller
*/
@RestController
@RequestMapping("/buy")
public class AskBuyController {
private final AskBuyService askBuyService;
public AskBuyController(AskBuyService askBuyService) {
this.askBuyService = askBuyService;
}
@PostMapping("/shouAll")
public Result<List<AskBuy>> shouAll(){
return askBuyService.shouAll();
}
@PostMapping("/addAskBuy")
public Result addAskBuy(@RequestBody AskBuy askBuy){
return askBuyService.addAskBuy(askBuy);
}
}

View File

@ -0,0 +1,36 @@
package com.bwie.ask.controller;
import com.bwie.ask.seriver.AskRentService;
import com.bwie.common.domain.AskRent;
import com.bwie.common.result.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* controller
*/
@RestController
@RequestMapping("/rent")
public class AskRentController {
private final AskRentService askRentService;
public AskRentController(AskRentService askRentService) {
this.askRentService = askRentService;
}
@PostMapping("/shouList")
public Result<List<AskRent>> shouList(){
return askRentService.shouList();
}
@PostMapping("/addAskRent")
public Result addAskRent(@RequestBody AskRent askRent){
return askRentService.addAskRent(askRent);
}
}

View File

@ -1,9 +1,11 @@
package com.bwie.background.mapper; package com.bwie.ask.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bwie.common.domain.AskBuy; import com.bwie.common.domain.AskBuy;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* mapper * mapper
*/ */
@ -11,4 +13,10 @@ import org.apache.ibatis.annotations.Mapper;
public interface AskBuyMapper extends BaseMapper<AskBuy> { public interface AskBuyMapper extends BaseMapper<AskBuy> {
List<AskBuy> shouAll();
Integer addAskBuy(AskBuy askBuy);
} }

View File

@ -1,12 +1,18 @@
package com.bwie.background.mapper; package com.bwie.ask.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bwie.common.domain.AskRent; import com.bwie.common.domain.AskRent;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* mapper * mapper
*/ */
@Mapper @Mapper
public interface AskRentMapper extends BaseMapper<AskRent> { public interface AskRentMapper extends BaseMapper<AskRent> {
List<AskRent> shouList();
Integer addAskRent(AskRent askRent);
} }

View File

@ -0,0 +1,15 @@
package com.bwie.ask.seriver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bwie.common.domain.AskBuy;
import com.bwie.common.result.Result;
import java.util.List;
public interface AskBuyService extends IService<AskBuy> {
public Result<List<AskBuy>> shouAll();
public Result addAskBuy(AskBuy askBuy);
}

View File

@ -0,0 +1,14 @@
package com.bwie.ask.seriver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bwie.common.domain.AskRent;
import com.bwie.common.result.Result;
import java.util.List;
public interface AskRentService extends IService<AskRent> {
public Result<List<AskRent>> shouList();
public Result addAskRent(AskRent askRent);
}

View File

@ -0,0 +1,45 @@
package com.bwie.ask.seriver.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ask.mapper.AskBuyMapper;
import com.bwie.ask.seriver.AskBuyService;
import com.bwie.common.domain.AskBuy;
import com.bwie.common.result.Result;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*/
@Service
public class AskBuyServiceImpl extends ServiceImpl<AskBuyMapper, AskBuy> implements AskBuyService {
private final AskBuyMapper askBuyMapper;
public AskBuyServiceImpl(AskBuyMapper askBuyMapper) {
this.askBuyMapper = askBuyMapper;
}
/**
*
* @return
*/
@Override
public Result<List<AskBuy>> shouAll(){
List<AskBuy> askBuys = askBuyMapper.shouAll();
return Result.success(askBuys);
}
@Override
public Result addAskBuy(AskBuy askBuy){
Integer i = askBuyMapper.addAskBuy(askBuy);
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
}
}

View File

@ -0,0 +1,40 @@
package com.bwie.ask.seriver.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ask.mapper.AskRentMapper;
import com.bwie.ask.seriver.AskRentService;
import com.bwie.common.domain.AskRent;
import com.bwie.common.result.Result;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*/
@Service
public class AskRentServiceImpl extends ServiceImpl<AskRentMapper, AskRent> implements AskRentService {
private final AskRentMapper askRentMapper;
public AskRentServiceImpl(AskRentMapper askRentMapper) {
this.askRentMapper = askRentMapper;
}
/**
*
* @return
*/
@Override
public Result<List<AskRent>> shouList(){
List<AskRent> askRentList = askRentMapper.shouList();
return Result.success(askRentList);
}
@Override
public Result addAskRent(AskRent askRent){
Integer i = askRentMapper.addAskRent(askRent);
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
}
}

View File

@ -1,12 +0,0 @@
package com.bwie.background.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* controller
*/
@RestController
@RequestMapping("/buy")
public class AskBuyController {
}

View File

@ -1,12 +0,0 @@
package com.bwie.background.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* controller
*/
@RestController
@RequestMapping("/rent")
public class AskRentController {
}

View File

@ -1,10 +0,0 @@
package com.bwie.background.seriver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bwie.common.domain.AskBuy;
public interface AskBuyService extends IService<AskBuy> {
}

View File

@ -1,7 +0,0 @@
package com.bwie.background.seriver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bwie.common.domain.AskRent;
public interface AskRentService extends IService<AskRent> {
}

View File

@ -1,18 +0,0 @@
package com.bwie.background.seriver.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.background.mapper.AskBuyMapper;
import com.bwie.background.seriver.AskBuyService;
import com.bwie.common.domain.AskBuy;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class AskBuyServiceImpl extends ServiceImpl<AskBuyMapper, AskBuy> implements AskBuyService {
}

View File

@ -1,17 +0,0 @@
package com.bwie.background.seriver.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.background.mapper.AskRentMapper;
import com.bwie.background.seriver.AskRentService;
import com.bwie.common.domain.AskRent;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class AskRentServiceImpl extends ServiceImpl<AskRentMapper, AskRent> implements AskRentService {
}

View File

@ -1,5 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bwie.background.mapper.AskBuyMapper"> <mapper namespace="com.bwie.ask.mapper.AskBuyMapper">
<insert id="addAskBuy">
INSERT INTO `xm_house`.`askbuy` (`askbuy_address`, `askbuy_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askbuy_price`, `is_delete`, `create_time`, `update_time`)
VALUES (#{askBuyAddress},#{askbuy},#{dictionaryTypeId},#{addrId},#{userId},#{askBuyPrice},#{isDelete},#{createTime},#{updateTime});
</insert>
<select id="shouAll" resultType="com.bwie.common.domain.AskBuy">
select * from askbuy
</select>
</mapper> </mapper>

View File

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bwie.background.mapper.AskRentMapper"> <mapper namespace="com.bwie.ask.mapper.AskRentMapper">
<insert id="addAskRent">
INSERT INTO `xm_house`.`askrent` (`askrent_address`, `askrent_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askrent_price`, `is_delete`,
`craete_time`, `update_time`)
VALUES (#{askRentAddress},#{askRentTitle},#{dictionaryTypeId},#{addrId},#{userId},#{askRentPrice},#{isDelete},#{createTime},#{updateTime});
</insert>
<select id="shouList" resultType="com.bwie.common.domain.AskRent">
select * from askrent
</select>
</mapper> </mapper>

View File

@ -1,5 +0,0 @@
<?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.bwie.background.mapper.BackGroundMapper">
</mapper>

View File

@ -2,4 +2,5 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bwie.background.mapper.AskRentMapper"> <mapper namespace="com.bwie.background.mapper.AskRentMapper">
<select id="shouList" resultType="com.bwie.common.domain.AskRent"></select>
</mapper> </mapper>