已添加24个文件
已重命名4个文件
已修改39个文件
已删除4个文件
| | |
| | | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); |
| | | |
| | | //设置æä»¶èæè·¯å¾æ å° |
| | | registry.addResourceHandler("/img/**").addResourceLocations("file:"+filePath+"/") |
| | | .addResourceLocations("file:"+filePath+"/"); |
| | | registry.addResourceHandler("/img/**").addResourceLocations("file:"+filePath+"/"); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | @Configuration |
| | | public class MyBatisPlusConfig { |
| | | |
| | | // ä¹è§éæä»¶ |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * å¼å¯æ¹éæ·»å |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public MySqlInjector sqlInjector() { |
| | | return new MySqlInjector(); |
| | | } |
| | | |
| | | /** |
| | | * éè¦é
ç½®æ¦æªå¨ï¼ä¸ç¶å¨AddDeviceä¸çtotalæ æ³è·åå° |
| | | * @return |
| | |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor(){ |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | // ä¹è§é |
| | | interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); |
| | | // å页é
ç½® |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | |
| | | package com.yuanchu.mom.mybatis_config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.core.injector.AbstractMethod; |
| | | import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; |
| | | import com.baomidou.mybatisplus.core.metadata.TableInfo; |
| | | import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | */ |
| | | @Component |
| | | public class MySqlInjector extends DefaultSqlInjector { |
| | | |
| | | @Override |
| | | public List<AbstractMethod> getMethodList(Class<?> mapperClass) { |
| | | List<AbstractMethod> methodList = super.getMethodList(mapperClass); |
| | | public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) { |
| | | List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo); |
| | | //å¢å èªå®ä¹æ¹æ³ï¼å段注解ä¸ä¸çäºFieldFill.DEFAULTçåæ®µæä¼æå
¥ |
| | | methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.DEFAULT)); |
| | | methodList.add(new InsertBatchSomeColumn(t->!t.isLogicDelete())); |
| | | return methodList; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String getTimeSixNumberCode(String prefix){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format = simpleDateFormat.format(new Date()); |
| | | String timeStr = format.replace("-", ""); |
| | | long incrNum = RedisUtil.incr("num", 1); |
| | | System.out.println(incrNum + "=============="); |
| | | if(incrNum == 1){ |
| | | RedisUtil.expire("num", 60 * 60 * 24); |
| | | } |
| | | String sixIncr = String.format("%06d", incrNum); |
| | | return prefix + timeStr + sixIncr; |
| | | } |
| | | } |
| | |
| | | <artifactId>framework</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>user-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>standard-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.vaadin.external.google</groupId> |
| | | <artifactId>android-json</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>user-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!--æ 忍¡å--> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>standard-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | </dependencies> |
| | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @ApiOperation(value = "æ°å¢æé®-->1ãæ°å¢è¿ç¨æ£éªå") |
| | | @ApiOperation(value = "æ°å¢æé®-->1ãæ°å¢æåæ£éªå") |
| | | @PostMapping("/add_process_inspection_sheet") |
| | | public Result<?> addProcessInspectionSheet(@Validated @RequestBody FinishedInspect finishedInspect){ |
| | | Integer isInsertSuccess = finishedInspectService.addProcessInspectionSheet(finishedInspect); |
| | | if (isInsertSuccess == 1){ |
| | | return Result.success("æ°å¢æåï¼"); |
| | | return Result.success("æ°å¢æåï¼", finishedInspect.getId()); |
| | | } |
| | | return Result.fail("æ°å¢å¤±è´¥ï¼"); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "countSize",value = "æ¡æ°/页",dataTypeClass = Integer.class,required = true), |
| | | @ApiImplicitParam(name = "formTime",value = "æ¥ææ¥æ",dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "dealState",value = "å¤çç¶æ(为空=å
¨é¨)",dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "supplier",value = "ä¾åºå(为空=å
¨é¨)",dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "type",value = "ç±»å(为空=åææ2)",dataTypeClass = Integer.class) |
| | | }) |
| | | @GetMapping("/selectUnRawInspectsList") |
| | | public Result selectUnRawInspectsList(int pageSize, int countSize, String formTime, Integer dealState,String supplier,Integer type){ |
| | | IPage<Map<String, Object>> inspectionPage = inspectUnacceptedService.selectUnRawInspectsList(new Page<Object>(pageSize, countSize), formTime,dealState,supplier,type); |
| | | public Result selectUnRawInspectsList(int pageSize, int countSize, String formTime, Integer dealState,Integer type){ |
| | | IPage<Map<String, Object>> inspectionPage = inspectUnacceptedService.selectUnRawInspectsList(new Page<Object>(pageSize, countSize), formTime,dealState,type); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", inspectionPage.getTotal()); |
| | | map.put("row", inspectionPage.getRecords()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.service.OpinionService; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼å¤çæè§è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-07 01:54:28 |
| | | */ |
| | | @Api(tags = "QMS管ç-->ä¸åæ ¼åå¤ç½®") |
| | | @Controller |
| | | @RequestMapping("/opinion") |
| | | public class OpinionController { |
| | | |
| | | @Autowired |
| | | private OpinionService opinionService; |
| | | |
| | | @ApiOperation(value = "主页å页") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "productName", value = "产ååç§°", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "specificationsModels", value = "è§æ ¼åå·", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list_page") |
| | | public Result<?> selectOpinionPage(Integer pageNo, Integer pageSize, String productName, String specificationsModels){ |
| | | IPage<Map<String, Object>> page = opinionService.selectOpinionPage(new Page<Object>(pageNo, pageSize), productName, specificationsModels); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", page.getTotal()); |
| | | map.put("row", page.getRecords()); |
| | | return Result.success(map); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | |
| | | import com.yuanchu.mom.pojo.RawInspect; |
| | | import com.yuanchu.mom.pojo.vo.RawInsProductVo; |
| | | import com.yuanchu.mom.pojo.vo.RawInspectVo; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | |
| | | public interface InspectUnacceptedMapper extends BaseMapper<InspectUnaccepted> { |
| | | |
| | | //æ¥è¯¢åææä¸åæ ¼åæ£éªåå表 |
| | | IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, String supplier, Integer type); |
| | | IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, Integer type); |
| | | |
| | | //æ¥è¯¢è¿ç¨æ£éªåæåæ£éªä¸ä¸åæ ¼åæ£éªåå表 |
| | | IPage<Map<String, Object>> selectInsList(Page<Object> page, String formTime, Integer dealState, String supplier, Integer type); |
| | | IPage<Map<String, Object>> selectInsList(Page<Object> page, String formTime, Integer dealState, Integer type); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.yuanchu.mom.pojo.Opinion; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼å¤çæè§è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-07 01:54:28 |
| | | */ |
| | | public interface OpinionMapper extends BaseMapper<Opinion> { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "è§æ ¼åå·æ¼æ¥å符", required = true, example = "8.7/15kV JLS-3.2") |
| | | private String specificationsModel; |
| | | |
| | | @NotNull(message = "è¯·éæ©è§æ ¼åå·ï¼") |
| | | @NotNull(message = "è¯·éæ©åå·IDï¼") |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "åå·ID", required = true, example = "1") |
| | | private Integer specificationsId; |
| | | |
| | | @ApiModelProperty(value = "项ç®ç¼ç ", required = true, example = "GX20230807") |
| | | private String materialCode; |
| | | |
| | | @NotNull(message = "è¯·éæ©é¡¹ç®åç§°ï¼") |
| | | @ApiModelProperty(value = "项ç®åç§°", required = true, example = "å
纤") |
| | | private String material; |
| | |
| | | **/ |
| | | private Integer type; |
| | | |
| | | /** |
| | | * ä¾åºå |
| | | **/ |
| | | private String supplier; |
| | | |
| | | /** |
| | | * ç°è±¡æè¿° |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | private String name; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "ç¶åç§°") |
| | | private String father; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "æ åå¼") |
| | | private String required; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "å
æ§å¼") |
| | | private String internal; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "æåæ£éªåId") |
| | | private Integer finishInspectId; |
| | | |
| | |
| | | @ApiModelProperty(value = "æ£éªäºº") |
| | | private String username; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | @TableLogic(value = "1", delval = "0") |
| | | private Integer state; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼å¤çæè§è¡¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-07 01:54:28 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class Opinion implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æè§id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * é¨é¨ç±»å 0ï¼ææ¯é¨ï¼1ï¼ç产é¨ï¼2ï¼è´¨éé¨ï¼3ï¼æ»ç»å |
| | | */ |
| | | private Integer type; |
| | | |
| | | /** |
| | | * å¤çæè§ |
| | | */ |
| | | private String tell; |
| | | |
| | | /** |
| | | * å¤çæ¹å¼ æ ¼å¼[1,2,3] 0ï¼è¿å·¥ï¼1ï¼è¿ä¿®ï¼2ï¼è®©æ¥æ¥æ¶ï¼3ï¼ææ¶ï¼4ï¼é级使ç¨ï¼5ï¼æ¥åº |
| | | */ |
| | | private String way; |
| | | |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 填忥æ |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å
³è å¡«å人ï¼ç¨æ·idï¼ |
| | | */ |
| | | private Integer userId; |
| | | |
| | | /** |
| | | * å
³è ä¸åæ ¼ç»è®¡è¡¨id |
| | | */ |
| | | private Integer rawUnacceptedId; |
| | | } |
| | |
| | | * @param dealState |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, String supplier,Integer type); |
| | | IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, Integer type); |
| | | |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.Opinion; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼å¤çæè§è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-07 01:54:28 |
| | | */ |
| | | public interface OpinionService extends IService<Opinion> { |
| | | |
| | | IPage<Map<String, Object>> selectOpinionPage(Page<Object> page, String productName, String specificationsModels); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.service.InspectionItemService; |
| | | import com.yuanchu.mom.service.ProductService; |
| | | import com.yuanchu.mom.service.SpecificationsService; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | .reason(finishedInspect.getProjectName() + "ä¸åæ ¼") //æä¸å®ä¹ä¸ºå·¥ç¨åç§°ä¸åæ ¼ |
| | | .rawInspectId(finishedInspectId) |
| | | .type(finishedInspect.getType()) |
| | | .supplier(finishedInspect.getCustomerName()) |
| | | .build(); |
| | | inspectUnacceptedMapper.insert(inspectUnaccepted); |
| | | } |
| | |
| | | |
| | | //æ¥è¯¢åææä¸åæ ¼åæ£éªåå表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, String supplier,Integer type) { |
| | | public IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, Integer type) { |
| | | if (type==null){ |
| | | type=2;//为空æ¯åææ2 |
| | | } |
| | | switch (type) { |
| | | case 2: |
| | | //2æ¯æ¥è¯¢åææä¸åæ ¼å |
| | | return inspectUnacceptedMapper.selectUnRawInspectsList(page,formTime,dealState,supplier,0); |
| | | return inspectUnacceptedMapper.selectUnRawInspectsList(page,formTime,dealState,2); |
| | | case 1: |
| | | //1æ¯æ¥è¯¢è¿ç¨ä¸åæ ¼å |
| | | return inspectUnacceptedMapper.selectInsList(page,formTime,dealState,supplier,1); |
| | | return inspectUnacceptedMapper.selectInsList(page,formTime,dealState,1); |
| | | case 0: |
| | | //0æ¯æ¥è¯¢æåä¸åæ ¼å |
| | | return inspectUnacceptedMapper.selectInsList(page,formTime,dealState,supplier,2); |
| | | return inspectUnacceptedMapper.selectInsList(page,formTime,dealState,0); |
| | | default: |
| | | return null; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.Opinion; |
| | | import com.yuanchu.mom.mapper.OpinionMapper; |
| | | import com.yuanchu.mom.service.OpinionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼å¤çæè§è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-07 01:54:28 |
| | | */ |
| | | @Service |
| | | public class OpinionServiceImpl extends ServiceImpl<OpinionMapper, Opinion> implements OpinionService { |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> selectOpinionPage(Page<Object> page, String productName, String specificationsModels) { |
| | | MyUtil.PrintLog(page +"=======" + productName + "===" + specificationsModels); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | <mapper namespace="com.yuanchu.mom.mapper.FinishedInspectMapper"> |
| | | |
| | | <select id="selectFinishedInspectPage" resultType="map"> |
| | | SELECT f.`id`, f.`order_number`, f.`customer_name`, f.`project_name`, f.`quality_traceability`, f.`material`, f.`specifications_model`, f.`unit`, |
| | | SELECT f.`id`, f.`order_number`, f.`customer_name`, f.`project_name`, f.`quality_traceability`, f.`material_code`, f.`material`, f.`specifications_model`, f.`unit`, |
| | | f.`quantity`, u.`name`, DATE_FORMAT(f.`create_time`, '%Y-%m-%d') detectionPeriod, f.`result` |
| | | FROM finished_inspect f, `user` u |
| | | WHERE f.`user_id` = u.`id` |
| | |
| | | <mapper namespace="com.yuanchu.mom.mapper.InspectUnacceptedMapper"> |
| | | <select id="selectUnRawInspectsList" resultType="java.util.Map"> |
| | | select DATE_FORMAT(form_time, '%Y-%m-%d') 'æ¥ææ¥æ', |
| | | supplier, |
| | | reason, |
| | | code, |
| | | name, |
| | |
| | | deal_reasult, |
| | | DATE_FORMAT(deal_time, '%Y-%m-%d') 'å¤çæ¥æ' |
| | | from mom_ocean.raw_inspect ri inner join mom_ocean.inspect_unaccepted ru on ri.id = ru.raw_inspect_id |
| | | <where> |
| | | <if test="dealState!=null"> |
| | | where deal_state=#{dealState} |
| | | and deal_state=#{dealState} |
| | | </if> |
| | | <if test="formTime!=null"> |
| | | and form_time=#{formTime} |
| | | </if> |
| | | <if test="supplier!=null"> |
| | | and supplier=#{supplier} |
| | | </if> |
| | | <if test="type!=null"> |
| | | and ru.type=#{type} |
| | | </if> |
| | | and ru.state=1 |
| | | </where> |
| | | </select> |
| | | <select id="selectInsList" resultType="java.util.Map"> |
| | | select DATE_FORMAT(fi.create_time, '%Y-%m-%d') 'æ¥ææ¥æ', |
| | | supplier, |
| | | reason, |
| | | material_code, |
| | | name, |
| | |
| | | </if> |
| | | <if test="formTime!=null"> |
| | | and fi.create_time=#{formTime} |
| | | </if> |
| | | <if test="supplier!=null"> |
| | | and supplier=#{supplier} |
| | | </if> |
| | | <if test="type!=null"> |
| | | and ru.type=#{type} |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.mom.mapper.OpinionMapper"> |
| | | |
| | | </mapper> |
| | |
| | | <artifactId>standard-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!--å·¥å
·æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>framework</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.api.ApiController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.service.RepertoryService; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * @author zss |
| | | * @since 2023-08-07 16:33:01 |
| | | */ |
| | | @Api(tags = "åºå表æ¥å£") |
| | | @Api(tags = "WMS管ç-->åºå") |
| | | @RestController |
| | | @RequestMapping("/repertory") |
| | | public class RepertoryController { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.Repertory; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') 'å
¥åºæ¥æ', |
| | | note |
| | | from mom_ocean.repertory |
| | | where state=1 |
| | | <if test="name!=null and name!=' '"> |
| | | and name LIKE CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="specifications!=null and specifications!=' '"> |
| | | and specifications LIKE CONCAT('%',#{specifications},'%') |
| | | </if> |
| | | <if test="time!=null and time!=''"> |
| | | and create_time=#{time} |
| | | </if> |
| | | <if test="type!=null and type!=''"> |
| | | and type=#{type} |
| | | </if> |
| | | <where> |
| | | and state=1 |
| | | <if test="name!=null"> |
| | | and name =#{name} |
| | | </if> |
| | | <if test="specifications!=null "> |
| | | and specifications=#{specifications} |
| | | </if> |
| | | <if test="time!=null "> |
| | | and create_time=#{time} |
| | | </if> |
| | | <if test="type!=null"> |
| | | and type=#{type} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <module>user-server</module> |
| | | <module>standard-server</module> |
| | | <module>inspect-server</module> |
| | | <module>inventory-server</module> |
| | | <module>system-run</module> |
| | | <module>sale-server</module> |
| | | </modules> |
| | | |
| | | <properties> |
| | |
| | | <swagger.version>3.0.0</swagger.version> |
| | | <knife4j-spring-ui.version>3.0.3</knife4j-spring-ui.version> |
| | | <druid.version>1.2.18</druid.version> |
| | | <mybatis-plus.version>3.4.0</mybatis-plus.version> |
| | | <mybatis-plus.version>3.5.3.1</mybatis-plus.version> |
| | | <openfeign.version>3.1.3</openfeign.version> |
| | | <feign-okhttp.version>11.0</feign-okhttp.version> |
| | | <shiro.version>1.5.3</shiro.version> |
| | | |
| | | <velocity-engine.version>2.3</velocity-engine.version> |
| | | <!--æäº¤å--> |
| | | <!-- æå
å导åºçè·¯å¾ --> |
| | | <package.path>${project.build.directory}/BLOG</package.path> |
| | | </properties> |
| | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | |
| | | <!--Swagger3--> |
| | |
| | | <version>${jwt.version}</version> |
| | | </dependency> |
| | | |
| | | <!--mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | |
| | | <!--mybatis-plus代ç çæå¨--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | |
| | | <artifactId>shiro-spring-boot-starter</artifactId> |
| | | <version>${shiro.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 代ç çæå¨æ¨¡æ¿ï¼ç¨äºçæä»£ç --> |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>${velocity-engine.version}</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>mom</artifactId> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <version>1.0.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>sale-server</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>standard-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>inventory-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>user-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <!--å·¥å
·æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>framework</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.vaadin.external.google</groupId> |
| | | <artifactId>android-json</artifactId> |
| | | <version>0.0.20131108.vaadin1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.dto.vo.SaleVo; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | import com.yuanchu.mom.pojo.dto.SaleDto; |
| | | import com.yuanchu.mom.service.SaleService; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®å å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @Api(tags = "éå®ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/sale") |
| | | public class SaleController { |
| | | |
| | | @Resource |
| | | SaleService saleService; |
| | | |
| | | @Resource |
| | | Jwt jwt; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢éå®åå表") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "orderNumber", value = "订åç¼å·", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "name", value = "产ååç§°", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "type", value = "ç¶æ(为空=å
¨é¨)", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "delTime", value = "äº¤è´§æ¥æ", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/selectSaleList") |
| | | public Result selectSaleList(Integer pageSize, Integer countSize, String orderNumber, String name, Integer type, String delTime) { |
| | | IPage<Map<String, Object>> salePage = saleService.selectSaleList(new Page<Object>(pageSize, countSize), orderNumber, name, type, delTime); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", salePage.getTotal()); |
| | | map.put("row", salePage.getRecords()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢éå®å") |
| | | @PostMapping("/addSale") |
| | | public Result addSale(@RequestHeader("token") String token, @RequestBody SaleDto saleDto) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String saleman = jsonObject.getString("name"); |
| | | saleService.addSale(saleman, saleDto); |
| | | return Result.success("æ°å¢æå!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®éå®åidæ¥ç详æ
") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "éå®åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/selectSaleDatilById") |
| | | public Result selectSaleDatil(Integer id) { |
| | | return Result.success(saleService.selectSaleDatil(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®éå®åidä¿®æ¹è¯¦æ
ä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "éå®åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/updateSaleById") |
| | | public Result updateSaleById(@RequestHeader("token") String token, Integer id, @RequestBody SaleVo saleVo) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String saleman = jsonObject.getString("name"); |
| | | saleService.updateSaleById(saleman,id, saleVo); |
| | | return Result.success("ä¿®æ¹æå!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®éå®åidå é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "éå®åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delSale") |
| | | public Result delSale(Integer id) { |
| | | saleService.delSale(id); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éå é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "éå®åid", dataTypeClass = String.class, dataType = "List", required = true) |
| | | }) |
| | | @PostMapping("/delAllSale") |
| | | public Result delAllSale( List<Integer> ids) { |
| | | saleService.delAllSale(ids); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "å®¡æ ¸") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "éå®åid", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "type", value = "ç¶æ", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/check") |
| | | public Result check(@RequestHeader("token") String token,Integer id,Integer type) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String checkname = jsonObject.getString("name"); |
| | | saleService.check(checkname,id,type); |
| | | return Result.success("å®¡æ ¸æå"); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®äº§åå å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sale-material") |
| | | public class SaleMaterialController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.Sale; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®å Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | public interface SaleMapper extends BaseMapper<Sale> { |
| | | |
| | | //æ¥è¯¢éå®åå表 |
| | | IPage<Map<String, Object>> selectSaleList(Page<Object> page, String orderNumber, String name, Integer type, String delTime); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®äº§åå Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | public interface SaleMaterialMapper extends BaseMapper<SaleMaterial> { |
| | | |
| | | //æ ¹æ®éå®åidæ¥è¯¢äº§åä¿¡æ¯ |
| | | List<SaleMaterial> selectSaleDatil(Integer id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.time.LocalDate; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®å |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Sale对象", description="éå®å") |
| | | public class Sale implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "éå®id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "订åç¼å·") |
| | | private String orderNumber; |
| | | |
| | | @ApiModelProperty(value = "ååç¼å·") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "å·¥ç¨åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String proname; |
| | | |
| | | @ApiModelProperty(value = "æ¶è´§å°å") |
| | | private String adress; |
| | | |
| | | @ApiModelProperty(value = "è系人") |
| | | private String username; |
| | | |
| | | @ApiModelProperty(value = "èç³»çµè¯") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "ä¸å人") |
| | | private String orderName; |
| | | |
| | | @ApiModelProperty(value = "ä¸å¡å(æ°å¢æ¶å½åç¨æ·å)") |
| | | private String saleman; |
| | | |
| | | @ApiModelProperty(value = "äº¤è´§æ¥æ") |
| | | @TableField("delTime") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date delTime; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº(å®¡æ ¸æ¶å½åç¨æ·å)") |
| | | private String checkname; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¥æ") |
| | | @TableField("checkTime") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | |
| | | private Integer state; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ 0:ä¸éè¿;1:éè¿") |
| | | private Integer type; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.time.LocalDate; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®äº§åå |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="SaleMaterial对象", description="éå®äº§åå") |
| | | public class SaleMaterial implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "产ååç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | private String specifications; |
| | | |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty(value = "æ°é") |
| | | private Integer number; |
| | | |
| | | @ApiModelProperty(value = "åä»·") |
| | | private String price; |
| | | |
| | | private Integer state; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "éå®åid") |
| | | private Integer saleId; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @JsonSerialize |
| | | //æ°å¢éå®ååæ° |
| | | public class SaleDto { |
| | | |
| | | //订åç¼å· |
| | | @JsonSerialize |
| | | private String orderNumber; |
| | | |
| | | //å·¥ç¨åç§° |
| | | @JsonSerialize |
| | | private String name; |
| | | |
| | | //ååç¼å· |
| | | @JsonSerialize |
| | | private String code; |
| | | |
| | | //客æ·åç§° |
| | | @JsonSerialize |
| | | private String proname; |
| | | |
| | | //æ¶è´§å°å |
| | | @JsonSerialize |
| | | private String adress; |
| | | |
| | | //è系人 |
| | | @JsonSerialize |
| | | private String username; |
| | | |
| | | //èç³»çµè¯ |
| | | @JsonSerialize |
| | | private String phone; |
| | | |
| | | //ä¸å人 |
| | | @JsonSerialize |
| | | private String orderName; |
| | | |
| | | //äº¤è´§æ¥æ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date delTime; |
| | | |
| | | //产åä¿¡æ¯ |
| | | @JsonSerialize |
| | | private List<SaleMaterialDto> saleMaterialList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo.dto; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @JsonSerialize |
| | | //æ°å¢äº§åä¿¡æ¯åæ° |
| | | public class SaleMaterialDto { |
| | | |
| | | //产ååç§° |
| | | @JsonSerialize |
| | | private String name; |
| | | |
| | | //è§æ ¼åå· |
| | | @JsonSerialize |
| | | private String specifications; |
| | | |
| | | //åä½ |
| | | @JsonSerialize |
| | | private String unit; |
| | | |
| | | //æ°é |
| | | @JsonSerialize |
| | | private Integer number; |
| | | |
| | | //åä»· |
| | | @JsonSerialize |
| | | private String price; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo.dto.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.yuanchu.mom.pojo.dto.SaleDto; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @JsonSerialize |
| | | //éå®å详æ
|
| | | public class SaleVo extends SaleDto { |
| | | |
| | | //ç¶æ0:ä¸éè¿;1:éè¿ |
| | | @JsonSerialize |
| | | private Integer type; |
| | | |
| | | //ä¸å¡å |
| | | @JsonSerialize |
| | | private String saleman; |
| | | |
| | | //å®¡æ ¸äºº |
| | | @JsonSerialize |
| | | private String checkname; |
| | | |
| | | //å®¡æ ¸æ¥æ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®äº§åå æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | public interface SaleMaterialService extends IService<SaleMaterial> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.Sale; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.dto.SaleDto; |
| | | import com.yuanchu.mom.pojo.dto.vo.SaleVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | public interface SaleService extends IService<Sale> { |
| | | |
| | | /** |
| | | * æ¥è¯¢éå®åå表 |
| | | * @param page |
| | | * @param orderNumber |
| | | * @param name |
| | | * @param type |
| | | * @param delTime |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> selectSaleList(Page<Object> page, String orderNumber, String name, Integer type, String delTime); |
| | | |
| | | /** |
| | | * æ°å¢éå®å |
| | | * @param saleDto |
| | | * @return |
| | | */ |
| | | String addSale(String saleman,SaleDto saleDto); |
| | | |
| | | /** |
| | | * æ ¹æ®éå®åidæ¥è¯¢éå®è¯¦æ
|
| | | * @param id |
| | | * @return |
| | | */ |
| | | SaleVo selectSaleDatil(Integer id); |
| | | |
| | | /** |
| | | * æ ¹æ®idå é¤éå®å |
| | | * @param id |
| | | */ |
| | | void delSale(Integer id); |
| | | |
| | | /** |
| | | * æ ¹æ®idæ¹éå é¤ |
| | | * @param ids |
| | | */ |
| | | void delAllSale(List<Integer> ids); |
| | | |
| | | /** |
| | | *æ ¹æ®éå®åidä¿®æ¹ä¿¡æ¯ |
| | | * @param saleman |
| | | * @param saleVo |
| | | */ |
| | | void updateSaleById(String saleman,Integer id, SaleVo saleVo); |
| | | |
| | | /** |
| | | * å®¡æ ¸ |
| | | * @param id |
| | | */ |
| | | void check(String checkname,Integer id,Integer type); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.yuanchu.mom.mapper.SaleMaterialMapper; |
| | | import com.yuanchu.mom.service.SaleMaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®äº§åå æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @Service |
| | | public class SaleMaterialServiceImpl extends ServiceImpl<SaleMaterialMapper, SaleMaterial> implements SaleMaterialService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.mapper.SaleMaterialMapper; |
| | | import com.yuanchu.mom.pojo.Sale; |
| | | import com.yuanchu.mom.mapper.SaleMapper; |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.yuanchu.mom.pojo.dto.SaleDto; |
| | | import com.yuanchu.mom.pojo.dto.SaleMaterialDto; |
| | | import com.yuanchu.mom.pojo.dto.vo.SaleVo; |
| | | import com.yuanchu.mom.service.SaleMaterialService; |
| | | import com.yuanchu.mom.service.SaleService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * éå®å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-08 |
| | | */ |
| | | @Service |
| | | public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements SaleService { |
| | | |
| | | @Resource |
| | | SaleMapper saleMapper; |
| | | |
| | | @Resource |
| | | SaleMaterialMapper saleMaterialMapper; |
| | | |
| | | //æ¥è¯¢éå®åå表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectSaleList(Page<Object> page, String orderNumber, String name, Integer type, String delTime) { |
| | | return saleMapper.selectSaleList(page,orderNumber,name,type,delTime); |
| | | } |
| | | |
| | | //æ°å¢éå®å |
| | | @Override |
| | | public String addSale(String saleman,SaleDto saleDto) { |
| | | Sale sale = new Sale(); |
| | | BeanUtils.copyProperties(saleDto,sale); |
| | | sale.setSaleman(saleman); |
| | | saleMapper.insert(sale); |
| | | //妿saleMaterialListæå¼,éè¦æ·»å éå®äº§åå |
| | | List<SaleMaterialDto> saleMaterialDtoList = saleDto.getSaleMaterialList(); |
| | | for (SaleMaterialDto saleMaterialDto : saleMaterialDtoList) { |
| | | SaleMaterial saleMaterial = new SaleMaterial(); |
| | | BeanUtils.copyProperties(saleMaterialDto,saleMaterial); |
| | | saleMaterial.setSaleId(sale.getId()); |
| | | saleMaterialMapper.insert(saleMaterial); |
| | | } |
| | | return "æ°å¢æå"; |
| | | } |
| | | |
| | | //æ ¹æ®éå®åidæ¥è¯¢éå®è¯¦æ
|
| | | @Override |
| | | public SaleVo selectSaleDatil(Integer id) { |
| | | SaleVo saleVo = new SaleVo(); |
| | | Sale sale = saleMapper.selectById(id); |
| | | BeanUtils.copyProperties(sale,saleVo); |
| | | List<SaleMaterial> saleMaterialList = saleMaterialMapper.selectSaleDatil(id);//éå®åid |
| | | List<SaleMaterialDto> saleMaterialDtoList = saleMaterialList.stream().map(saleMaterial -> { |
| | | SaleMaterialDto saleMaterialDto = new SaleMaterialDto(); |
| | | BeanUtils.copyProperties(saleMaterial, saleMaterialDto); |
| | | return saleMaterialDto; |
| | | }).collect(Collectors.toList()); |
| | | saleVo.setSaleMaterialList(saleMaterialDtoList); |
| | | return saleVo; |
| | | } |
| | | |
| | | //æ ¹æ®éå®åidå é¤ |
| | | @Override |
| | | public void delSale(Integer id) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setState(0); |
| | | saleMapper.updateById(sale); |
| | | List<SaleMaterial> saleMaterials = saleMaterialMapper.selectSaleDatil(id); |
| | | for (SaleMaterial saleMaterial : saleMaterials) { |
| | | saleMaterial.setState(0); |
| | | saleMaterialMapper.updateById(saleMaterial); |
| | | } |
| | | } |
| | | |
| | | //æ ¹æ®idæ¹éå é¤ |
| | | @Override |
| | | public void delAllSale(List<Integer> ids) { |
| | | List<Sale> sales = saleMapper.selectBatchIds(ids); |
| | | for (Sale sale : sales) { |
| | | sale.setState(0); |
| | | saleMapper.updateById(sale); |
| | | List<SaleMaterial> saleMaterials = saleMaterialMapper.selectSaleDatil(sale.getId()); |
| | | for (SaleMaterial saleMaterial : saleMaterials) { |
| | | saleMaterial.setState(0); |
| | | saleMaterialMapper.updateById(saleMaterial); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //æ ¹æ®éå®åidä¿®æ¹ä¿¡æ¯ |
| | | @Override |
| | | public void updateSaleById(String saleman, Integer id, SaleVo saleVo) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setSaleman(saleman); |
| | | BeanUtils.copyProperties(saleVo,sale); |
| | | //æ´æ°éå®å |
| | | saleMapper.updateById(sale); |
| | | List<SaleMaterial> saleMaterials = saleMaterialMapper.selectSaleDatil(id); |
| | | for (SaleMaterial saleMaterial : saleMaterials) { |
| | | List<SaleMaterialDto> saleMaterialDtos = saleVo.getSaleMaterialList(); |
| | | for (SaleMaterialDto saleMaterialDto : saleMaterialDtos) { |
| | | BeanUtils.copyProperties(saleMaterialDto,saleMaterial); |
| | | //æ´æ°éå®äº§åå |
| | | saleMaterialMapper.updateById(saleMaterial); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //å®¡æ ¸ |
| | | @Override |
| | | public void check(String checkname,Integer id,Integer type) { |
| | | Sale sale = saleMapper.selectById(id); |
| | | sale.setType(type); |
| | | sale.setCheckname(checkname); |
| | | sale.setCheckTime(new Date()); |
| | | saleMapper.updateById(sale); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.mom.mapper.SaleMapper"> |
| | | <select id="selectSaleList" resultType="java.util.Map"> |
| | | select order_number, |
| | | code, |
| | | name, |
| | | proname, |
| | | type, |
| | | DATE_FORMAT(delTime, '%Y-%m-%d') 'äº¤è´§æ¥æ' |
| | | from mom_ocean.sale |
| | | <where> |
| | | state=1 |
| | | <if test="orderNumber!=null"> |
| | | and order_number=#{orderNumber} |
| | | </if> |
| | | <if test="name!=null"> |
| | | and name=#{name} |
| | | </if> |
| | | <if test="type!=null"> |
| | | and type=#{type} |
| | | </if> |
| | | <if test="delTime!=null"> |
| | | and DATE_FORMAT(delTime, '%Y-%m-%d')=#{delTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.mom.mapper.SaleMaterialMapper"> |
| | | <select id="selectSaleDatil" resultType="com.yuanchu.mom.pojo.SaleMaterial"> |
| | | select id, name, specifications, unit, number, price, state, create_time, update_time, sale_id |
| | | from mom_ocean.sale_material |
| | | where state=1 |
| | | <if test="id!=null"> |
| | | and sale_id=#{id} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <artifactId>framework</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.vaadin.external.google</groupId> |
| | | <artifactId>android-json</artifactId> |
| | | <version>0.0.20131108.vaadin1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>user-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.pojo.dto.ProductDto; |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.yuanchu.mom.service.RawInsProductService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private RawInsProductService rawInsProductService; |
| | | |
| | | @ApiOperation(value = "ç¹å»è¡¨æ ¼ä¸çéæ©") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "deviceGroup", value = "设å¤ç»", dataTypeClass = String.class, required = true) |
| | |
| | | Map<String, Object> map = deviceService.selectTechnology(deviceGroup); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢ä»ªå¨è®¾å¤", tags = "QMS管ç-->å®éªå®¤ç®¡ç") |
| | | @PostMapping("/add") |
| | | public Result<?> addDevice(@RequestBody Device device){ |
| | | Boolean isUpdateSuccess = deviceService.addDevice(device); |
| | | if (isUpdateSuccess){ |
| | | return Result.success("æ·»å æåï¼"); |
| | | } |
| | | return Result.fail("æ·»å 失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢ä»ªå¨è®¾å¤ï¼ä¿ç®¡äººä¸ææ¡", tags = "QMS管ç-->å®éªå®¤ç®¡ç") |
| | | @GetMapping("/list_user") |
| | | public Result<?> selectUserIdAndName(){ |
| | | List<Map<String, Object>> maps = userService.listUserIdAndName(); |
| | | return Result.success(maps); |
| | | } |
| | | |
| | | @ApiOperation(value = "äºçº§æ ", tags = "QMS管ç-->å®éªå®¤ç®¡ç") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/two_tree") |
| | | public Result<?> deviceTwoTree(@RequestParam(defaultValue = "1") Integer type){ |
| | | List<Map<String, Object>> mapList= deviceService.deviceTwoTree(type); |
| | | return Result.success(mapList); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢ä»ªå¨è®¾å¤ï¼æ£éªé¡¹ç®ä¸ææ¡", tags = "QMS管ç-->å®éªå®¤ç®¡ç") |
| | | @GetMapping("/listInspect") |
| | | public Result<?> selectInspectIdAndName(){ |
| | | List<Map<String, Object>> mapList = rawInsProductService.selectInspectIdAndName(); |
| | | return Result.success(mapList); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢ä»ªå¨è®¾å¤ï¼æ£éªé¡¹ç®ä¸ææ¡", tags = "QMS管ç-->å®éªå®¤ç®¡ç") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "codeOrNameOrModel", value = "ç¼å·åç§°è§æ ¼åå·", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/page") |
| | | public Result<?> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel){ |
| | | IPage<Map<String, Object>> mapList = rawInsProductService.selectPageDevice(pageNo, pageSize, codeOrNameOrModel); |
| | | return Result.success(mapList); |
| | | } |
| | | } |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "id", value = "订åid", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "orderCode", value = "订åç¼å·", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "name", value = "产ååç§°", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "state", value = "ç¶æ(为空=å
¨é¨)", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "time", value = "ä¸åæ¶é´", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/selectAllOrder") |
| | | public Result selectAllOrder(int pageSize, int countSize, Integer id, String name, Integer state ,String time) { |
| | | IPage<Map<String, Object>> inspectionPage = ordersService.selectAllOrder(new Page<Object>(pageSize, countSize), id, name, state, time); |
| | | public Result selectAllOrder(int pageSize, int countSize, String orderCode, String name, Integer state ,String time) { |
| | | IPage<Map<String, Object>> inspectionPage = ordersService.selectAllOrder(new Page<Object>(pageSize, countSize), orderCode, name, state, time); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", inspectionPage.getTotal()); |
| | | map.put("row", inspectionPage.getRecords()); |
| ÎļþÃû´Ó inspect-server/src/main/java/com/yuanchu/mom/controller/RawInsProductController.java ÐÞ¸Ä |
| | |
| | | import com.yuanchu.mom.pojo.RawInsProduct; |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | |
| | | */ |
| | | public interface DeviceMapper extends BaseMapper<Device> { |
| | | |
| | | List<Map<String, Object>> deviceTwoTree(Integer type); |
| | | } |
| | |
| | | public interface OrdersMapper extends BaseMapper<Orders> { |
| | | |
| | | //æ¥è¯¢ææè®¢åå表 |
| | | IPage<Map<String, Object>> selectAllOrder(Page<Object> page, Integer id, String name, Integer state , String time); |
| | | IPage<Map<String, Object>> selectAllOrder(Page<Object> page, String orderCode, String name, Integer state , String time); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.pojo.RawInsProduct; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åææç³è¯·åä¸ç项ç®å表(RawInsProduct)è¡¨æ°æ®åºè®¿é®å± |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-01 13:52:30 |
| | | */ |
| | | public interface RawInsProductMapper extends BaseMapper<RawInsProduct> { |
| | | |
| | | List<Map<String, Object>> selectInspectIdAndName(); |
| | | |
| | | IPage<Map<String, Object>> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel); |
| | | } |
| | | |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "设å¤ç¼ç ") |
| | | @ApiModelProperty(value = "设å¤ç¼ç ", example = "YQSB20230808000001") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | @ApiModelProperty(value = "设å¤åç§°", example = "å卿º") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "设å¤åç»") |
| | | @ApiModelProperty(value = "设å¤åç»", example = "æºå¨") |
| | | private String father; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 1:ç产设å¤ï¼2ï¼æ£æµè®¾å¤", example = "1") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "ä¿ç®¡äºº", example = "1") |
| | | private Integer keeper; |
| | | |
| | | @ApiModelProperty(value = "è®¡éæªæ¢æææ", example = "2023-08-09", dataType = "date") |
| | | private Date endMeasure; |
| | | |
| | | @ApiModelProperty(value = "设å¤ç¶æ 1:è¿è¡ï¼2:æ¥åºï¼3:æ£ä¿®ï¼4:æ
éï¼5:空é²", example = "1") |
| | | private Integer deviceStatus; |
| | | |
| | | @ApiModelProperty(value = "åå®¶", example = "æ±èåééµ·éå·¥å") |
| | | private String factory; |
| | | |
| | | @ApiModelProperty(value = "åææç³è¯·åä¸ç项ç®å表ID", example = "7") |
| | | @TableField(exist = false) |
| | | private Integer rawInsProductId; |
| | | |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | @TableLogic(value = "1", delval = "0") |
| | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | |
| | | } |
| | |
| | | * 订åid |
| | | */ |
| | | @ApiModelProperty(name = "订åid") |
| | | @TableId(value = "id", type = IdType.ASSIGN_UUID) |
| | | @TableId( type =IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 订åç¼å· |
| | | */ |
| | | @ApiModelProperty(name = "订åç¼å·") |
| | | @TableField("order_code") |
| | | private String orderCode; |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | |
| | | |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @param id |
| | | */ |
| | | String getDeviceNameById(Integer id); |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Boolean addDevice(Device device); |
| | | |
| | | List<Map<String, Object>> deviceTwoTree(Integer type); |
| | | } |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> selectAllOrder(Page<Object> page, Integer id, String name, Integer state , String time); |
| | | IPage<Map<String, Object>> selectAllOrder(Page<Object> page, String orderCode, String name, Integer state , String time); |
| | | |
| | | |
| | | } |
| ÎļþÃû´Ó inspect-server/src/main/java/com/yuanchu/mom/service/RawInsProductService.java ÐÞ¸Ä |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.RawInsProduct; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åææç³è¯·åä¸ç项ç®å表(RawInsProduct)表æå¡æ¥å£ |
| | |
| | | * @param rawInsProduct |
| | | */ |
| | | void updaterawInsProduct(int userId, RawInsProduct rawInsProduct); |
| | | |
| | | List<Map<String, Object>> selectInspectIdAndName(); |
| | | |
| | | IPage<Map<String, Object>> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.mapper.DeviceMapper; |
| | | import com.yuanchu.mom.pojo.RawInsProduct; |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.service.RawInsProductService; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Resource |
| | | private RawInsProductService rawInsProductService; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectTechnology(String deviceGroup) { |
| | |
| | | Device device = deviceMapper.selectById(id); |
| | | return device.getName(); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addDevice(Device device) { |
| | | int insert = deviceMapper.insert(device); |
| | | if (insert == 1){ |
| | | LambdaUpdateWrapper<RawInsProduct> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(RawInsProduct::getId, device.getRawInsProductId()); |
| | | updateWrapper.set(RawInsProduct::getDeviceId, device.getId()); |
| | | return rawInsProductService.update(updateWrapper); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> deviceTwoTree(Integer type) { |
| | | return deviceMapper.deviceTwoTree(type); |
| | | } |
| | | } |
| | |
| | | |
| | | //æ¥è¯¢ææè®¢åå表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectAllOrder(Page<Object> page, Integer id, String name, Integer state , String time) { |
| | | return orderMapper.selectAllOrder(page, id,name,state, time); |
| | | public IPage<Map<String, Object>> selectAllOrder(Page<Object> page, String orderCode, String name, Integer state , String time) { |
| | | return orderMapper.selectAllOrder(page, orderCode,name,state, time); |
| | | } |
| | | |
| | | } |
| ÎļþÃû´Ó inspect-server/src/main/java/com/yuanchu/mom/service/impl/RawInsProductServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.RawInsProductMapper; |
| | | import com.yuanchu.mom.pojo.RawInsProduct; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åææç³è¯·åä¸ç项ç®å表(RawInsProduct)表æå¡å®ç°ç±» |
| | |
| | | rawInsProductMapper.update(rawInsProduct, updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectInspectIdAndName() { |
| | | return rawInsProductMapper.selectInspectIdAndName(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel) { |
| | | return rawInsProductMapper.selectPageDevice(pageNo, pageSize, codeOrNameOrModel); |
| | | } |
| | | |
| | | /*å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå
æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | |
| | | WHERE d.`state` = 1 |
| | | AND d.`id` = t.`device_id` |
| | | </select> |
| | | |
| | | <resultMap id="deviceTwoTreeOneMap" type="map"> |
| | | <id property="father" column="father"/> |
| | | <collection property="children" resultMap="deviceTwoTreeTwoMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="deviceTwoTreeTwoMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | </resultMap> |
| | | |
| | | <select id="deviceTwoTree" resultMap="deviceTwoTreeOneMap"> |
| | | SELECT d.`id`, d.`name`, d.`father` |
| | | FROM device d |
| | | WHERE d.state = 1 |
| | | AND d.type = #{type} |
| | | </select> |
| | | |
| | | <select id="DevicePageList" resultType="Map"> |
| | | SELECT * FROM device d |
| | | LEFT JOIN raw_ins_product r |
| | | ON d.`id` = r.`device_id` |
| | | WHERE r.`test_state` IS NULL |
| | | AND d.`state` = 1 |
| | | AND (r.`state` = 1 OR r.`state` IS NULL) |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.yuanchu.mom.mapper.OrdersMapper"> |
| | | <select id="selectAllOrder" resultType="java.util.Map"> |
| | | select o.id, |
| | | select order_code, |
| | | department, |
| | | province, |
| | | salesman, |
| | |
| | | o.state |
| | | from mom_ocean.orders o,mom_ocean.material m |
| | | <where> |
| | | <if test="id != null"> |
| | | and o.id = #{id} |
| | | <if test="orderCode != null"> |
| | | and order_code = #{orderCode} |
| | | </if> |
| | | <if test="time != null"> |
| | | and o.create_time = #{time} |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.mom.mapper.RawInsProductMapper"> |
| | | <select id="selectInspectIdAndName" resultType="map"> |
| | | SELECT r.`id`, r.`name` |
| | | FROM raw_ins_product r |
| | | LEFT JOIN device d |
| | | ON r.`device_id` = d.`id` |
| | | WHERE r.`state` = 1 |
| | | AND ((r.`device_id` IS NULL |
| | | OR (r.`device_id` IS NOT NULL AND r.`test_state` IS NOT NULL)) |
| | | OR (d.`state` = 0 AND r.`device_id` IS NOT NULL)) |
| | | </select> |
| | | |
| | | <select id="selectPageDevice" resultType="map"> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>system-run</name> |
| | | <description>system-run</description> |
| | | <packaging>pom</packaging> |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <!--åºç¡æ¡æ¶ç±»--> |
| | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>inventory-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>inventory-server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.yuanchu.mom</groupId> |
| | | <artifactId>sale-server</artifactId> |
| | | <version>1.0.0</version> |
| | | </dependency> |
| | | |
| | | <!--druid--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid</artifactId> |
| | | </dependency> |
| | | |
| | | <!--mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!--mybatis-plus代ç çæå¨--> |
| | |
| | | <artifactId>mybatis-plus-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- framework: mybatis-plus代ç çæéè¦ä¸ä¸ªæ¨¡æ¿å¼æ --> |
| | | <!-- 代ç çæå¨æ¨¡æ¿ï¼ç¨äºçæä»£ç --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-freemarker</artifactId> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | </dependency> |
| | | |
| | | <!--mysql--> |
| | |
| | | package com.yuanchu.mom; |
| | | |
| | | import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.InjectionConfig; |
| | | import com.baomidou.mybatisplus.generator.FastAutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.config.*; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Collections; |
| | | import java.util.Scanner; |
| | | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://localhost:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai"; |
| | | public static String database_driver_name = "com.mysql.cj.jdbc.Driver"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "123456"; |
| | | public static String author = "æ±èéµ·éç½ç»ç§ææéå
¬å¸"; |
| | | public static String model_name = "/inspect-server"; // å¦æä¸ºåå¸å¼å¡«å模ååç§°ï¼å¦æä¸æ¯åå¸å¼ä¸ºç©ºå³å¯ |
| | | public static String model_name = "/sale-server"; // å¦æä¸ºåå¸å¼å¡«å模ååç§°ï¼å¦æä¸æ¯åå¸å¼ä¸ºç©ºå³å¯ |
| | | public static String setParent = "com.yuanchu.mom"; // å
è·¯å¾ |
| | | public static Boolean Override = false; // æ¯å¦è¦ç忥çæä»¶ï¼ |
| | | |
| | | public static void main(String[] args) { |
| | | // 代ç çæå¨ |
| | | AutoGenerator mpg = new AutoGenerator(); |
| | | |
| | | String projectPath = System.getProperty("user.dir"); |
| | | System.out.println(projectPath+"==================="); |
| | | |
| | | GlobalConfig gc = new GlobalConfig() // å
¨å±é
ç½® |
| | | .setOutputDir(projectPath + model_name + "/src/main/java") // è¾åºè·¯å¾ |
| | | .setAuthor(author) // ä½è
注é |
| | | .setOpen(false) // æ¯å¦æå¼ |
| | | .setSwagger2(true) //å®ä½å±æ§ Swagger2 注解 |
| | | .setServiceName("%sService") // 设置serviceNameçåç§°å»å¤§åI |
| | | .setFileOverride(Override);// æ¯å¦è¦çå·²çææä»¶ |
| | | mpg.setGlobalConfig(gc); |
| | | |
| | | // æ°æ®æºé
ç½® æ°æ®åºå è´¦å·å¯ç |
| | | DataSourceConfig dsc = new DataSourceConfig() |
| | | .setUrl(database_url) |
| | | .setDriverName(database_driver_name) |
| | | .setUsername(database_username) |
| | | .setPassword(database_password); |
| | | mpg.setDataSource(dsc); |
| | | |
| | | |
| | | // å
é
ç½® |
| | | PackageConfig pc = new PackageConfig() |
| | | .setModuleName(null) |
| | | .setParent(setParent) |
| | | .setEntity("pojo");// å
è·¯å¾ |
| | | mpg.setPackageInfo(pc); |
| | | |
| | | // èªå®ä¹é
ç½® |
| | | InjectionConfig cfg = new InjectionConfig() { |
| | | @Override |
| | | public void initMap() { |
| | | // to do nothing |
| | | } |
| | | }; |
| | | |
| | | // å¦ææ¨¡æ¿å¼ææ¯ freemarker |
| | | String templatePath = "/templates/mapper.xml.ftl"; |
| | | // å¦ææ¨¡æ¿å¼ææ¯ velocity |
| | | // String templatePath = "/templates/mapper.xml.vm"; |
| | | |
| | | // èªå®ä¹è¾åºé
ç½® |
| | | List<FileOutConfig> focList = new ArrayList<>(); |
| | | // èªå®ä¹é
ç½®ä¼è¢«ä¼å
è¾åº |
| | | focList.add(new FileOutConfig(templatePath) { |
| | | @Override |
| | | public String outputFile(TableInfo tableInfo) { |
| | | // èªå®ä¹è¾åºæä»¶å ï¼ å¦æä½ Entity 设置äºååç¼ãæ¤å¤æ³¨æ xml çåç§°ä¼è·çåçååï¼ |
| | | return projectPath + model_name + "/src/main/resources/mapper/" |
| | | + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; |
| | | } |
| | | }); |
| | | |
| | | cfg.setFileOutConfigList(focList); |
| | | mpg.setCfg(cfg); |
| | | |
| | | // é
ç½®æ¨¡æ¿ |
| | | TemplateConfig templateConfig = new TemplateConfig() |
| | | .setXml(null); |
| | | |
| | | mpg.setTemplate(templateConfig); |
| | | |
| | | // çç¥é
ç½® |
| | | StrategyConfig strategy = new StrategyConfig() |
| | | .setNaming(NamingStrategy.underline_to_camel) |
| | | .setColumnNaming(NamingStrategy.underline_to_camel) |
| | | .setEntityLombokModel(true) |
| | | .setRestControllerStyle(true) |
| | | .setInclude(scanner("表åï¼å¤ä¸ªç©ºæ ¼åå²").split(" ")) |
| | | .setControllerMappingHyphenStyle(true) |
| | | .setTablePrefix("m_"); |
| | | mpg.setStrategy(strategy); |
| | | mpg.setTemplateEngine(new FreemarkerTemplateEngine()); |
| | | //妿ä¸è°ç¨è¯¥æ¹æ³ãå°±ä¼ä½¿ç¨MyBatis-Plusé»è®¤çæä»¶çæè·¯å¾åå
è·¯å¾çææä»¶ãä½å¯ä»¥ä½¿ç¨ä¸é¢çPackageConfigåä¸äºç®åçé
ç½® |
| | | mpg.execute(); |
| | | FastAutoGenerator.create(database_url, database_username, database_password) |
| | | // å
¨å±é
ç½® |
| | | .globalConfig(builder -> { |
| | | builder.author(author) // 设置ä½è
|
| | | .commentDate("yyyy-MM-dd hh:mm:ss") //æ³¨éæ¥æ |
| | | .outputDir(projectPath + model_name + "/src/main/java") // æå®è¾åºç®å½ |
| | | .disableOpenDir() //ç¦æ¢æå¼è¾åºç®å½ï¼é»è®¤æå¼ |
| | | ; |
| | | }) |
| | | // å
é
ç½® |
| | | .packageConfig(builder -> { |
| | | builder.entity("pojo"); |
| | | builder.parent(setParent) // 设置ç¶å
å |
| | | .pathInfo(Collections.singletonMap(OutputFile.xml, projectPath + model_name + "/src/main/resources/mapper")); // 设置mapperXmlçæè·¯å¾ |
| | | }) |
| | | // çç¥é
ç½® |
| | | .strategyConfig(builder -> { |
| | | builder.addInclude(scanner("表åï¼å¤ä¸ªç©ºæ ¼åå²").split(" ")) // 设置éè¦çæç表å |
| | | .addTablePrefix("sys_") // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | // Entity çç¥é
ç½® |
| | | .entityBuilder() |
| | | .enableLombok() //å¼å¯ Lombok |
| | | .naming(NamingStrategy.underline_to_camel) //æ°æ®åºè¡¨æ å°å°å®ä½çå½åçç¥ï¼ä¸åçº¿è½¬é©¼å³°å½ |
| | | .columnNaming(NamingStrategy.underline_to_camel) //æ°æ®åºè¡¨å段æ å°å°å®ä½çå½åçç¥ï¼ä¸åçº¿è½¬é©¼å³°å½ |
| | | // Mapper çç¥é
ç½® |
| | | .mapperBuilder() |
| | | .enableFileOverride() // è¦çå·²çææä»¶ |
| | | // Service çç¥é
ç½® |
| | | .serviceBuilder() |
| | | .enableFileOverride() // è¦çå·²çææä»¶ |
| | | .formatServiceFileName("%sService") //æ ¼å¼å service æ¥å£æä»¶åç§°ï¼%sè¿è¡å¹é
表åï¼å¦ UserService |
| | | .formatServiceImplFileName("%sServiceImpl") //æ ¼å¼å service å®ç°ç±»æä»¶åç§°ï¼%sè¿è¡å¹é
表åï¼å¦ UserServiceImpl |
| | | // Controller çç¥é
ç½® |
| | | .controllerBuilder() |
| | | .enableFileOverride() // è¦çå·²çææä»¶ |
| | | ; |
| | | }) |
| | | .execute(); |
| | | } |
| | | |
| | | /** |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: root |
| | | url: jdbc:mysql://192.168.110.209:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: user |
| | | password: 123456 |
| | | druid: |
| | | # Druidæ°æ®æºé
ç½® |
| | |
| | | package com.yuanchu.mom; |
| | | |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | int i = checkValues(">=2", "=0", "0"); |
| | | System.out.println(i); |
| | | |
| | | } |
| | | |
| | | public int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |
| | | String substring = valueStr.substring(1,2); |
| | | if (substring.equals("=")) { |
| | | String operator = valueStr.substring(0, 2); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(2)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator){ |
| | | case ">=": |
| | | return detectionValue >= standardValue; |
| | | case "<=": |
| | | return detectionValue <= standardValue; |
| | | default: |
| | | return false; |
| | | } |
| | | }else { |
| | | String operator = valueStr.substring(0,1); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(1)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator){ |
| | | case ">": |
| | | return detectionValue > standardValue; |
| | | case "<": |
| | | return detectionValue < standardValue; |
| | | case "=": |
| | | return detectionValue.equals(standardValue); |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |