|
| 1 | +text = """ |
| 2 | +permit_product_level → permit_product_level_name, mfg_id, eff_date, end_date, permit_product_level_id |
| 3 | +
|
| 4 | +permit_purchase_unit → permit_purchase_unit_name, mfg_id, eff_date, end_date |
| 5 | +
|
| 6 | +""" |
| 7 | + |
| 8 | +extra_text = """ |
| 9 | +sku_type → sku_type_id, sku_type, sku_type_desc, bundle_flag, manual_flag, comp_maint_flag, nexus_safe_flag, include_in_mart_flag, show_cost_form_flag, autogen_new_sku_flag, update_dts, update_uid, inventory_flag, leadtime_flag |
| 10 | +product_flag_type → product_flag_type_id, product_flag_type |
| 11 | +""" |
| 12 | + |
| 13 | +boiler_code = """ |
| 14 | +package com.comp.project.cache.entity; |
| 15 | +
|
| 16 | +import java.sql.Timestamp; |
| 17 | +
|
| 18 | +import javax.persistence.Column; |
| 19 | +import javax.persistence.Entity; |
| 20 | +import javax.persistence.GeneratedValue; |
| 21 | +import javax.persistence.GenerationType; |
| 22 | +import javax.persistence.Id; |
| 23 | +import javax.persistence.Table; |
| 24 | +
|
| 25 | +@Entity |
| 26 | +@Table(name = "{0}") |
| 27 | +public class {1} """ |
| 28 | + |
| 29 | +column_boiler_code = """ |
| 30 | + @Column(name="{}") |
| 31 | + private {} {}; |
| 32 | +""" |
| 33 | + |
| 34 | +id_boiler_code = """ |
| 35 | + @Id |
| 36 | + @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 37 | + @Column(name="{}") |
| 38 | + private Integer {}; |
| 39 | +""" |
| 40 | + |
| 41 | +repo_boiler_code = """package com.comp.project.cache.dao; |
| 42 | +
|
| 43 | +import org.springframework.data.jpa.repository.JpaRepository; |
| 44 | +import org.springframework.stereotype.Repository; |
| 45 | +
|
| 46 | +import com.comp.project.cache.entity.{}; |
| 47 | +
|
| 48 | +
|
| 49 | +@Repository |
| 50 | +public interface {}Repository extends JpaRepository<{}, Integer> """ |
| 51 | + |
| 52 | +service_bolier_code = """ |
| 53 | + public void load{0}Repository() {{ |
| 54 | + try {{ |
| 55 | + List<{1}> {2}s = {3}Repository.findAll(); |
| 56 | + redisTemplate.delete("{4}"); |
| 57 | + Gson gson = new Gson(); |
| 58 | + {5}s.parallelStream().forEach({6}->{{ |
| 59 | + String json = gson.toJson({7}); |
| 60 | + redisTemplate.opsForHash().put("{8}", |
| 61 | + String.valueOf({9}.get{10}Id()), json); |
| 62 | + }}); |
| 63 | + }} |
| 64 | + catch (Exception e) {{ |
| 65 | + logger.error("Error in load{11}Repository {{}}",e.getMessage()); |
| 66 | + }} |
| 67 | + }} |
| 68 | +""" |
| 69 | + |
| 70 | +autboiler_code = """ |
| 71 | + @Autowired |
| 72 | + {0} {1}; |
| 73 | +
|
| 74 | +""" |
| 75 | + |
| 76 | +load_boiler_code = """load{0}Repository(); |
| 77 | +""" |
| 78 | + |
| 79 | +junit_boiler_code = """ |
| 80 | +package com.comp.team.project.catalog.handler.entity; |
| 81 | +
|
| 82 | +import static org.junit.jupiter.api.Assertions.assertNull; |
| 83 | +
|
| 84 | +import org.junit.jupiter.api.Test; |
| 85 | +
|
| 86 | +class {0}Test {{ |
| 87 | +
|
| 88 | + private {0} {1}; |
| 89 | + |
| 90 | +
|
| 91 | + @Test |
| 92 | + void test() {{ |
| 93 | + {1} = new {0}(); |
| 94 | + |
| 95 | +{2} |
| 96 | + }} |
| 97 | +
|
| 98 | +}} |
| 99 | +
|
| 100 | +""" |
| 101 | + |
| 102 | +setter_boiler_code = """{0}.{1}(null);""" |
| 103 | + |
| 104 | +getter_boiler_code = """assertNull({0}.{1});""" |
| 105 | + |
| 106 | + |
| 107 | +test_mock_boiler_code = """ |
| 108 | +@Mock |
| 109 | +List<{0}> {1}; |
| 110 | +""" |
| 111 | + |
| 112 | +test_when_boiler_code = """when({0}).thenReturn({1}); |
| 113 | +""" |
| 114 | + |
| 115 | +test_new_object = """ |
| 116 | + {0} = new ArrayList<{1}>() {{{{ |
| 117 | + add(new {1}()); |
| 118 | + }}}}; |
| 119 | +""" |
| 120 | + |
| 121 | +redis_boiler_delete = """when(redisTemplate.delete("{0}")).thenReturn(null); |
| 122 | +""" |
| 123 | + |
| 124 | +test_function_boiler_code = """ |
| 125 | + @Test |
| 126 | + @SuppressWarnings("serial") |
| 127 | + void {0}Test() {{ |
| 128 | + {1} |
| 129 | +
|
| 130 | + {2} |
| 131 | + {3} |
| 132 | + teamCacheService.{0}(); |
| 133 | + {4}thenReturn(null); |
| 134 | + teamCacheService.{0}(); |
| 135 | + assertNull(null); |
| 136 | + }} |
| 137 | +""" |
| 138 | + |
| 139 | +constructor_boiler_code = """doNothing().when(new teamCacheService()).{0}; |
| 140 | +""" |
| 141 | + |
| 142 | +meth_code = """ |
| 143 | + |
| 144 | +""" |
| 145 | + |
| 146 | + |
| 147 | +sql_boiler_code = """exec sp_help {0} |
| 148 | +""" |
0 commit comments